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

#include <KV1.h>

Inheritance diagram for kvpp::KV1ElementBase< S, K >:
Collaboration diagram for kvpp::KV1ElementBase< S, K >:

Public Types

using iterator = typename std::vector< K >::iterator
 
using const_iterator = typename std::vector< K >::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 name.
 
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< K > & 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 KV1ElementBaseoperator[] (unsigned int n) const
 Get the child element of the element at the given index.
 
const KV1ElementBaseoperator[] (std::string_view childKey) const
 Get the first child element of the element with the given key.
 
const KV1ElementBaseoperator() (std::string_view childKey) const
 Get the first child element of the element with the given key.
 
const KV1ElementBaseoperator() (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.
 

Static Public Member Functions

static const KV1ElementBasegetInvalid ()
 

Protected Member Functions

 KV1ElementBase ()=default
 

Static Protected Member Functions

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

Protected Attributes

key = ""
 
value = ""
 
conditional = ""
 
std::vector< K > children
 

Detailed Description

template<typename S, typename K>
requires std::convertible_to<S, std::string_view>
class kvpp::KV1ElementBase< S, K >

Definition at line 24 of file KV1.h.

Member Typedef Documentation

◆ const_iterator

template<typename S , typename K >
using kvpp::KV1ElementBase< S, K >::const_iterator = typename std::vector<K>::const_iterator

Definition at line 100 of file KV1.h.

◆ iterator

template<typename S , typename K >
using kvpp::KV1ElementBase< S, K >::iterator = typename std::vector<K>::iterator

Definition at line 90 of file KV1.h.

Constructor & Destructor Documentation

◆ KV1ElementBase()

template<typename S , typename K >
kvpp::KV1ElementBase< S, K >::KV1ElementBase ( )
protecteddefault

Member Function Documentation

◆ begin() [1/2]

template<typename S , typename K >
constexpr iterator kvpp::KV1ElementBase< S, K >::begin ( )
inlineconstexpr

Definition at line 92 of file KV1.h.

◆ begin() [2/2]

template<typename S , typename K >
constexpr const_iterator kvpp::KV1ElementBase< S, K >::begin ( ) const
inlineconstexpr

Definition at line 102 of file KV1.h.

◆ cbegin()

template<typename S , typename K >
constexpr const_iterator kvpp::KV1ElementBase< S, K >::cbegin ( ) const
inlineconstexpr

Definition at line 110 of file KV1.h.

◆ cend()

template<typename S , typename K >
constexpr const_iterator kvpp::KV1ElementBase< S, K >::cend ( ) const
inlineconstexpr

Definition at line 114 of file KV1.h.

◆ end() [1/2]

template<typename S , typename K >
constexpr iterator kvpp::KV1ElementBase< S, K >::end ( )
inlineconstexpr

Definition at line 96 of file KV1.h.

◆ end() [2/2]

template<typename S , typename K >
constexpr const_iterator kvpp::KV1ElementBase< S, K >::end ( ) const
inlineconstexpr

Definition at line 106 of file KV1.h.

◆ getChildCount() [1/2]

template<typename S , typename K >
uint64_t kvpp::KV1ElementBase< S, K >::getChildCount ( ) const
inline

Get the number of child elements.

Definition at line 70 of file KV1.h.

◆ getChildCount() [2/2]

template<typename S , typename K >
uint64_t kvpp::KV1ElementBase< S, K >::getChildCount ( std::string_view  childKey) const
inline

Get the number of child elements with the given key.

Definition at line 75 of file KV1.h.

◆ getChildren()

template<typename S , typename K >
const std::vector< K > & kvpp::KV1ElementBase< S, K >::getChildren ( ) const
inline

Get the child elements of the element.

Definition at line 86 of file KV1.h.

◆ getConditional()

template<typename S , typename K >
std::string_view kvpp::KV1ElementBase< S, K >::getConditional ( ) const
inline

Get the conditional associated with the element.

Definition at line 60 of file KV1.h.

◆ getInvalid()

template<typename S , typename K >
static const KV1ElementBase & kvpp::KV1ElementBase< S, K >::getInvalid ( )
inlinestatic

Definition at line 157 of file KV1.h.

◆ getKey()

template<typename S , typename K >
std::string_view kvpp::KV1ElementBase< S, K >::getKey ( ) const
inline

Get the key associated with the element.

Definition at line 27 of file KV1.h.

◆ getValue() [1/2]

template<typename S , typename K >
std::string_view kvpp::KV1ElementBase< S, K >::getValue ( ) const
inline

Get the value associated with the element.

Definition at line 32 of file KV1.h.

◆ getValue() [2/2]

template<typename S , typename K >
template<KV1ValueType V>
V kvpp::KV1ElementBase< S, K >::getValue ( ) const
inline

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

Definition at line 38 of file KV1.h.

◆ hasChild()

template<typename S , typename K >
bool kvpp::KV1ElementBase< S, K >::hasChild ( std::string_view  childKey) const
inline

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

Definition at line 65 of file KV1.h.

◆ isInvalid()

template<typename S , typename K >
bool kvpp::KV1ElementBase< S, K >::isInvalid ( ) const
inline

Check if the given element is invalid.

Definition at line 153 of file KV1.h.

◆ operator()() [1/2]

template<typename S , typename K >
const KV1ElementBase & kvpp::KV1ElementBase< S, K >::operator() ( std::string_view  childKey) const
inline

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

Definition at line 129 of file KV1.h.

◆ operator()() [2/2]

template<typename S , typename K >
const KV1ElementBase & kvpp::KV1ElementBase< S, K >::operator() ( std::string_view  childKey,
unsigned int  n 
) const
inline

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

Definition at line 139 of file KV1.h.

◆ operator[]() [1/2]

template<typename S , typename K >
const KV1ElementBase & kvpp::KV1ElementBase< S, K >::operator[] ( std::string_view  childKey) const
inline

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

Definition at line 124 of file KV1.h.

◆ operator[]() [2/2]

template<typename S , typename K >
const KV1ElementBase & kvpp::KV1ElementBase< S, K >::operator[] ( unsigned int  n) const
inline

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

Definition at line 119 of file KV1.h.

◆ read()

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

Definition at line 165 of file KV1.h.

Member Data Documentation

◆ children

template<typename S , typename K >
std::vector<K> kvpp::KV1ElementBase< S, K >::children
protected

Definition at line 207 of file KV1.h.

◆ conditional

template<typename S , typename K >
S kvpp::KV1ElementBase< S, K >::conditional = ""
protected

Definition at line 206 of file KV1.h.

◆ key

template<typename S , typename K >
S kvpp::KV1ElementBase< S, K >::key = ""
protected

Definition at line 204 of file KV1.h.

◆ value

template<typename S , typename K >
S kvpp::KV1ElementBase< S, K >::value = ""
protected

Definition at line 205 of file KV1.h.


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