You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
#include "NativeStream.h"
|
|
|
|
|
|
#include "StreamingTsvParser.h"
|
|
|
|
|
|
#include "TableDataImporter.h"
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 真流式 TSV 流:Write 时边解析边导入,只保留未完成行尾块
|
|
|
|
|
|
*/
|
|
|
|
|
|
class StreamingTsvStream : public INativeStream
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
StreamingTsvStream(CSigmaView* pView, int importType);
|
|
|
|
|
|
|
|
|
|
|
|
void Write(const void* data, size_t size) override;
|
|
|
|
|
|
void Complete() override;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
void OnParsedLine(int lineIndex, const std::vector<std::string>& fields);
|
|
|
|
|
|
std::vector<CString> FieldsToCString(const std::vector<std::string>& fields);
|
|
|
|
|
|
|
|
|
|
|
|
StreamingTsvParser m_parser;
|
|
|
|
|
|
CSigmaView* m_pView = nullptr;
|
|
|
|
|
|
int m_importType = 0;
|
|
|
|
|
|
std::map<CString, int> m_columnIndexMap;
|
|
|
|
|
|
std::unique_ptr<CurveStreamImporter> m_curveImporter;
|
|
|
|
|
|
bool m_headersReady = false;
|
|
|
|
|
|
};
|