GCC Middle and Back End API Reference
|
#include <json.h>
Public Member Functions | |
virtual | ~value () |
virtual enum kind | get_kind () const =0 |
virtual void | print (pretty_printer *pp, bool formatted) const =0 |
virtual std::unique_ptr< value > | clone () const =0 |
void | dump (FILE *, bool formatted) const |
void DEBUG_FUNCTION | dump () const |
virtual object * | dyn_cast_object () |
virtual string * | dyn_cast_string () |
const pointer::token & | get_pointer_token () const |
Static Public Member Functions | |
static int | compare (const json::value &val_a, const json::value &val_b) |
Data Fields | |
pointer::token | m_pointer_token |
Base class of JSON value.
|
inlinevirtual |
|
pure virtual |
Implemented in json::array, json::float_number, json::integer_number, json::literal, json::object, and json::string.
References DEBUG_FUNCTION.
Referenced by json::array::clone(), json::object::clone_as_object(), and diagnostics::copy_any_property_bag().
|
static |
A deterministic total ordering for comparing json values, so that we can e.g. put them in std::map. This is intended to follow the condition for equality described in the JSON Schema standard (§4.3, “Instance equality”), as referenced by SARIF v2.1.0 (§3.7.3 "Array properties with unique values"), but has the following limitations: - numbers are supposed to be checked for "the same mathematical value", but in this implementation int vs float numbers won't compare as equal, and float number comparison is bitwise - strings are supposed to be "the same codepoint-for-codepoint", but this implementation doesn't take into account canonicalization issues.
References json::object::compare(), compare(), gcc_unreachable, json::float_number::get(), json::integer_number::get(), get_kind(), json::string::get_string(), json::JSON_ARRAY, json::JSON_FALSE, json::JSON_FLOAT, json::JSON_INTEGER, json::JSON_NULL, json::JSON_OBJECT, json::JSON_STRING, json::JSON_TRUE, and json::array::size().
Referenced by json::object::compare(), compare(), and diagnostics::sarif_array_of_unique< JsonElementType >::comparator_t::operator()().
void value::dump | ( | ) | const |
A convenience function for debugging. Dump to stderr with formatting, and a trailing newline.
References dump().
void value::dump | ( | FILE * | outf, |
bool | formatted ) const |
class json::value.
Dump this json::value tree to OUTF. The key/value pairs of json::objects are printed in the order in which the keys were originally inserted.
References output_buffer::m_stream, pp_buffer(), pp_flush(), and print().
Referenced by dump(), generate_results(), and diagnostics::sarif_serialization_format_json::write_to_file().
|
inlinevirtual |
Reimplemented in json::object.
Referenced by diagnostics::sarif_array_of_unique< JsonElementType >::add_explicit_index_values().
|
inlinevirtual |
Reimplemented in json::string.
|
pure virtual |
Implemented in json::array, json::float_number, json::integer_number, json::literal, json::object, and json::string.
Referenced by compare(), and diagnostics::sarif_object::get_or_create_properties().
|
inline |
References m_pointer_token.
|
pure virtual |
Implemented in json::array, json::float_number, json::integer_number, json::literal, json::object, and json::string.
Referenced by dump(), json::array::print(), and json::object::print().
pointer::token json::value::m_pointer_token |
Referenced by json::array::append(), get_pointer_token(), and json::object::set().