|
JSON Voorhees
Killer JSON for C++
|
#include <jsonv/config.hpp>#include <jsonv/detail/generic_container.hpp>#include <string_view>#include <iosfwd>#include <memory>#include <string>#include <vector>
Include dependency graph for path.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| class | jsonv::path_element |
| class | jsonv::path |
| Represents an exact path in some JSON structure. More... | |
Enumerations | |
| enum class | path_element_kind : unsigned char { array_index , object_key } |
Functions | |
| JSONV_PUBLIC std::ostream & | jsonv::operator<< (std::ostream &, const path_element_kind &) |
| JSONV_PUBLIC std::string | jsonv::to_string (const path_element_kind &) |
| JSONV_PUBLIC std::ostream & | jsonv::operator<< (std::ostream &, const path_element &) |
| JSONV_PUBLIC std::string | jsonv::to_string (const path_element &) |
| JSONV_PUBLIC std::ostream & | jsonv::operator<< (std::ostream &, const path &val) |
Write val in the syntax path::create reads. | |
| JSONV_PUBLIC std::string | jsonv::to_string (const path &val) |
Write val in the syntax path::create reads. | |
Support for JSONPath.
Copyright (c) 2014-2020 by Travis Gockel. All rights reserved.
This program is free software: you can redistribute it and/or modify it under the terms of the Apache License as published by the Apache Software Foundation, either version 2 of the License, or (at your option) any later version.
Definition in file path.hpp.
| JSONV_PUBLIC std::ostream & jsonv::operator<< | ( | std::ostream & | , |
| const path & | val | ||
| ) |
Write val in the syntax path::create reads.
An object key which is an identifier (matching [a-zA-Z_$][a-zA-Z0-9_$]*) is written as .key and any other key as a JSON string in brackets, like ["a b"]. Well-formed UTF-8 in a key is written as it is. An array index is written as [N] whatever the stream's locale, and the empty path as ..
So path::create(to_string(p)) == p for every path whose keys are well-formed UTF-8. A key which is not has each ill-formed byte written as a \u00NN escape, and that reads back as the codepoint U+00NN rather than the byte.
| JSONV_PUBLIC std::string jsonv::to_string | ( | const path & | val | ) |
Write val in the syntax path::create reads.
An object key which is an identifier (matching [a-zA-Z_$][a-zA-Z0-9_$]*) is written as .key and any other key as a JSON string in brackets, like ["a b"]. Well-formed UTF-8 in a key is written as it is. An array index is written as [N] whatever the stream's locale, and the empty path as ..
So path::create(to_string(p)) == p for every path whose keys are well-formed UTF-8. A key which is not has each ill-formed byte written as a \u00NN escape, and that reads back as the codepoint U+00NN rather than the byte.