File: basic_path_node.md

package info (click to toggle)
jsoncons 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,584 kB
  • sloc: cpp: 136,382; sh: 33; makefile: 5
file content (77 lines) | stat: -rw-r--r-- 2,097 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
### jsoncons::jsonpath::basic_path_node

```cpp
#include <jsoncons_ext/jsonpath/jsonpath.hpp>

template <typename CharT>                           (since 0.172.0)
class basic_path_node
```

Two specializations for common character types are defined:

Type      |Definition
----------|------------------------------
path_node   |`basic_path_node<char>` 
wpath_node  |`basic_path_node<wchar_t>` 

Objects of type `basic_path_node` represent a normalized path as a
singly linked list where each node has a pointer to its (shared) parent
node.

#### Member types
Type        |Definition
------------|------------------------------
char_type   | `CharT`
string_view_type | `jsoncons::basic_string_view<char_type>`

#### Constructors

    basic_path_node();                                        (1)

    basic_path_node(const basic_path_node* parent, 
        const string_view_type& name);                        (2)

    basic_path_node(const basic_path_node* parent, 
        std::size_t index);                                   (3)

    basic_path_node(const basic_path_node&);                  (4)

(1) Constructs an empty `basic_path_node` with a null parent
representing the root of a path.

(2) Constructs a `basic_path_node` from a name.

(3) Constructs a `basic_path_node` from an index.

(4) Copy constructor

#### operator=

    basic_path_node& operator=(const basic_path_node&);

#### Accessors

    const basic_path_node* parent() const;
Returns the parent of a path node

    std::size_t size() const;
Returns the number of nodes in the path.

    path_node_kind node_kind() const;
Returns the kind of the node

    const string_view_type& name() const;

    std::size_t index() const;

#### Non-member functions

    template <typename CharT,typename Allocator = std::allocator<CharT>>
    std::basic_string<CharT, std::char_traits<CharT>, Allocator> to_basic_string(const basic_path_node<CharT>& location,
        const Allocator& alloc = Allocator())
Returns a normalized path

    std::string to_string(const path_node& path)

    std::wstring to_wstring(const wpath_node& path)