MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / get_token_string

Function get_token_string

Source/Utils/json.hpp:7319–7340  ·  view source on GitHub ↗

return the last read token (for errors only). Will never contain EOF (an arbitrary value that is not a valid char value, often -1), because 255 may legitimately occur. May contain NUL, which should be escaped.

Source from the content-addressed store, hash-verified

7317 /// (an arbitrary value that is not a valid char value, often -1), because
7318 /// 255 may legitimately occur. May contain NUL, which should be escaped.
7319 std::string get_token_string() const
7320 {
7321 // escape control characters
7322 std::string result;
7323 for (const auto c : token_string)
7324 {
7325 if (static_cast<unsigned char>(c) <= '\x1F')
7326 {
7327 // escape control characters
7328 std::array<char, 9> cs{ {} };
7329 (std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c));
7330 result += cs.data();
7331 }
7332 else
7333 {
7334 // add character as is
7335 result.push_back(static_cast<std::string::value_type>(c));
7336 }
7337 }
7338
7339 return result;
7340 }
7341
7342 /// return syntax error message
7343 JSON_HEDLEY_RETURNS_NON_NULL

Callers 12

binary_readerClass · 0.85
get_bson_stringMethod · 0.85
get_bson_binaryMethod · 0.85
parse_cbor_internalMethod · 0.85
get_cbor_stringMethod · 0.85
get_cbor_binaryMethod · 0.85
get_msgpack_stringMethod · 0.85
get_ubjson_stringMethod · 0.85
get_ubjson_size_valueMethod · 0.85
get_ubjson_size_typeMethod · 0.85
get_ubjson_valueMethod · 0.85

Calls 2

sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected