forked from p_lusterinc_xsync/xsync_fpge
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.0 KiB
57 lines
1.0 KiB
#pragma once
|
|
#include <fstream>
|
|
#include <functional>
|
|
#include <iostream>
|
|
#include <list>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <set>
|
|
#include <sstream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace iflytop {
|
|
using namespace std;
|
|
|
|
class ZCSVCell {
|
|
public:
|
|
int rowNum;
|
|
int colNum;
|
|
string data;
|
|
};
|
|
|
|
class ZCSV {
|
|
private:
|
|
list<ZCSVCell> csvData;
|
|
|
|
int m_maxRowNum = -1;
|
|
int m_maxColNum = -1;
|
|
|
|
public:
|
|
ZCSV();
|
|
|
|
bool parseCSV(string filename);
|
|
|
|
void setdata(int rowNum, int colNum, string data);
|
|
string getdata(int rowNum, int colNum);
|
|
|
|
int maxRowNum() { return m_maxRowNum; }
|
|
int maxColNum() { return m_maxColNum; }
|
|
|
|
bool isColExist(string key);
|
|
int findCol(string key);
|
|
string getData(string key, int rowNum);
|
|
|
|
void setData(string rowName, string colName, string data);
|
|
|
|
vector<string> getRowKeys();
|
|
void dumpCSV(string filename);
|
|
|
|
private:
|
|
ZCSVCell* findCell(int rowNum, int colNum);
|
|
|
|
int forceFindRow(string name);
|
|
int forceFindCol(string name);
|
|
};
|
|
|
|
} // namespace iflytop
|