MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / next_byte_in_range

Method next_byte_in_range

Source/external/json.hpp:7518–7538  ·  view source on GitHub ↗

! @brief check if the next byte(s) are inside a given range Adds the current byte and, for each passed range, reads a new byte and checks if it is inside the range. If a violation was detected, set up an error message and return false. Otherwise, return true. @param[in] ranges list of integers; interpreted as list of pairs of inclusive lower and upper bound, respectively @pre The

Source from the content-addressed store, hash-verified

7516 @return true if and only if no range violation was detected
7517 */
7518 bool next_byte_in_range(std::initializer_list<char_int_type> ranges)
7519 {
7520 JSON_ASSERT(ranges.size() == 2 || ranges.size() == 4 || ranges.size() == 6);
7521 add(current);
7522
7523 for (auto range = ranges.begin(); range != ranges.end(); ++range)
7524 {
7525 get();
7526 if (JSON_HEDLEY_LIKELY(*range <= current && current <= *(++range)))
7527 {
7528 add(current);
7529 }
7530 else
7531 {
7532 error_message = "invalid string: ill-formed UTF-8 byte";
7533 return false;
7534 }
7535 }
7536
7537 return true;
7538 }
7539
7540 /*!
7541 @brief scan a string literal

Callers

nothing calls this directly

Calls 5

addFunction · 0.85
getFunction · 0.85
sizeMethod · 0.80
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected