tetengo 1.9.2
A multipurpose library set
Loading...
Searching...
No Matches
element.hpp
Go to the documentation of this file.
1
6
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
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
type_category_type
The type category type.
Definition element.hpp:40
@ primitive
A primitive.
Definition element.hpp:41
@ structure_close
A closing structure.
Definition element.hpp:43
@ structure_open
An opening structure.
Definition element.hpp:42
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
@ null
A null. primitive.
Definition element.hpp:32
@ boolean
A boolean. primitive.
Definition element.hpp:31
@ object
An object. structure.
Definition element.hpp:33
@ member
A member. structure.
Definition element.hpp:34
@ number
A number. primitive.
Definition element.hpp:30
@ string
A string. primitive.
Definition element.hpp:29
@ array
An array. structure.
Definition element.hpp:35
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