mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
37 lines
733 B
C++
37 lines
733 B
C++
#pragma once
|
|
#include "Utils/MemoryManager.h"
|
|
|
|
#include <functional>
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
class CsvInputStream
|
|
{
|
|
public:
|
|
explicit CsvInputStream(std::istream& stream);
|
|
|
|
bool NextRow(std::vector<std::string>& out) const;
|
|
bool NextRow(std::vector<const char*>& out, MemoryManager& memory) const;
|
|
|
|
private:
|
|
bool EmitNextRow(const std::function<void(std::string)>& cb) const;
|
|
|
|
std::istream& m_stream;
|
|
};
|
|
|
|
class CsvOutputStream
|
|
{
|
|
public:
|
|
explicit CsvOutputStream(std::ostream& stream);
|
|
|
|
void WriteColumn(const std::string& value);
|
|
void NextRow();
|
|
|
|
private:
|
|
std::ostream& m_stream;
|
|
unsigned m_column_count;
|
|
unsigned m_current_column;
|
|
bool m_first_row;
|
|
};
|