Ariles
reader.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2018-2020 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 namespace ariles
14 {
15  namespace ns_rapidjson
16  {
17  namespace impl
18  {
20  }
21 
22 
23  /**
24  * @brief Configuration reader class
25  */
26  class ARILES_VISIBILITY_ATTRIBUTE Reader : public ns_rapidjson::Base<ariles::read::Visitor, impl::Reader>
27  {
28  protected:
29  std::size_t getMapSize(const bool /*expect_empty*/);
30 
31  // needed for jsonnet Reader
32  Reader(const Flags &flags = Flags::DEFAULT) : Base(flags)
33  {
34  }
35  void constructFromString(const char *);
36 
37 
38 
39  public:
40  /**
41  * @brief Constructor
42  *
43  * @param[in] file_name
44  */
45  explicit Reader(const std::string &file_name, const Flags &flags = Flags::DEFAULT);
46 
47 
48  /**
49  * @brief Constructor
50  *
51  * @param[in] input_stream
52  */
53  explicit Reader(std::istream &input_stream, const Flags &flags = Flags::DEFAULT);
54 
55 
56 
57  bool descend(const std::string &child_name);
58  void ascend();
59 
60 
61  bool getMapEntryNames(std::vector<std::string> &child_names);
62 
63 
64  std::size_t startArray();
65  void shiftArray();
66  void endArray();
67 
68 
69 #define ARILES_BASIC_TYPE(type) void readElement(type &element);
70 
72 
73 #undef ARILES_BASIC_TYPE
74  };
75  } // namespace ns_rapidjson
76 } // namespace ariles
#define ARILES_BASIC_TYPES_LIST
Definition: helpers.h:105
Reader(const Flags &flags=Flags::DEFAULT)
Definition: reader.h:32
Configuration reader class.
Definition: reader.h:26
class ARILES_VISIBILITY_ATTRIBUTE Reader
Definition: reader.h:23
ARILES_MACRO_SUBSTITUTE(ARILES_BASIC_NUMERIC_TYPES_LIST) void Writer
Definition: writer.cpp:224
#define ARILES_VISIBILITY_ATTRIBUTE
Definition: helpers.h:69
Definition: basic.h:17