Ariles
reader.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2018 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 #pragma once
12 
13 
14 namespace ariles2
15 {
16  namespace ns_pugixml
17  {
18  namespace impl
19  {
20  class Reader;
21  }
22 
23 
24  /**
25  * @brief Configuration reader class
26  */
27  class Reader : public serialization::PIMPLVisitor<read::Visitor, impl::Reader>
28  {
29  protected:
30  bool startRoot(const std::string &name);
31  void endRoot(const std::string &name);
32 
33  public:
34  /**
35  * @brief Constructor
36  *
37  * @param[in] file_name
38  */
39  explicit Reader(const std::string &file_name);
40 
41 
42  /**
43  * @brief Constructor
44  *
45  * @param[in] input_stream
46  */
47  explicit Reader(std::istream &input_stream);
48 
49 
50  bool startMapEntry(const std::string &child_name);
51  void endMapEntry();
52 
53 
54  std::size_t startArray();
55  void startArrayElement();
56  void endArrayElement();
57  void endArray();
58 
59 
60  bool startIteratedMap(
61  const SizeLimitEnforcementType /*limit_type*/ = SIZE_LIMIT_NONE,
62  const std::size_t /*min*/ = 0,
63  const std::size_t /*max*/ = 0);
64  void endIteratedMapElement();
65  bool startIteratedMapElement(std::string &entry_name);
66  void endIteratedMap();
67 
68 
69 #define ARILES2_BASIC_TYPE(type) void readElement(type &element);
70 
72 
73 #undef ARILES2_BASIC_TYPE
74  };
75  } // namespace ns_pugixml
76 } // namespace ariles2
Configuration reader class.
Definition: reader.h:28
void endRoot(const std::string &name)
Definition: reader.cpp:196
bool startIteratedMap(const SizeLimitEnforcementType=SIZE_LIMIT_NONE, const std::size_t=0, const std::size_t=0)
Definition: reader.cpp:95
bool startRoot(const std::string &name)
Definition: reader.cpp:186
Reader(const std::string &file_name)
Constructor.
Definition: reader.cpp:46
bool startMapEntry(const std::string &child_name)
startMapEntry to the entry with the given name
Definition: reader.cpp:66
bool startIteratedMapElement(std::string &entry_name)
Definition: reader.cpp:109
std::size_t startArray()
Definition: reader.cpp:135
void endMapEntry()
endMapEntry from the current entry to its parent.
Definition: reader.cpp:89
#define ARILES2_BASIC_TYPES_LIST
Definition: helpers.h:72
#define CPPUT_MACRO_SUBSTITUTE(macro)
Definition: misc.h:21
Definition: basic.h:17