MVault 0.0.1
Loading...
Searching...
No Matches
CsvParser.h
1#pragma once
2
3#include <string>
4#include <vector>
5#include <fstream>
6#include <iostream>
7
8namespace mvlt
9{
36 std::string FormatStringToCsv(const std::string& str) noexcept;
37
40 {
41 private:
42
43 // Pointer to array with file data
44 char* FileData = nullptr;
45
46 // Current position in file
47 std::size_t ReadingPos = 0;
48
49 // Full file length
50 std::size_t FileLen = 0;
51 public:
52
60 bool OpenFile(const std::string& fileName) noexcept;
61
70 bool GetNextVector(std::vector<std::string>& vectorWithNext, const char& separator) noexcept;
71
73 ~CsvParser() noexcept;
74 };
75
77}
A class for parsing csv files that provides data in a form similar to generators.
Definition CsvParser.h:40
bool GetNextVector(std::vector< std::string > &vectorWithNext, const char &separator) noexcept
The method for getting the next record in the file. It works by analogy with generators in Python.
Definition CsvParser.cpp:59
~CsvParser() noexcept
Default destructor.
Definition CsvParser.cpp:137
bool OpenFile(const std::string &fileName) noexcept
The method for opening the file.
Definition CsvParser.cpp:35
std::string FormatStringToCsv(const std::string &str) noexcept
A function for converting a string to a csv field format.
Definition CsvParser.cpp:5