MCPcopy Create free account
hub / github.com/Illumina/hap.py / readValue

Method readValue

external/jsoncpp/jsoncpp.cpp:328–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328bool Reader::readValue() {
329 Token token;
330 skipCommentTokens(token);
331 bool successful = true;
332
333 if (collectComments_ && !commentsBefore_.empty()) {
334 // Remove newline characters at the end of the comments
335 size_t lastNonNewline = commentsBefore_.find_last_not_of("\r\n");
336 if (lastNonNewline != std::string::npos) {
337 commentsBefore_.erase(lastNonNewline + 1);
338 } else {
339 commentsBefore_.clear();
340 }
341
342 currentValue().setComment(commentsBefore_, commentBefore);
343 commentsBefore_ = "";
344 }
345
346 switch (token.type_) {
347 case tokenObjectBegin:
348 successful = readObject(token);
349 currentValue().setOffsetLimit(current_ - begin_);
350 break;
351 case tokenArrayBegin:
352 successful = readArray(token);
353 currentValue().setOffsetLimit(current_ - begin_);
354 break;
355 case tokenNumber:
356 successful = decodeNumber(token);
357 break;
358 case tokenString:
359 successful = decodeString(token);
360 break;
361 case tokenTrue:
362 currentValue() = true;
363 currentValue().setOffsetStart(token.start_ - begin_);
364 currentValue().setOffsetLimit(token.end_ - begin_);
365 break;
366 case tokenFalse:
367 currentValue() = false;
368 currentValue().setOffsetStart(token.start_ - begin_);
369 currentValue().setOffsetLimit(token.end_ - begin_);
370 break;
371 case tokenNull:
372 currentValue() = Value();
373 currentValue().setOffsetStart(token.start_ - begin_);
374 currentValue().setOffsetLimit(token.end_ - begin_);
375 break;
376 case tokenArraySeparator:
377 if (features_.allowDroppedNullPlaceholders_) {
378 // "Un-read" the current token and mark the current value as a null
379 // token.
380 current_--;
381 currentValue() = Value();
382 currentValue().setOffsetStart(current_ - begin_ - 1);
383 currentValue().setOffsetLimit(current_ - begin_);
384 break;
385 }

Callers

nothing calls this directly

Calls 6

emptyMethod · 0.80
clearMethod · 0.80
setCommentMethod · 0.80
setOffsetLimitMethod · 0.80
setOffsetStartMethod · 0.80
ValueClass · 0.50

Tested by

no test coverage detected