tetengo 1.8.2
A multipurpose library set
Loading...
Searching...
No Matches
element.hpp
Go to the documentation of this file.
1
7#if !defined(TETENGO_JSON_ELEMENT_HPP)
8#define TETENGO_JSON_ELEMENT_HPP
9
10#include <string>
11#include <unordered_map>
12
14
15
16namespace tetengo::json
17{
21 class element
22 {
23 public:
24 // types
25
27 enum class type_name_type
28 {
29 string,
30 number,
31 boolean,
32 null,
33 object,
34 member,
35 array,
36 };
37
45
55
56
57 // constructors and destructor
58
71 std::string value,
72 std::unordered_map<std::string, std::string> attributes,
73 file_location file_location_);
74
75
76 // functions
77
83 [[nodiscard]] const type_type& type() const;
84
90 [[nodiscard]] const std::string& value() const;
91
97 [[nodiscard]] const std::unordered_map<std::string, std::string>& attributes() const;
98
104 [[nodiscard]] const file_location& get_file_location() const;
105
106
107 private:
108 // variables
109
110 type_type m_type;
111
112 std::string m_value;
113
114 std::unordered_map<std::string, std::string> m_attributes;
115
116 file_location m_file_location;
117 };
118
119
120}
121
122
123#endif
An element.
Definition element.hpp:22
type_category_type
The type category type.
Definition element.hpp:40
const std::unordered_map< std::string, std::string > & attributes() const
Returns the attributes.
const file_location & get_file_location() const
Returns the file location.
type_name_type
The type name type.
Definition element.hpp:28
const type_type & type() const
Returns the type.
const std::string & value() const
Returns the value.
element(type_type type, std::string value, std::unordered_map< std::string, std::string > attributes, file_location file_location_)
Creates an element.
A file location.
Definition file_location.hpp:22
A file location.
A JSON library.
The type type.
Definition element.hpp:48
type_name_type name
A name.
Definition element.hpp:50
type_category_type category
A category.
Definition element.hpp:53