2017-01-20 14:36:52 +01:00
|
|
|
#pragma once
|
|
|
|
|
2016-01-06 01:23:43 +01:00
|
|
|
namespace Utils
|
|
|
|
{
|
|
|
|
class CSV
|
|
|
|
{
|
|
|
|
public:
|
2017-03-26 09:47:53 -04:00
|
|
|
CSV() { }
|
2018-12-17 14:29:18 +01:00
|
|
|
CSV(const std::string& file, bool isFile = true, bool allowComments = true);
|
2016-01-06 01:23:43 +01:00
|
|
|
~CSV();
|
|
|
|
|
2016-11-20 14:09:07 +01:00
|
|
|
int getRows();
|
|
|
|
int getColumns();
|
|
|
|
int getColumns(size_t row);
|
2016-01-06 01:23:43 +01:00
|
|
|
|
2016-11-20 14:09:07 +01:00
|
|
|
std::string getElementAt(size_t row, size_t column);
|
2016-01-06 01:23:43 +01:00
|
|
|
|
2017-04-04 22:35:30 +02:00
|
|
|
bool isValid() { return this->valid; }
|
|
|
|
|
2016-01-06 01:23:43 +01:00
|
|
|
private:
|
2019-12-25 23:03:43 +01:00
|
|
|
bool valid = false;
|
2016-11-20 14:09:07 +01:00
|
|
|
std::vector<std::vector<std::string>> dataMap;
|
2016-01-06 01:23:43 +01:00
|
|
|
|
2018-12-17 14:29:18 +01:00
|
|
|
void parse(const std::string& file, bool isFile = true, bool allowComments = true);
|
|
|
|
void parseRow(const std::string& row, bool allowComments = true);
|
2016-01-06 01:23:43 +01:00
|
|
|
};
|
|
|
|
}
|