Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
dart::JSONObject Class Reference

#include <json_stream.h>

Inheritance diagram for dart::JSONObject:
dart::ValueObject

Public Member Functions

 JSONObject (JSONStream *stream)
 
 JSONObject (const JSONObject *obj, const char *name)
 
 JSONObject (const JSONArray *arr)
 
 ~JSONObject ()
 
void AddServiceId (const Object &o) const
 
void AddFixedServiceId (const char *format,...) const PRINTF_ATTRIBUTE(2
 
void void AddServiceId (const char *format,...) const PRINTF_ATTRIBUTE(2
 
void void void AddLocation (const Script &script, TokenPosition token_pos, TokenPosition end_token_pos=TokenPosition::kNoSource) const
 
void AddLocation (const BreakpointLocation *bpt_loc) const
 
void AddLocationLine (const Script &script, intptr_t line) const
 
void AddUnresolvedLocation (const BreakpointLocation *bpt_loc) const
 
void AddProperty (const char *name, bool b) const
 
void AddProperty (const char *name, intptr_t i) const
 
void AddProperty64 (const char *name, int64_t i) const
 
void AddPropertyTimeMillis (const char *name, int64_t millis) const
 
void AddPropertyTimeMicros (const char *name, int64_t micros) const
 
void AddProperty (const char *name, double d) const
 
void AddPropertyBase64 (const char *name, const uint8_t *bytes, intptr_t length) const
 
void AddProperty (const char *name, const char *s) const
 
bool AddPropertyStr (const char *name, const String &s, intptr_t offset=0, intptr_t count=-1) const
 
void AddPropertyNoEscape (const char *name, const char *s) const
 
void AddProperty (const char *name, const Object &obj, bool ref=true) const
 
void AddProperty (const char *name, const ServiceEvent *event) const
 
void AddProperty (const char *name, Breakpoint *bpt) const
 
void AddProperty (const char *name, TokenPosition tp) const
 
void AddProperty (const char *name, Metric *metric) const
 
void AddProperty (const char *name, MessageQueue *queue) const
 
void AddProperty (const char *name, Isolate *isolate) const
 
void AddProperty (const char *name, IsolateGroup *isolate_group) const
 
void AddProperty (const char *name, Zone *zone) const
 
void AddProperty (const char *name, const TimelineEvent *timeline_event) const
 
void AddProperty (const char *name, const TimelineEventBlock *timeline_event_block) const
 
void AddPropertyVM (const char *name, bool ref=true) const
 
void AddPropertyF (const char *name, const char *format,...) const PRINTF_ATTRIBUTE(3
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Friends

class JSONArray
 

Detailed Description

Definition at line 368 of file json_stream.h.

Constructor & Destructor Documentation

◆ JSONObject() [1/3]

dart::JSONObject::JSONObject ( JSONStream stream)
inlineexplicit

Definition at line 370 of file json_stream.h.

370 : stream_(stream) {
371 stream_->OpenObject();
372 }

◆ JSONObject() [2/3]

dart::JSONObject::JSONObject ( const JSONObject obj,
const char *  name 
)
inline

Definition at line 373 of file json_stream.h.

373 : stream_(obj->stream_) {
374 stream_->OpenObject(name);
375 }
const char *const name

◆ JSONObject() [3/3]

dart::JSONObject::JSONObject ( const JSONArray arr)
explicit

Definition at line 499 of file json_stream.cc.

499 : stream_(arr->stream_) {
500 stream_->OpenObject();
501}

◆ ~JSONObject()

dart::JSONObject::~JSONObject ( )
inline

Definition at line 378 of file json_stream.h.

378{ stream_->CloseObject(); }

Member Function Documentation

◆ AddFixedServiceId()

void dart::JSONObject::AddFixedServiceId ( const char *  format,
  ... 
) const

Definition at line 503 of file json_stream.cc.

503 {
504 // Mark that this id is fixed.
505 AddProperty("fixedId", true);
506 // Add the id property.
507 va_list args;
509 stream_->VPrintfProperty("id", format, args);
510 va_end(args);
511}
void AddProperty(const char *name, bool b) const
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
va_start(args, format)
va_end(args)

◆ AddLocation() [1/2]

void dart::JSONObject::AddLocation ( const BreakpointLocation bpt_loc) const

Definition at line 540 of file json_stream.cc.

540 {
541 ASSERT(bpt_loc->IsResolved());
542
543 Zone* zone = Thread::Current()->zone();
544 Script& script = Script::Handle(zone);
545 TokenPosition token_pos = TokenPosition::kNoSource;
546 bpt_loc->GetCodeLocation(&script, &token_pos);
547 AddLocation(script, token_pos);
548}
void void void AddLocation(const Script &script, TokenPosition token_pos, TokenPosition end_token_pos=TokenPosition::kNoSource) const
static Object & Handle()
Definition object.h:407
Zone * zone() const
static Thread * Current()
Definition thread.h:361
#define ASSERT(E)

◆ AddLocation() [2/2]

void dart::JSONObject::AddLocation ( const Script script,
TokenPosition  token_pos,
TokenPosition  end_token_pos = TokenPosition::kNoSource 
) const

Definition at line 521 of file json_stream.cc.

523 {
524 JSONObject location(this, "location");
525 location.AddProperty("type", "SourceLocation");
526 location.AddProperty("script", script);
527 location.AddProperty("tokenPos", token_pos);
528 if (end_token_pos.IsReal()) {
529 location.AddProperty("endTokenPos", end_token_pos);
530 }
531 intptr_t line = -1;
532 intptr_t column = -1;
533 // Add line and column information if token_pos is real.
534 if (script.GetTokenLocation(token_pos, &line, &column)) {
535 location.AddProperty("line", line);
536 location.AddProperty("column", column);
537 }
538}
JSONObject(JSONStream *stream)

◆ AddLocationLine()

void dart::JSONObject::AddLocationLine ( const Script script,
intptr_t  line 
) const

Definition at line 550 of file json_stream.cc.

550 {
551 JSONObject location(this, "location");
552 location.AddProperty("type", "SourceLocation");
553 location.AddProperty("script", script);
554 location.AddProperty("tokenPos", TokenPosition::kNoSource);
555 if (line > 0) {
556 location.AddProperty("line", line);
557 }
558}

◆ AddProperty() [1/15]

void dart::JSONObject::AddProperty ( const char *  name,
bool  b 
) const
inline

Definition at line 395 of file json_stream.h.

395 {
396 stream_->PrintPropertyBool(name, b);
397 }
static bool b

◆ AddProperty() [2/15]

void dart::JSONObject::AddProperty ( const char *  name,
Breakpoint bpt 
) const
inline

Definition at line 436 of file json_stream.h.

436 {
437 stream_->PrintProperty(name, bpt);
438 }

◆ AddProperty() [3/15]

void dart::JSONObject::AddProperty ( const char *  name,
const char *  s 
) const
inline

Definition at line 418 of file json_stream.h.

418 {
419 stream_->PrintProperty(name, s);
420 }
struct MyStruct s

◆ AddProperty() [4/15]

void dart::JSONObject::AddProperty ( const char *  name,
const Object obj,
bool  ref = true 
) const
inline

Definition at line 430 of file json_stream.h.

430 {
431 stream_->PrintProperty(name, obj, ref);
432 }

◆ AddProperty() [5/15]

void dart::JSONObject::AddProperty ( const char *  name,
const ServiceEvent event 
) const
inline

Definition at line 433 of file json_stream.h.

433 {
434 stream_->PrintProperty(name, event);
435 }
FlKeyEvent * event

◆ AddProperty() [6/15]

void dart::JSONObject::AddProperty ( const char *  name,
const TimelineEvent *  timeline_event 
) const
inline

Definition at line 457 of file json_stream.h.

458 {
459 stream_->PrintProperty(name, timeline_event);
460 }

◆ AddProperty() [7/15]

void dart::JSONObject::AddProperty ( const char *  name,
const TimelineEventBlock *  timeline_event_block 
) const
inline

Definition at line 461 of file json_stream.h.

462 {
463 stream_->PrintProperty(name, timeline_event_block);
464 }

◆ AddProperty() [8/15]

void dart::JSONObject::AddProperty ( const char *  name,
double  d 
) const
inline

Definition at line 410 of file json_stream.h.

410 {
411 stream_->PrintProperty(name, d);
412 }
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19

◆ AddProperty() [9/15]

void dart::JSONObject::AddProperty ( const char *  name,
intptr_t  i 
) const
inline

Definition at line 398 of file json_stream.h.

398 {
399 stream_->PrintProperty(name, i);
400 }

◆ AddProperty() [10/15]

void dart::JSONObject::AddProperty ( const char *  name,
Isolate isolate 
) const
inline

Definition at line 448 of file json_stream.h.

448 {
449 stream_->PrintProperty(name, isolate);
450 }

◆ AddProperty() [11/15]

void dart::JSONObject::AddProperty ( const char *  name,
IsolateGroup isolate_group 
) const
inline

Definition at line 451 of file json_stream.h.

451 {
452 stream_->PrintProperty(name, isolate_group);
453 }

◆ AddProperty() [12/15]

void dart::JSONObject::AddProperty ( const char *  name,
MessageQueue queue 
) const
inline

Definition at line 445 of file json_stream.h.

445 {
446 stream_->PrintProperty(name, queue);
447 }

◆ AddProperty() [13/15]

void dart::JSONObject::AddProperty ( const char *  name,
Metric metric 
) const
inline

Definition at line 442 of file json_stream.h.

442 {
443 stream_->PrintProperty(name, metric);
444 }

◆ AddProperty() [14/15]

void dart::JSONObject::AddProperty ( const char *  name,
TokenPosition  tp 
) const
inline

Definition at line 439 of file json_stream.h.

439 {
440 stream_->PrintProperty(name, tp);
441 }

◆ AddProperty() [15/15]

void dart::JSONObject::AddProperty ( const char *  name,
Zone zone 
) const
inline

Definition at line 454 of file json_stream.h.

454 {
455 stream_->PrintProperty(name, zone);
456 }

◆ AddProperty64()

void dart::JSONObject::AddProperty64 ( const char *  name,
int64_t  i 
) const
inline

Definition at line 401 of file json_stream.h.

401 {
402 stream_->PrintProperty64(name, i);
403 }

◆ AddPropertyBase64()

void dart::JSONObject::AddPropertyBase64 ( const char *  name,
const uint8_t *  bytes,
intptr_t  length 
) const
inline

Definition at line 413 of file json_stream.h.

415 {
416 stream_->PrintPropertyBase64(name, bytes, length);
417 }
size_t length

◆ AddPropertyF()

void dart::JSONObject::AddPropertyF ( const char *  name,
const char *  format,
  ... 
) const

Definition at line 589 of file json_stream.cc.

589 {
590 va_list args;
592 stream_->VPrintfProperty(name, format, args);
593 va_end(args);
594}

◆ AddPropertyNoEscape()

void dart::JSONObject::AddPropertyNoEscape ( const char *  name,
const char *  s 
) const
inline

Definition at line 427 of file json_stream.h.

427 {
428 stream_->PrintPropertyNoEscape(name, s);
429 }

◆ AddPropertyStr()

bool dart::JSONObject::AddPropertyStr ( const char *  name,
const String s,
intptr_t  offset = 0,
intptr_t  count = -1 
) const
inline

Definition at line 421 of file json_stream.h.

424 {
425 return stream_->PrintPropertyStr(name, s, offset, count);
426 }
int count
Point offset

◆ AddPropertyTimeMicros()

void dart::JSONObject::AddPropertyTimeMicros ( const char *  name,
int64_t  micros 
) const
inline

Definition at line 407 of file json_stream.h.

407 {
408 stream_->PrintPropertyTimeMicros(name, micros);
409 }

◆ AddPropertyTimeMillis()

void dart::JSONObject::AddPropertyTimeMillis ( const char *  name,
int64_t  millis 
) const
inline

Definition at line 404 of file json_stream.h.

404 {
405 stream_->PrintPropertyTimeMillis(name, millis);
406 }

◆ AddPropertyVM()

void dart::JSONObject::AddPropertyVM ( const char *  name,
bool  ref = true 
) const
inline

Definition at line 465 of file json_stream.h.

465 {
466 stream_->PrintPropertyVM(name, ref);
467 }

◆ AddServiceId() [1/2]

void dart::JSONObject::AddServiceId ( const char *  format,
  ... 
) const

Definition at line 513 of file json_stream.cc.

513 {
514 // Add the id property.
515 va_list args;
517 stream_->VPrintfProperty("id", format, args);
518 va_end(args);
519}

◆ AddServiceId() [2/2]

void dart::JSONObject::AddServiceId ( const Object o) const
inline

Definition at line 380 of file json_stream.h.

380{ stream_->PrintServiceId(o); }

◆ AddUnresolvedLocation()

void dart::JSONObject::AddUnresolvedLocation ( const BreakpointLocation bpt_loc) const

Definition at line 560 of file json_stream.cc.

561 {
562 ASSERT(!bpt_loc->IsResolved());
563
564 Zone* zone = Thread::Current()->zone();
565 Script& script = Script::Handle(zone);
566 TokenPosition token_pos = TokenPosition::kNoSource;
567 bpt_loc->GetCodeLocation(&script, &token_pos);
568
569 JSONObject location(this, "location");
570 location.AddProperty("type", "UnresolvedSourceLocation");
571 if (!script.IsNull()) {
572 location.AddProperty("script", script);
573 } else {
574 const String& scriptUri = String::Handle(zone, bpt_loc->url());
575 location.AddPropertyStr("scriptUri", scriptUri);
576 }
577 if (bpt_loc->requested_line_number() >= 0) {
578 // This unresolved breakpoint was specified at a particular line.
579 location.AddProperty("line", bpt_loc->requested_line_number());
580 if (bpt_loc->requested_column_number() >= 0) {
581 location.AddProperty("column", bpt_loc->requested_column_number());
582 }
583 } else {
584 // This unresolved breakpoint was requested at some function entry.
585 location.AddProperty("tokenPos", token_pos);
586 }
587}

Friends And Related Symbol Documentation

◆ JSONArray

friend class JSONArray
friend

Definition at line 474 of file json_stream.h.


The documentation for this class was generated from the following files: