SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
kvpp::KV1ElementReadable< S > Class Template Reference

#include <KV1.h>

Collaboration diagram for kvpp::KV1ElementReadable< S >:

Public Types

using iterator = std::vector<KV1ElementReadable>::iterator
using const_iterator = std::vector<KV1ElementReadable>::const_iterator

Public Member Functions

std::string_view getKey () const
 Get the key associated with the element.
std::string_view getValue () const
 Get the value associated with the element.
template<KV1ValueType V>
getValue () const
 Get the value associated with the element as the given type.
std::string_view getConditional () const
 Get the conditional associated with the element.
bool hasChild (std::string_view childKey) const
 Check if the element has one or more children with the given key.
uint64_t getChildCount () const
 Get the number of child elements.
uint64_t getChildCount (std::string_view childKey) const
 Get the number of child elements with the given key.
const std::vector< KV1ElementReadable > & getChildren () const
 Get the child elements of the element.
constexpr iterator begin ()
constexpr iterator end ()
constexpr const_iterator begin () const
constexpr const_iterator end () const
constexpr const_iterator cbegin () const
constexpr const_iterator cend () const
const KV1ElementReadableoperator[] (unsigned int n) const
 Get the child element of the element at the given index.
const KV1ElementReadableoperator[] (std::string_view childKey) const
 Get the first child element of the element with the given key.
const KV1ElementReadableoperator() (std::string_view childKey) const
 Get the first child element of the element with the given key.
const KV1ElementReadableoperator() (std::string_view childKey, unsigned int n) const
 Get the nth child element of the element with the given key.
bool isInvalid () const
 Check if the given element is invalid.
 operator bool () const

Static Public Member Functions

static const KV1ElementReadablegetInvalid ()

Protected Member Functions

 KV1ElementReadable ()=default

Static Protected Member Functions

static void read (BufferStreamReadOnly &stream, BufferStream &backing, std::vector< KV1ElementReadable > &elements, const sourcepp::parser::text::EscapeSequenceMap &escapeSequences)

Protected Attributes

key = ""
value = ""
conditional = ""
std::vector< KV1ElementReadablechildren

Detailed Description

template<typename S = std::string_view>
requires std::convertible_to<S, std::string_view>
class kvpp::KV1ElementReadable< S >

Definition at line 23 of file KV1.h.

Member Typedef Documentation

◆ const_iterator

template<typename S = std::string_view>
using kvpp::KV1ElementReadable< S >::const_iterator = std::vector<KV1ElementReadable>::const_iterator

Definition at line 99 of file KV1.h.

◆ iterator

template<typename S = std::string_view>
using kvpp::KV1ElementReadable< S >::iterator = std::vector<KV1ElementReadable>::iterator

Definition at line 89 of file KV1.h.

Constructor & Destructor Documentation

◆ KV1ElementReadable()

template<typename S = std::string_view>
kvpp::KV1ElementReadable< S >::KV1ElementReadable ( )
protecteddefault

Member Function Documentation

◆ begin() [1/2]

template<typename S = std::string_view>
iterator kvpp::KV1ElementReadable< S >::begin ( )
inlinenodiscardconstexpr

Definition at line 91 of file KV1.h.

◆ begin() [2/2]

template<typename S = std::string_view>
const_iterator kvpp::KV1ElementReadable< S >::begin ( ) const
inlinenodiscardconstexpr

Definition at line 101 of file KV1.h.

◆ cbegin()

template<typename S = std::string_view>
const_iterator kvpp::KV1ElementReadable< S >::cbegin ( ) const
inlinenodiscardconstexpr

Definition at line 109 of file KV1.h.

◆ cend()

template<typename S = std::string_view>
const_iterator kvpp::KV1ElementReadable< S >::cend ( ) const
inlinenodiscardconstexpr

Definition at line 113 of file KV1.h.

◆ end() [1/2]

template<typename S = std::string_view>
iterator kvpp::KV1ElementReadable< S >::end ( )
inlinenodiscardconstexpr

Definition at line 95 of file KV1.h.

◆ end() [2/2]

template<typename S = std::string_view>
const_iterator kvpp::KV1ElementReadable< S >::end ( ) const
inlinenodiscardconstexpr

Definition at line 105 of file KV1.h.

◆ getChildCount() [1/2]

template<typename S = std::string_view>
uint64_t kvpp::KV1ElementReadable< S >::getChildCount ( ) const
inlinenodiscard

Get the number of child elements.

Definition at line 69 of file KV1.h.

◆ getChildCount() [2/2]

template<typename S = std::string_view>
uint64_t kvpp::KV1ElementReadable< S >::getChildCount ( std::string_view childKey) const
inlinenodiscard

Get the number of child elements with the given key.

Definition at line 74 of file KV1.h.

◆ getChildren()

template<typename S = std::string_view>
const std::vector< KV1ElementReadable > & kvpp::KV1ElementReadable< S >::getChildren ( ) const
inlinenodiscard

Get the child elements of the element.

Definition at line 85 of file KV1.h.

◆ getConditional()

template<typename S = std::string_view>
std::string_view kvpp::KV1ElementReadable< S >::getConditional ( ) const
inlinenodiscard

Get the conditional associated with the element.

Definition at line 59 of file KV1.h.

◆ getInvalid()

template<typename S = std::string_view>
const KV1ElementReadable & kvpp::KV1ElementReadable< S >::getInvalid ( )
inlinestatic

Definition at line 158 of file KV1.h.

◆ getKey()

template<typename S = std::string_view>
std::string_view kvpp::KV1ElementReadable< S >::getKey ( ) const
inlinenodiscard

Get the key associated with the element.

Definition at line 26 of file KV1.h.

◆ getValue() [1/2]

template<typename S = std::string_view>
std::string_view kvpp::KV1ElementReadable< S >::getValue ( ) const
inlinenodiscard

Get the value associated with the element.

Definition at line 31 of file KV1.h.

◆ getValue() [2/2]

template<typename S = std::string_view>
template<KV1ValueType V>
V kvpp::KV1ElementReadable< S >::getValue ( ) const
inlinenodiscard

Get the value associated with the element as the given type.

Definition at line 37 of file KV1.h.

◆ hasChild()

template<typename S = std::string_view>
bool kvpp::KV1ElementReadable< S >::hasChild ( std::string_view childKey) const
inlinenodiscard

Check if the element has one or more children with the given key.

Definition at line 64 of file KV1.h.

◆ isInvalid()

template<typename S = std::string_view>
bool kvpp::KV1ElementReadable< S >::isInvalid ( ) const
inlinenodiscard

Check if the given element is invalid.

Definition at line 154 of file KV1.h.

◆ operator bool()

template<typename S = std::string_view>
kvpp::KV1ElementReadable< S >::operator bool ( ) const
inlineexplicitnodiscard

Definition at line 163 of file KV1.h.

◆ operator()() [1/2]

template<typename S = std::string_view>
const KV1ElementReadable & kvpp::KV1ElementReadable< S >::operator() ( std::string_view childKey) const
inlinenodiscard

Get the first child element of the element with the given key.

Definition at line 128 of file KV1.h.

◆ operator()() [2/2]

template<typename S = std::string_view>
const KV1ElementReadable & kvpp::KV1ElementReadable< S >::operator() ( std::string_view childKey,
unsigned int n ) const
inlinenodiscard

Get the nth child element of the element with the given key.

Definition at line 138 of file KV1.h.

◆ operator[]() [1/2]

template<typename S = std::string_view>
const KV1ElementReadable & kvpp::KV1ElementReadable< S >::operator[] ( std::string_view childKey) const
inlinenodiscard

Get the first child element of the element with the given key.

Definition at line 123 of file KV1.h.

◆ operator[]() [2/2]

template<typename S = std::string_view>
const KV1ElementReadable & kvpp::KV1ElementReadable< S >::operator[] ( unsigned int n) const
inlinenodiscard

Get the child element of the element at the given index.

Definition at line 118 of file KV1.h.

◆ read()

template<typename S = std::string_view>
void kvpp::KV1ElementReadable< S >::read ( BufferStreamReadOnly & stream,
BufferStream & backing,
std::vector< KV1ElementReadable< S > > & elements,
const sourcepp::parser::text::EscapeSequenceMap & escapeSequences )
inlinestaticprotected

Definition at line 170 of file KV1.h.

Member Data Documentation

◆ children

template<typename S = std::string_view>
std::vector<KV1ElementReadable> kvpp::KV1ElementReadable< S >::children
protected

Definition at line 211 of file KV1.h.

◆ conditional

template<typename S = std::string_view>
S kvpp::KV1ElementReadable< S >::conditional = ""
protected

Definition at line 210 of file KV1.h.

◆ key

template<typename S = std::string_view>
S kvpp::KV1ElementReadable< S >::key = ""
protected

Definition at line 208 of file KV1.h.

◆ value

template<typename S = std::string_view>
S kvpp::KV1ElementReadable< S >::value = ""
protected

Definition at line 209 of file KV1.h.


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