| 861 | |
| 862 | template <typename CharT,typename Allocator = std::allocator<CharT>> |
| 863 | std::basic_string<CharT, std::char_traits<CharT>, Allocator> to_basic_string(const basic_json_location<CharT,Allocator>& location, |
| 864 | const Allocator& alloc = Allocator()) |
| 865 | { |
| 866 | std::basic_string<CharT, std::char_traits<CharT>, Allocator> buffer(alloc); |
| 867 | |
| 868 | buffer.push_back('$'); |
| 869 | for (const auto& element : location) |
| 870 | { |
| 871 | if (element.has_name()) |
| 872 | { |
| 873 | buffer.push_back('['); |
| 874 | buffer.push_back('\''); |
| 875 | jsoncons::jsonpath::escape_string(element.name().data(), element.name().size(), buffer); |
| 876 | buffer.push_back('\''); |
| 877 | buffer.push_back(']'); |
| 878 | } |
| 879 | else |
| 880 | { |
| 881 | buffer.push_back('['); |
| 882 | jsoncons::from_integer(element.index(), buffer); |
| 883 | buffer.push_back(']'); |
| 884 | } |
| 885 | } |
| 886 | |
| 887 | return buffer; |
| 888 | } |
| 889 | |
| 890 | template <typename Json> |
| 891 | std::pair<Json*,bool> replace(Json& root, const basic_json_location<typename Json::char_type>& location, const Json& value, |
no test coverage detected