MVault 1.0.0
Simple c++ database
Loading...
Searching...
No Matches
CsvParser.h
1#pragma once
2
3#include <string>
4#include <vector>
5
6#include "StreamFileReader.h"
7
8namespace mvlt
9{
36 std::string FormatStringToCsv(const std::string& str) noexcept;
37
40 {
41 private:
42 // File reader that allow to read file by chunks
43 StreamFileReader FileReader;
44
45 public:
48 CsvParser() noexcept;
49
55 CsvParser(const CsvParser& other) noexcept = delete;
56
62 CsvParser(CsvParser&& other) noexcept = delete;
63
70 CsvParser& operator=(const CsvParser& other) noexcept = delete;
71
78 CsvParser& operator=(CsvParser&& other) noexcept = delete;
79
87 bool OpenFile(const std::string& fileName) noexcept;
88
97 bool GetNextVector(std::vector<std::string>& vectorWithNext, const char& separator) noexcept;
98
100 ~CsvParser() noexcept = default;
101 };
102
104}
A class for parsing csv files that provides data in a form similar to generators.
Definition CsvParser.h:40
CsvParser(const CsvParser &other) noexcept=delete
Deleted copy constructor.
~CsvParser() noexcept=default
Default destructor.
CsvParser() noexcept
Default constructor.
Definition CsvParser.cpp:35
CsvParser(CsvParser &&other) noexcept=delete
Deleted move constructor.
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:42
CsvParser & operator=(const CsvParser &other) noexcept=delete
Deleted assignment operator.
CsvParser & operator=(CsvParser &&other) noexcept=delete
Deleted move assignment operator.
bool OpenFile(const std::string &fileName) noexcept
The method for opening the file.
Definition CsvParser.cpp:37
A class for reading files as a stream.
Definition StreamFileReader.h:28
std::string FormatStringToCsv(const std::string &str) noexcept
A function for converting a string to a csv field format.
Definition CsvParser.cpp:5