! @brief Parses a C-style string from the BSON input. @param[in, out] result A reference to the string variable where the read string is to be stored. @return `true` if the \x00-byte indicating the end of the string was encountered before the EOF; false` indicates an unexpected EOF. */
| 7816 | encountered before the EOF; false` indicates an unexpected EOF. |
| 7817 | */ |
| 7818 | bool get_bson_cstr(string_t& result) |
| 7819 | { |
| 7820 | auto out = std::back_inserter(result); |
| 7821 | while (true) |
| 7822 | { |
| 7823 | get(); |
| 7824 | if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::bson, "cstring"))) |
| 7825 | { |
| 7826 | return false; |
| 7827 | } |
| 7828 | if (current == 0x00) |
| 7829 | { |
| 7830 | return true; |
| 7831 | } |
| 7832 | *out++ = static_cast<typename string_t::value_type>(current); |
| 7833 | } |
| 7834 | } |
| 7835 | |
| 7836 | /*! |
| 7837 | @brief Parses a zero-terminated string of length @a len from the BSON |