Lines Matching defs:value
48 return ToASCIIString("JSON: value expected");
63 return ToASCIIString("CBOR: unsupported value");
69 return ToASCIIString("CBOR: unexpected eof expected value");
105 // the major type of the encoded value.
170 // Extracts sizeof(T) bytes from |in| to extract a value of type T
186 // |value| is the payload (e.g. for MajorType::UNSIGNED) or is the size
189 size_t ReadTokenStart(span<uint8_t> bytes, MajorType* type, uint64_t* value) {
199 *value = additional_information;
203 // Values 24-255 are encoded with one initial byte, followed by the value.
206 *value = ReadBytesMostSignificantByteFirst<uint8_t>(bytes.subspan(1));
213 *value = ReadBytesMostSignificantByteFirst<uint16_t>(bytes.subspan(1));
220 *value = ReadBytesMostSignificantByteFirst<uint32_t>(bytes.subspan(1));
227 *value = ReadBytesMostSignificantByteFirst<uint64_t>(bytes.subspan(1));
233 // Writes the start of a token with |type|. The |value| may indicate the size,
234 // or it may be the payload if the value is an unsigned integer.
236 void WriteTokenStartTmpl(MajorType type, uint64_t value, C* encoded) {
237 if (value < 24) {
240 encoded->push_back(EncodeInitialByte(type, /*additional_info=*/value));
243 if (value <= std::numeric_limits<uint8_t>::max()) {
244 // Values 24-255 are encoded with one initial byte, followed by the value.
246 encoded->push_back(value);
249 if (value <= std::numeric_limits<uint16_t>::max()) {
252 WriteBytesMostSignificantByteFirst<uint16_t>(value, encoded);
255 if (value <= std::numeric_limits<uint32_t>::max()) {
258 WriteBytesMostSignificantByteFirst<uint32_t>(static_cast<uint32_t>(value),
264 WriteBytesMostSignificantByteFirst<uint64_t>(value, encoded);
267 uint64_t value,
269 WriteTokenStartTmpl(type, value, encoded);
271 void WriteTokenStart(MajorType type, uint64_t value, std::string* encoded) {
272 WriteTokenStartTmpl(type, value, encoded);
318 void EncodeInt32Tmpl(int32_t value, C* out) {
319 if (value >= 0) {
320 internals::WriteTokenStart(MajorType::UNSIGNED, value, out);
322 uint64_t representation = static_cast<uint64_t>(-(value + 1));
326 void EncodeInt32(int32_t value, std::vector<uint8_t>* out) {
327 EncodeInt32Tmpl(value, out);
329 void EncodeInt32(int32_t value, std::string* out) {
330 EncodeInt32Tmpl(value, out);
435 // (kInitialByteForDouble) plus the 64 bits of payload for its value.
444 void EncodeDoubleTmpl(double value, C* out) {
452 reinterpret.from_double = value;
455 void EncodeDouble(double value, std::vector<uint8_t>* out) {
456 EncodeDoubleTmpl(value, out);
458 void EncodeDouble(double value, std::string* out) {
459 EncodeDoubleTmpl(value, out);
580 void HandleDouble(double value) override {
583 EncodeDouble(value, out_);
586 void HandleInt32(int32_t value) override {
589 EncodeInt32(value, out_);
592 void HandleBool(bool value) override {
596 out_->push_back(value ? kEncodedTrue : kEncodedFalse);
713 // can avoid having to carry an error return value.
847 // value 0).
936 std::vector<uint16_t> value;
939 value.push_back((rep[ii + 1] << 8) | rep[ii]);
940 out->HandleString16(span<uint16_t>(value.data(), value.size()));
1030 // Parse value.
1069 // Parse value.
1173 // Prints |value| to |out| with 4 hex digits, most significant chunk first.
1175 void PrintHex(uint16_t value, C* out) {
1177 int four_bits = 0xf & (value >> (4 * ii));
1424 void HandleDouble(double value) override {
1430 if (!std::isfinite(value)) {
1434 std::unique_ptr<char[]> str_value = platform_->DToStr(value);
1451 void HandleInt32(int32_t value) override {
1455 Emit(std::to_string(value));
1458 void HandleBool(bool value) override {
1462 Emit(value ? "true" : "false");
1994 double value;
1995 if (!CharsToDouble(token_start, token_end - token_start, &value)) {
1999 if (value >= std::numeric_limits<int32_t>::min() &&
2000 value <= std::numeric_limits<int32_t>::max() &&
2001 static_cast<int32_t>(value) == value)
2002 handler_->HandleInt32(static_cast<int32_t>(value));
2004 handler_->HandleDouble(value);
2008 std::vector<uint16_t> value;
2009 bool ok = DecodeString(token_start + 1, token_end - 1, &value);
2014 handler_->HandleString16(span<uint16_t>(value.data(), value.size()));
2026 // After a list value, we expect a comma or the end of the list.
2037 // Unexpected value after list value. Bail out.
2076 // After a key/value pair, we expect a comma or the end of the
2087 // Unexpected value after last object value. Bail out.
2098 // We got a token that's not a value.