MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / get_token_string

Function get_token_string

dependencies/json/json.hpp:7387–7408  ·  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

7385 /// (an arbitrary value that is not a valid char value, often -1), because
7386 /// 255 may legitimately occur. May contain NUL, which should be escaped.
7387 std::string get_token_string() const
7388 {
7389 // escape control characters
7390 std::string result;
7391 for (const auto c : token_string)
7392 {
7393 if (static_cast<unsigned char>(c) <= '\x1F')
7394 {
7395 // escape control characters
7396 std::array<char, 9> cs{{}};
7397 (std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c));
7398 result += cs.data();
7399 }
7400 else
7401 {
7402 // add character as is
7403 result.push_back(static_cast<std::string::value_type>(c));
7404 }
7405 }
7406
7407 return result;
7408 }
7409
7410 /// return syntax error message
7411 JSON_HEDLEY_RETURNS_NON_NULL

Callers 12

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

Calls 3

dataMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected