Ariles
Loading...
Searching...
No Matches
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
13namespace ariles2
14{
15 namespace ns_rapidjson
16 {
17 namespace impl
18 {
19 class Reader;
20 }
21
22
23 /**
24 * @brief Configuration reader class
25 */
26 class Reader : public serialization::PIMPLVisitor<read::Visitor, impl::Reader>
27 {
28 protected:
29 // needed for jsonnet Reader
31 {
32 }
33 void constructFromString(const char *);
34
35
36 public:
37 /**
38 * @brief Constructor
39 *
40 * @param[in] file_name
41 */
42 explicit Reader(const std::string &file_name);
43
44
45 /**
46 * @brief Constructor
47 *
48 * @param[in] input_stream
49 */
50 explicit Reader(std::istream &input_stream);
51
52
53 void startMap(
55 const std::size_t min = 0,
56 const std::size_t max = 0);
57 bool startMapEntry(const std::string &child_name);
58 void endMapEntry();
59
60
62 const SizeLimitEnforcementType /*limit_type*/ = SIZE_LIMIT_NONE,
63 const std::size_t /*min*/ = 0,
64 const std::size_t /*max*/ = 0);
65 bool startIteratedMapElement(std::string &entry_name);
67 void endIteratedMap();
68
69
70 std::size_t startArray();
71 void startArrayElement();
72 void endArrayElement();
73 void endArray();
74
75
76#define ARILES2_BASIC_TYPE(type) void readElement(type &element);
77
79
80#undef ARILES2_BASIC_TYPE
81 };
82 } // namespace ns_rapidjson
83} // namespace ariles2
Configuration reader class.
Definition reader.h:27
bool startIteratedMapElement(std::string &entry_name)
Definition reader.cpp:117
void endMapEntry()
endMapEntry from the current entry to its parent.
Definition reader.cpp:92
bool startIteratedMap(const SizeLimitEnforcementType=SIZE_LIMIT_NONE, const std::size_t=0, const std::size_t=0)
Definition reader.cpp:98
void startMap(const SizeLimitEnforcementType limit_type=SIZE_LIMIT_NONE, const std::size_t min=0, const std::size_t max=0)
Definition reader.cpp:74
bool startMapEntry(const std::string &child_name)
startMapEntry to the entry with the given name
Definition reader.cpp:80
void constructFromString(const char *)
Definition reader.cpp:67
#define ARILES2_BASIC_TYPES_LIST
Definition helpers.h:72
#define CPPUT_MACRO_SUBSTITUTE(macro)
Definition misc.h:21