sysrepo  2.1.42
YANG-based system repository for all-around configuration management.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
xpath.h
Go to the documentation of this file.
1 
17 #ifndef SYSREPO_XPATH_H_
18 #define SYSREPO_XPATH_H_
19 
20 #include "../sysrepo.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
45 typedef struct sr_xpath_ctx_s {
46  char *begining;
47  char *current_node;
51 
68 char *sr_xpath_next_node(char *xpath, sr_xpath_ctx_t *state);
69 
76 char *sr_xpath_last_node(char *xpath, sr_xpath_ctx_t *state);
77 
85 char *sr_xpath_next_node_with_ns(char *xpath, sr_xpath_ctx_t *state);
86 
94 char *sr_xpath_next_key_name(char *xpath, sr_xpath_ctx_t *state);
95 
103 char *sr_xpath_next_key_value(char *xpath, sr_xpath_ctx_t *state);
104 
114 char *sr_xpath_node(char *xpath, const char *node_name, sr_xpath_ctx_t *state);
115 
125 char *sr_xpath_node_rel(char *xpath, const char *node_name, sr_xpath_ctx_t *state);
126 
136 char *sr_xpath_node_idx(char *xpath, size_t index, sr_xpath_ctx_t *state);
137 
146 char *sr_xpath_node_idx_rel(char *xpath, size_t index, sr_xpath_ctx_t *state);
147 
156 char *sr_xpath_node_key_value(char *xpath, const char *key, sr_xpath_ctx_t *state);
157 
167 char *sr_xpath_node_key_value_idx(char *xpath, size_t index, sr_xpath_ctx_t *state);
168 
178 char *sr_xpath_key_value(char *xpath, const char *node_name, const char *key_name, sr_xpath_ctx_t *state);
179 
189 char *sr_xpath_key_value_idx(char *xpath, size_t node_index, size_t key_index, sr_xpath_ctx_t *state);
190 
200 char *sr_xpath_node_name(const char *xpath);
201 
212 int sr_xpath_node_name_eq(const char *xpath, const char *node_str);
213 
220 void sr_xpath_recover(sr_xpath_ctx_t *state);
221 
224 #ifdef __cplusplus
225 }
226 #endif
227 
228 #endif /* SYSREPO_XPATH_H_ */
char * sr_xpath_node_name(const char *xpath)
Returns pointer to the string after the last slash in xpath (node name).
char * sr_xpath_next_key_name(char *xpath, sr_xpath_ctx_t *state)
Returns the name of the next key at the current level in processed xpath.
char * sr_xpath_node(char *xpath, const char *node_name, sr_xpath_ctx_t *state)
Returns a pointer to the node specified by name. It searches from the beginning of the xpath...
struct sr_xpath_ctx_s sr_xpath_ctx_t
State of xpath parsing. User must not modify nor rely on the content of the structure.
char * sr_xpath_key_value(char *xpath, const char *node_name, const char *key_name, sr_xpath_ctx_t *state)
Looks up the value of the key in a node specified by name.
char replaced_char
Definition: xpath.h:49
char * replaced_position
Definition: xpath.h:48
char * sr_xpath_node_rel(char *xpath, const char *node_name, sr_xpath_ctx_t *state)
Similar to sr_xpath_node. The difference is that search start at current node according to the state...
State of xpath parsing. User must not modify nor rely on the content of the structure.
Definition: xpath.h:45
char * sr_xpath_node_key_value(char *xpath, const char *key, sr_xpath_ctx_t *state)
Looks up the value for the key at the current level in xpath.
char * current_node
Definition: xpath.h:47
char * sr_xpath_key_value_idx(char *xpath, size_t node_index, size_t key_index, sr_xpath_ctx_t *state)
Looks up the value of the key in a node specified by index. First node has index zero.
char * sr_xpath_next_node_with_ns(char *xpath, sr_xpath_ctx_t *state)
Same as sr_xpath_next_node with the difference that namespace is included in result if present in xpa...
char * begining
Definition: xpath.h:46
char * sr_xpath_node_key_value_idx(char *xpath, size_t index, sr_xpath_ctx_t *state)
Looks up the value for the key at the current level in xpath specified by index. First key has index ...
char * sr_xpath_last_node(char *xpath, sr_xpath_ctx_t *state)
Returns pointer to the last node.
char * sr_xpath_next_node(char *xpath, sr_xpath_ctx_t *state)
The function returns a pointer to the following node. If xpath is not NULL returns the first node nam...
char * sr_xpath_node_idx(char *xpath, size_t index, sr_xpath_ctx_t *state)
Returns node specified by index starting at the begin of expression. First node has index 0...
char * sr_xpath_node_idx_rel(char *xpath, size_t index, sr_xpath_ctx_t *state)
Return node specified by index. Following node has index zero.
char * sr_xpath_next_key_value(char *xpath, sr_xpath_ctx_t *state)
Returns the value of the next key at the current level in processed xpath.
int sr_xpath_node_name_eq(const char *xpath, const char *node_str)
Compares string after the last slash in xpath (node name) with provided string.
void sr_xpath_recover(sr_xpath_ctx_t *state)
Recovers the xpath string to the original state (puts back the character that was replaced by termina...