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.

50 lines
871 B

12 months ago
11 months ago
12 months ago
  1. #pragma once
  2. #include <fstream>
  3. #include <functional>
  4. #include <iostream>
  5. #include <list>
  6. #include <map>
  7. #include <memory>
  8. #include <set>
  9. #include <sstream>
  10. #include <string>
  11. #include <vector>
  12. namespace iflytop {
  13. using namespace std;
  14. class ZCSVCell {
  15. public:
  16. int rowNum;
  17. int colNum;
  18. string data;
  19. };
  20. class ZCSV {
  21. private:
  22. list<ZCSVCell> csvData;
  23. int m_maxRowNum = 0;
  24. int m_maxColNum = 0;
  25. public:
  26. ZCSV();
  27. bool parseCSV(string filename);
  28. void setdata(int rowNum, int colNum, string data);
  29. string getdata(int rowNum, int colNum);
  30. int maxRowNum() { return m_maxRowNum; }
  31. int maxColNum() { return m_maxColNum; }
  32. bool isColExist(string key);
  33. int findCol(string key);
  34. string getData(string key, int rowNum);
  35. vector<string> getRowKeys();
  36. private:
  37. ZCSVCell* findCell(int rowNum, int colNum);
  38. };
  39. } // namespace iflytop