P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::Util::JsonObject Class Referencefinal
Inheritance diagram for P4::Util::JsonObject:
[legend]

Public Member Functions

 DECLARE_TYPEINFO (JsonObject, IJson)
 
JsonObjectemplace (cstring label, IJson *value)
 
JsonObjectemplace (std::string_view label, IJson *value)
 
template<class T , class String >
auto emplace (String label, T &&s) -> std::enable_if_t<!std::is_convertible_v< T, IJson * >, JsonObject * >
 
JsonObjectemplace_non_null (cstring label, IJson *value)
 
IJsonget (cstring label) const
 
IJsonget (std::string_view label) const
 
template<class T , class S >
T * getAs (S label) const
 
void serialize (std::ostream &out) const override
 
- Public Member Functions inherited from P4::Util::IJson
 DECLARE_TYPEINFO (IJson)
 
void dump () const
 
cstring toString () const
 
- Public Member Functions inherited from P4::ICastable
template<typename T >
T & as ()
 Tries to convert the class to type T. A BUG occurs if the cast fails.
 
template<typename T >
const T & as () const
 Tries to convert the class to type T. A BUG occurs if the cast fails.
 
template<typename T >
T * checkedTo ()
 Performs a checked cast. A BUG occurs if the cast fails.
 
template<typename T >
const T * checkedTo () const
 Performs a checked cast. A BUG occurs if the cast fails.
 
- Public Member Functions inherited from P4::RTTI::Base
template<typename T >
bool is () const noexcept
 
virtual bool isA (TypeId typeId) const noexcept=0
 
template<typename T >
const T * to () const noexcept
 Same as to, but returns const pointer to T.
 
template<typename T >
T * to () noexcept
 
virtual TypeId typeId () const noexcept=0
 
- Public Member Functions inherited from P4::string_map< IJson * >
 string_map (const string_map &a)
 
 string_map (InputIt first, InputIt last)
 
 string_map (std::initializer_list< value_type > il)
 
 string_map (string_map &&a)=default
 
IJson *& at (Key &&k)
 
const IJson *& at (Key &&k) const
 
const_iterator begin () const noexcept
 
iterator begin () noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
void clear ()
 
bool contains (cstring a) const
 
bool contains (std::string_view a) const
 
size_type count (cstring a) const
 
size_type count (std::string_view a) const
 
const_reverse_iterator crbegin () const noexcept
 
const_reverse_iterator crend () const noexcept
 
std::pair< iterator, bool > emplace (Key &&k, VV &&...v)
 
bool empty () const noexcept
 
const_iterator end () const noexcept
 
iterator end () noexcept
 
iterator erase (const_iterator pos)
 
size_type erase (cstring k)
 
size_type erase (std::string_view k)
 
iterator find (cstring a)
 
const_iterator find (cstring a) const
 
iterator find (std::string_view a)
 
const_iterator find (std::string_view a) const
 
std::pair< iterator, bool > insert (const value_type &value)
 
void insert (InputIterator b, InputIterator e)
 
std::pair< iterator, bool > insert (value_type &&value)
 
size_type max_size () const noexcept
 
bool operator!= (const string_map &a) const
 
string_mapoperator= (const string_map &a)
 
string_mapoperator= (string_map &&a)=default
 
bool operator== (const string_map &a) const
 
IJson *& operator[] (Key &&k)
 
const_reverse_iterator rbegin () const noexcept
 
reverse_iterator rbegin () noexcept
 
const_reverse_iterator rend () const noexcept
 
reverse_iterator rend () noexcept
 
size_type size () const noexcept
 
void swap (string_map &other)
 

Friends

class Test::TestJson
 

Additional Inherited Members

- Public Types inherited from P4::string_map< IJson * >
using const_iterator
 
using const_reference
 
using const_reverse_iterator
 
using iterator
 
using key_type
 
using mapped_type
 
using reference
 
using reverse_iterator
 
using size_type
 
using value_type
 
- Protected Member Functions inherited from P4::RTTI::Base
virtual const void * toImpl (TypeId typeId) const noexcept=0
 

Member Function Documentation

◆ serialize()

void P4::Util::JsonObject::serialize ( std::ostream & out) const
overridevirtual

Implements P4::Util::IJson.