Csv.hpp
Go to the documentation of this file.
1 #ifndef _QUORI_CONTROLLER_CSV_HPP_
2 #define _QUORI_CONTROLLER_CSV_HPP_
3 
4 #include <string>
5 #include <vector>
6 #include <iostream>
7 #include <memory>
8 #include <mutex>
9 
11 {
12  class Csv
13  {
14  public:
15  typedef std::shared_ptr<Csv> Ptr;
16  typedef std::shared_ptr<const Csv> ConstPtr;
17 
18  struct Row
19  {
20  public:
21  Row(Csv &csv);
22  ~Row();
23 
24  Row &operator << (const std::string &value);
25  Row &operator << (const char *const value);
26 
27  template<typename T>
28  Row &operator << (const T &value)
29  {
30  return *this << std::to_string(value);
31  }
32 
33  private:
35  std::vector<std::string> elements_;
36  };
37 
38  friend struct Row;
39 
40  Csv(std::ostream &out);
41  ~Csv();
42 
43  static Ptr open(std::ostream &out);
44 
45  Row append();
46 
47  private:
48  void appendRow(const std::vector<std::string> &elements);
49 
50  std::ostream &out_;
51  std::mutex mut_;
52  };
53 }
54 
55 #endif
quori_controller::Csv::Row::operator<<
Row & operator<<(const std::string &value)
Definition: Csv.cpp:15
quori_controller::Csv::Row::elements_
std::vector< std::string > elements_
Definition: Csv.hpp:35
quori_controller::Csv::Row::~Row
~Row()
Definition: Csv.cpp:10
quori_controller::Csv::appendRow
void appendRow(const std::vector< std::string > &elements)
Definition: Csv.cpp:48
quori_controller::Csv::out_
std::ostream & out_
Definition: Csv.hpp:50
quori_controller::Csv::append
Row append()
Definition: Csv.cpp:43
quori_controller::Csv::ConstPtr
std::shared_ptr< const Csv > ConstPtr
Definition: Csv.hpp:16
quori_controller::Csv::mut_
std::mutex mut_
Definition: Csv.hpp:51
quori_controller
Definition: Csv.hpp:10
quori_controller::Csv::Row::csv_
Csv & csv_
Definition: Csv.hpp:34
quori_controller::Csv::Ptr
std::shared_ptr< Csv > Ptr
Definition: Csv.hpp:15
quori_controller::Csv::Row
Definition: Csv.hpp:18
quori_controller::Csv::open
static Ptr open(std::ostream &out)
Definition: Csv.cpp:38
quori_controller::Csv::Csv
Csv(std::ostream &out)
Definition: Csv.cpp:27
quori_controller::Csv::~Csv
~Csv()
Definition: Csv.cpp:32
quori_controller::Csv
Definition: Csv.hpp:12
quori_controller::Csv::Row::Row
Row(Csv &csv)
Definition: Csv.cpp:5


quori_controller
Author(s):
autogenerated on Wed Mar 2 2022 00:53:16