File: make_expression.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 (51 lines) | stat: -rw-r--r-- 1,544 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
### jsoncons::jmespath::make_expression

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

template <typename Json>
jmespath_expression<Json> make_expression(const json::string_view_type& expr);        (until 1.0.0)
                                                                                 (1)
template <typename Json>
jmespath_expression<Json> make_expression(const Json::string_view_type& expr,         (since 1.0.0)
    const custom_functions<Json>& funcs = custom_functions<Json>());

template <typename Json>
jmespath_expression<Json> make_expression(const json::string_view_type& expr,    (2)
    std::error_code& ec);                                                        

template <typename Json>
jmespath_expression<Json> make_expression(const Json::string_view_type& expr,    (3)   (since 1.0.0)  
    const custom_functions<Json>& funcs,
    std::error_code& ec)
```

Returns a compiled JMESPath expression for later evaluation.

#### Parameters

<table>
  <tr>
    <td>expr</td>
    <td>JMESPath expression</td> 
  </tr>
  <tr>
    <td>funcs</td>
    <td>Custom functions</td> 
  </tr>
  <tr>
    <td>ec</td>
    <td>out-parameter for reporting errors in the non-throwing overload</td> 
  </tr>
</table>

#### Return value

Returns a `jmespath_expression` object that represents the JMESPath expression.

#### Exceptions

(1) Throws a [jmespath_error](jmespath_error.md) if JMESPath compilation fails.

(2) Sets the out-parameter `ec` to the [jmespath_error_category](jmespath_errc.md) if JMESPath compilation fails.