#include <json.h>
Public Member Functions | |
~array () | |
enum kind | get_kind () const final override |
void | print (pretty_printer *pp, bool formatted) const final override |
void | append (value *v) |
void | append_string (const char *utf8_value) |
template<typename JsonType> | |
void | append (std::unique_ptr< JsonType > v) |
size_t | size () const |
value * | operator[] (size_t i) const |
value ** | begin () |
value ** | end () |
const value *const * | begin () const |
const value *const * | end () const |
size_t | length () const |
value * | get (size_t idx) const |
void | dump (FILE *, bool formatted) const |
void DEBUG_FUNCTION | dump () const |
virtual object * | dyn_cast_object () |
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 |
Private Attributes | |
auto_vec< value * > | m_elements |
Subclass of value for arrays.
array::~array | ( | ) |
class json::array, a subclass of json::value, representing an ordered collection of values.
json::array's dtor.
References FOR_EACH_VEC_ELT, i, and m_elements.
|
inline |
References append().
void array::append | ( | value * | v | ) |
Append non-NULL value V to a json::array, taking ownership of V.
References gcc_assert, m_elements, and json::value::m_pointer_token.
Referenced by optrecord_json_writer::add_pass_list(), append(), append_string(), sarif_array_of_unique< JsonElementType >::append_uniquely(), bt_callback(), optrecord_json_writer::inlining_chain_to_json(), json_set_prime_path_coverage(), sarif_location::lazily_add_relationship_object(), timer::make_json(), optrecord_json_writer::optinfo_to_json(), output_intermediate_json_line(), and output_json_intermediate_file().
void array::append_string | ( | const char * | utf8_value | ) |
References append(), and gcc_assert.
Referenced by sarif_location_relationship::lazily_add_kind(), optrecord_json_writer::optinfo_to_json(), and optrecord_json_writer::pass_to_json().
|
inline |
References m_elements.
|
inline |
References m_elements.
|
staticinherited |
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 sarif_array_of_unique< JsonElementType >::comparator_t::operator()().
|
inherited |
A convenience function for debugging. Dump to stderr with formatting, and a trailing newline.
References dump().
|
inherited |
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 sarif_serialization_format_json::write_to_file().
|
inlinevirtualinherited |
Reimplemented in json::object.
Referenced by sarif_array_of_unique< JsonElementType >::add_explicit_index_values().
|
inline |
References m_elements.
|
inline |
References m_elements.
|
inline |
References m_elements.
Referenced by sarif_array_of_unique< JsonElementType >::add_explicit_index_values().
|
inlinefinaloverridevirtual |
Implements json::value.
References final(), and json::JSON_ARRAY.
|
inlineinherited |
References m_pointer_token.
|
inline |
References m_elements.
Referenced by sarif_array_of_unique< JsonElementType >::add_explicit_index_values().
|
inline |
References i, and m_elements.
|
finaloverridevirtual |
Implementation of json::value::print for json::array.
Implements json::value.
References FOR_EACH_VEC_ELT, i, m_elements, pp_character(), pp_indent(), pp_indentation(), pp_newline(), pp_space, pp_string(), and json::value::print().
|
inline |
References m_elements.
Referenced by sarif_array_of_unique< JsonElementType >::append_uniquely(), bt_callback(), and json::value::compare().
|
inherited |
Referenced by json::array::append(), get_pointer_token(), and json::object::set().