![]() |
SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
|
#include <KV1Writer.h>

Public Types | |
| using | iterator = std::vector<KV1ElementWritable>::iterator |
| using | const_iterator = std::vector<KV1ElementWritable>::const_iterator |
Public Member Functions | |
| std::string_view | getKey () const |
| Get the key associated with the element. | |
| void | setKey (std::string_view key_) |
| Set the key associated with the element. | |
| std::string_view | getValue () const |
| Get the value associated with the element. | |
| template<KV1ValueType V> | |
| V | getValue () const |
| Get the value associated with the element as the given type. | |
| template<KV1ValueType V> | |
| void | setValue (V value_) |
| Set the value associated with the element. | |
| template<KV1ValueType V> | |
| KV1ElementWritable & | operator= (V value_) |
| Set the value associated with the element. | |
| std::string_view | getConditional () const |
| Get the conditional associated with the element. | |
| void | setConditional (std::string_view conditional_) |
| Set 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. | |
| template<KV1ValueType V = std::string_view> | |
| KV1ElementWritable & | addChild (std::string_view key_, V value_={}, std::string_view conditional_="") |
| 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< KV1ElementWritable > & | getChildren () const |
| Get the child elements of the element. | |
| std::vector< KV1ElementWritable > & | getChildren () |
| 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 KV1ElementWritable & | operator[] (unsigned int n) const |
| Get the child element of the element at the given index. | |
| KV1ElementWritable & | operator[] (unsigned int n) |
| Get the child element of the element at the given index. | |
| const KV1ElementWritable & | operator[] (std::string_view childKey) const |
| Get the first child element of the element with the given key. | |
| KV1ElementWritable & | operator[] (std::string_view childKey) |
| Get the first child element of the element with the given key, or create a new element if it doesn't exist. | |
| const KV1ElementWritable & | operator() (std::string_view childKey) const |
| Get the first child element of the element with the given key. | |
| KV1ElementWritable & | operator() (std::string_view childKey) |
| Get the first child element of the element with the given key, or create a new element if it doesn't exist. | |
| const KV1ElementWritable & | operator() (std::string_view childKey, unsigned int n) const |
| Get the nth child element of the element with the given key. | |
| KV1ElementWritable & | operator() (std::string_view childKey, unsigned int n) |
| Get the nth child element of the element with the given key, or create a new element if it doesn't exist. | |
| void | removeChild (unsigned int n) |
| Remove a child element from the element. | |
| void | removeChild (std::string_view childKey, int n=-1) |
| Remove a child element from the element with the given key. -1 means all children with the given key. | |
| bool | isInvalid () const |
| Check if the given element is invalid. | |
| operator bool () const | |
Static Public Member Functions | |
| static const KV1ElementWritable & | getInvalid () |
Protected Member Functions | |
| KV1ElementWritable ()=default | |
Static Protected Member Functions | |
| static void | read (BufferStreamReadOnly &stream, std::vector< KV1ElementWritable > &elements, const sourcepp::parser::text::EscapeSequenceMap &escapeSequences) |
| static void | write (BufferStream &stream, const std::vector< KV1ElementWritable > &elements, unsigned short indentLevel, const sourcepp::parser::text::EscapeSequenceMap &escapeSequences) |
Protected Attributes | |
| S | key = "" |
| S | value = "" |
| S | conditional = "" |
| std::vector< KV1ElementWritable > | children |
Definition at line 11 of file KV1Writer.h.
| using kvpp::KV1ElementWritable< S >::const_iterator = std::vector<KV1ElementWritable>::const_iterator |
Definition at line 130 of file KV1Writer.h.
| using kvpp::KV1ElementWritable< S >::iterator = std::vector<KV1ElementWritable>::iterator |
Definition at line 120 of file KV1Writer.h.
|
protecteddefault |
|
inline |
Definition at line 85 of file KV1Writer.h.
|
inlinenodiscardconstexpr |
Definition at line 122 of file KV1Writer.h.
|
inlinenodiscardconstexpr |
Definition at line 132 of file KV1Writer.h.
|
inlinenodiscardconstexpr |
Definition at line 140 of file KV1Writer.h.
|
inlinenodiscardconstexpr |
Definition at line 144 of file KV1Writer.h.
|
inlinenodiscardconstexpr |
Definition at line 126 of file KV1Writer.h.
|
inlinenodiscardconstexpr |
Definition at line 136 of file KV1Writer.h.
|
inlinenodiscard |
Get the number of child elements.
Definition at line 95 of file KV1Writer.h.
|
inlinenodiscard |
Get the number of child elements with the given key.
Definition at line 100 of file KV1Writer.h.
|
inlinenodiscard |
Get the child elements of the element.
Definition at line 116 of file KV1Writer.h.
|
inlinenodiscard |
Get the child elements of the element.
Definition at line 111 of file KV1Writer.h.
|
inlinenodiscard |
Get the conditional associated with the element.
Definition at line 69 of file KV1Writer.h.
|
inlinestatic |
Definition at line 248 of file KV1Writer.h.
|
inlinenodiscard |
Get the key associated with the element.
Definition at line 14 of file KV1Writer.h.
|
inlinenodiscard |
Get the value associated with the element.
Definition at line 24 of file KV1Writer.h.
|
inlinenodiscard |
Get the value associated with the element as the given type.
Definition at line 30 of file KV1Writer.h.
|
inlinenodiscard |
Check if the element has one or more children with the given key.
Definition at line 79 of file KV1Writer.h.
|
inlinenodiscard |
Check if the given element is invalid.
Definition at line 244 of file KV1Writer.h.
|
inlineexplicitnodiscard |
Definition at line 253 of file KV1Writer.h.
|
inlinenodiscard |
Get the first child element of the element with the given key, or create a new element if it doesn't exist.
Definition at line 179 of file KV1Writer.h.
|
inlinenodiscard |
Get the first child element of the element with the given key.
Definition at line 169 of file KV1Writer.h.
|
inlinenodiscard |
Get the nth child element of the element with the given key, or create a new element if it doesn't exist.
Definition at line 205 of file KV1Writer.h.
|
inlinenodiscard |
Get the nth child element of the element with the given key.
Definition at line 189 of file KV1Writer.h.
|
inline |
Set the value associated with the element.
Definition at line 63 of file KV1Writer.h.
|
inlinenodiscard |
Get the first child element of the element with the given key, or create a new element if it doesn't exist.
Definition at line 164 of file KV1Writer.h.
|
inlinenodiscard |
Get the first child element of the element with the given key.
Definition at line 159 of file KV1Writer.h.
|
inlinenodiscard |
Get the child element of the element at the given index.
Definition at line 154 of file KV1Writer.h.
|
inlinenodiscard |
Get the child element of the element at the given index.
Definition at line 149 of file KV1Writer.h.
|
inlinestaticprotected |
Definition at line 260 of file KV1Writer.h.
|
inline |
Remove a child element from the element with the given key. -1 means all children with the given key.
Definition at line 228 of file KV1Writer.h.
|
inline |
Remove a child element from the element.
Definition at line 221 of file KV1Writer.h.
|
inline |
Set the conditional associated with the element.
Definition at line 74 of file KV1Writer.h.
|
inline |
Set the key associated with the element.
Definition at line 19 of file KV1Writer.h.
|
inline |
Set the value associated with the element.
Definition at line 53 of file KV1Writer.h.
|
inlinestaticprotected |
Definition at line 298 of file KV1Writer.h.
|
protected |
Definition at line 338 of file KV1Writer.h.
|
protected |
Definition at line 337 of file KV1Writer.h.
|
protected |
Definition at line 335 of file KV1Writer.h.
|
protected |
Definition at line 336 of file KV1Writer.h.