Skip to content

Commit 8b36d82

Browse files
committed
New
1 parent f98b38a commit 8b36d82

File tree

9 files changed

+261
-0
lines changed

9 files changed

+261
-0
lines changed

doc/ref/basic_value/get_array.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
### `tao::json::basic_value::get_array`
2+
3+
```c++
4+
array_t& get_array(); // (1)
5+
const array_t& get_array() const; // (2)
6+
array_t& unsafe_get_array(); // (3)
7+
const array_t& unsafe_get_array() const; // (4)
8+
```
9+
10+
Get a reference to the embedded vector of nested `basic_string` values, with (1)&(2) or without (3)&(4) checking the type first.
11+
12+
#### Preconditions
13+
14+
The instance must *not* be in a discarded state.
15+
16+
1. -
17+
2. -
18+
3. `type() == json::type::ARRAY`
19+
4. `type() == json::type::ARRAY`
20+
21+
#### Return value
22+
23+
A const or non-const reference to the embedded `std::vector<basic_value>`.
24+
25+
#### Exceptions
26+
27+
1. `std::logic_error` if `type() != json::type::ARRAY`
28+
2. `std::logic_error` if `type() != json::type::ARRAY`
29+
3. `noexcept`
30+
4. `noexcept`
31+
32+
#### Complexity
33+
34+
Constant

doc/ref/basic_value/get_boolean.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### `tao::json::basic_value::get_boolean`
2+
3+
```c++
4+
bool get_boolean() const; // (1)
5+
bool unsafe_get_boolean() const; // (2)
6+
```
7+
8+
Access the embedded boolean, with (1) or without (2) checking the type first.
9+
10+
#### Preconditions
11+
12+
The instance must *not* be in a discarded state.
13+
14+
1. -
15+
2. `type() == json::type::BOOLEAN`
16+
17+
#### Return value
18+
19+
Returns the value of the embedded `bool`.
20+
21+
#### Exceptions
22+
23+
1. `std::logic_error` if `type() != json::type::BOOLEAN`
24+
2. `noexcept`
25+
26+
#### Complexity
27+
28+
Constant

doc/ref/basic_value/get_double.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### `tao::json::basic_value::get_double`
2+
3+
```c++
4+
double get_double() const; // (1)
5+
double unsafe_get_double() const; // (2)
6+
```
7+
8+
Access the embedded floating point value, with (1) or without (2) checking the type first.
9+
10+
#### Preconditions
11+
12+
The instance must *not* be in a discarded state.
13+
14+
1. -
15+
2. `type() == json::type::DOUBLE`
16+
17+
#### Return value
18+
19+
Returns the value of the embedded `double`.
20+
21+
#### Exceptions
22+
23+
1. `std::logic_error` if `type() != json::type::DOUBLE`
24+
2. `noexcept`
25+
26+
#### Complexity
27+
28+
Constant

doc/ref/basic_value/get_object.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
### `tao::json::basic_value::get_object`
2+
3+
```c++
4+
object_t& get_object(); // (1)
5+
const object_t& get_object() const; // (2)
6+
object_t& unsafe_get_object(); // (3)
7+
const object_t& unsafe_get_object() const; // (4)
8+
```
9+
10+
Get a reference to the embedded map of nested `basic_string` values, with (1)&(2) or without (3)&(4) checking the type first.
11+
12+
#### Preconditions
13+
14+
The instance must *not* be in a discarded state.
15+
16+
1. -
17+
2. -
18+
3. `type() == json::type::OBJECT`
19+
4. `type() == json::type::OBJECT`
20+
21+
#### Return value
22+
23+
A const or non-const reference to the embedded `std::vector<basic_value>`.
24+
25+
#### Exceptions
26+
27+
1. `std::logic_error` if `type() != json::type::OBJECT`
28+
2. `std::logic_error` if `type() != json::type::OBJECT`
29+
3. `noexcept`
30+
4. `noexcept`
31+
32+
#### Complexity
33+
34+
Constant

