GCC Middle and Back End API Reference
sarif_array_of_unique< JsonElementType > Class Template Reference
Inheritance diagram for sarif_array_of_unique< JsonElementType >:
Collaboration diagram for sarif_array_of_unique< JsonElementType >:

Data Structures

struct  comparator_t

Public Member Functions

size_t append_uniquely (std::unique_ptr< JsonElementType > val)
void add_explicit_index_values ()
enum kind get_kind () const final override
void print (pretty_printer *pp, bool formatted) const final override
void append (value *v)
template<typename JsonType>
void append (std::unique_ptr< JsonType > v)
void append_string (const char *utf8_value)
size_t size () const
valueoperator[] (size_t i) const
value ** begin ()
const value *const * begin () const
value ** end ()
const value *const * end () const
size_t length () const
valueget (size_t idx) const
void dump (FILE *, bool formatted) const
void DEBUG_FUNCTION dump () const
virtual objectdyn_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

std::map< json::value *, int, comparator_tm_index_by_value
auto_vec< value * > m_elements

Detailed Description

template<typename JsonElementType>
class sarif_array_of_unique< JsonElementType >
A json::array where the values are "unique" as per SARIF v2.1.0 section 3.7.3 ("Array properties with unique values").

Member Function Documentation

◆ add_explicit_index_values()

template<typename JsonElementType>
void sarif_array_of_unique< JsonElementType >::add_explicit_index_values ( )
inline

◆ append() [1/2]

template<typename JsonType>
void json::array::append ( std::unique_ptr< JsonType > v)
inlineinherited

References append().

◆ append() [2/2]

◆ append_string()

void array::append_string ( const char * utf8_value)
inherited

◆ append_uniquely()

template<typename JsonElementType>
size_t sarif_array_of_unique< JsonElementType >::append_uniquely ( std::unique_ptr< JsonElementType > val)
inline

◆ begin() [1/2]

value ** json::array::begin ( )
inlineinherited

References m_elements.

◆ begin() [2/2]

const value *const * json::array::begin ( ) const
inlineinherited

References m_elements.

◆ compare()

int value::compare ( const json::value & val_a,
const json::value & val_b )
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()().

◆ dump() [1/2]

void value::dump ( ) const
inherited
A convenience function for debugging. Dump to stderr with formatting, and a trailing newline.

References dump().

◆ dump() [2/2]

void value::dump ( FILE * outf,
bool formatted ) const
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().

◆ dyn_cast_object()

virtual object * json::value::dyn_cast_object ( )
inlinevirtualinherited

◆ end() [1/2]

value ** json::array::end ( )
inlineinherited

References m_elements.

◆ end() [2/2]

const value *const * json::array::end ( ) const
inlineinherited

References m_elements.

◆ get()

value * json::array::get ( size_t idx) const
inlineinherited

◆ get_kind()

enum kind json::array::get_kind ( ) const
inlinefinaloverridevirtualinherited

Implements json::value.

References final(), and json::JSON_ARRAY.

◆ get_pointer_token()

const pointer::token & json::value::get_pointer_token ( ) const
inlineinherited

References m_pointer_token.

◆ length()

size_t json::array::length ( ) const
inlineinherited

◆ operator[]()

value * json::array::operator[] ( size_t i) const
inlineinherited

References i, and m_elements.

◆ print()

void array::print ( pretty_printer * pp,
bool formatted ) const
finaloverridevirtualinherited
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().

◆ size()

size_t json::array::size ( ) const
inlineinherited

Field Documentation

◆ m_elements

auto_vec<value *> json::array::m_elements
privateinherited

◆ m_index_by_value

template<typename JsonElementType>
std::map<json::value *, int, comparator_t> sarif_array_of_unique< JsonElementType >::m_index_by_value
private

Referenced by append_uniquely().

◆ m_pointer_token

pointer::token json::value::m_pointer_token
inherited

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