doc/ref/basic_value/get_raw_ptr.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
### `tao::json::basic_value::get_raw_ptr`
2+
3+
```c++
4+
const basic_value* get_raw_ptr() const; // (1)
5+
const basic_value* unsafe_get_raw_ptr() const; // (2)
6+
```
7+
8+
Access the embedded raw pointer, with (1) or without (2) checking the type first.
9+
10+
#### Preconditions
11+
12+
The instance must *not* be in a discarded state.
13+
14+
1. -
15+
2. `type() == json::type::RAW_PTR`
16+
17+
#### Return value
18+
19+
Returns the value of the embedded `const basic_value*`.
20+
21+
#### Exceptions
22+
23+
1. `std::logic_error` if `type() != json::type::RAW_PTR`
24+
2. `noexcept`
25+
26+
#### Complexity
27+
28+
Constant
29+
30+
#### Note
31+
32+
The pointer itself can be the null pointer.

doc/ref/basic_value/get_signed.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### `tao::json::basic_value::get_signed`
2+
3+
```c++
4+
std::int64_t get_signed() const; // (1)
5+
std::int64_t unsafe_get_signed() const; // (2)
6+
```
7+
8+
Access the embedded integer, with (1) or without (2) checking the type first.
9+
10+
#### Preconditions
11+
12+
The instance must *not* be in a discarded state.
13+
14+
1. -
15+
2. `type() == json::type::SIGNED`
16+
17+
#### Return value
18+
19+
Returns the value of the embedded `std::int64_t`.
20+
21+
#### Exceptions
22+
23+
1. `std::logic_error` if `type() != json::type::SIGNED`
24+
2. `noexcept`
25+
26+
#### Complexity
27+
28+
Constant

doc/ref/basic_value/get_string.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
### `tao::json::basic_value::get_string`
2+
3+
```c++
4+
std::string& get_string(); // (1)
5+
const std::string& get_string() const; // (2)
6+
std::string& unsafe_get_string(); // (3)
7+
const std::string& unsafe_get_string() const; // (4)
8+
```
9+
10+
Get a reference to the embedded string, with (1)&(2) or without (3)&(4) checking the type first.
11+
12+
#### Preconditions
13+
14+
The instance must *not* be in a discarded state.
15+
16+
1. -
17+
2. -
18+
3. `type() == json::type::STRING`
19+
4. `type() == json::type::STRING`
20+
21+
#### Return value
22+
23+
A const or non-const reference to the embedded `std::string`.
24+
25+
#### Exceptions
26+
27+
1. `std::logic_error` if `type() != json::type::STRING`
28+
2. `std::logic_error` if `type() != json::type::STRING`
29+
3. `noexcept`
30+
4. `noexcept`
31+
32+
#### Complexity
33+
34+
Constant
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### `tao::json::basic_value::get_unsigned`
2+
3+
```c++
4+
std::uint64_t get_unsigned() const; // (1)
5+
std::uint64_t unsafe_get_unsigned() const; // (2)
6+
```
7+
8+
Access the embedded integer, with (1) or without (2) checking the type first.
9+
10+
#### Preconditions
11+
12+
The instance must *not* be in a discarded state.
13+
14+
1. -
15+
2. `type() == json::type::UNSIGNED`
16+
17+
#### Return value
18+
19+
Returns the value of the embedded `std::uint64_t`.
20+
21+
#### Exceptions
22+
23+
1. `std::logic_error` if `type() != json::type::UNSIGNED`
24+
2. `noexcept`
25+
26+
#### Complexity
27+
28+
Constant

doc/ref/basic_value/reset.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### `tao::json::basic_value::reset`
2+
3+
```c++
4+
void reset() const; // (1)
5+
```
6+
7+
Resets the instance. The destructors of the nested values (if any) are called and the used storage is deallocated. Note, that if the values are pointers (`type::RAW_PTR`), the pointed-to objects are not destroyed. The instance is then set into an uninitialized state.
8+
9+
#### Exceptions
10+
11+
1. `noexcept`
12+
13+
#### Complexity
14+
15+
1. Linear to the number of nodes destructed

0 commit comments

Comments
 (0)