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

#include <KV1Writer.h>

Inheritance diagram for kvpp::KV1Writer< S >:
Collaboration diagram for kvpp::KV1Writer< S >:

Public Member Functions

 KV1Writer (std::string_view kv1Data="", bool useEscapeSequences_=false)
std::string bake () const
void bake (const std::filesystem::path &kv1Path) const
Public Member Functions inherited from kvpp::KV1ElementWritable< std::string >
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.
void setValue (V value_)
 Set the value associated with the element.
KV1ElementWritableoperator= (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.
KV1ElementWritableaddChild (std::string_view key_, V value_={}, std::string_view conditional_="")
uint64_t getChildCount () const
 Get the number of child elements.
const std::vector< KV1ElementWritable > & getChildren () const
 Get the child elements of the element.
constexpr iterator begin ()
constexpr iterator end ()
constexpr const_iterator cbegin () const
constexpr const_iterator cend () const
const KV1ElementWritableoperator[] (unsigned int n) const
 Get the child element of the element at the given index.
const KV1ElementWritableoperator() (std::string_view childKey) const
 Get the first child element of the element with the given key.
void removeChild (unsigned int n)
 Remove a child element from the element.
bool isInvalid () const
 Check if the given element is invalid.
 operator bool () const

Protected Attributes

bool useEscapeSequences
Protected Attributes inherited from kvpp::KV1ElementWritable< std::string >
std::string key
std::string value
std::string conditional
std::vector< KV1ElementWritablechildren

Additional Inherited Members

Public Types inherited from kvpp::KV1ElementWritable< std::string >
using iterator
using const_iterator
Static Public Member Functions inherited from kvpp::KV1ElementWritable< std::string >
static const KV1ElementWritablegetInvalid ()
Protected Member Functions inherited from kvpp::KV1ElementWritable< std::string >
 KV1ElementWritable ()=default
Static Protected Member Functions inherited from kvpp::KV1ElementWritable< std::string >
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)

Detailed Description

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

Definition at line 343 of file KV1Writer.h.

Constructor & Destructor Documentation

◆ KV1Writer()

template<typename S = std::string>
kvpp::KV1Writer< S >::KV1Writer ( std::string_view kv1Data = "",
bool useEscapeSequences_ = false )
inlineexplicit

Definition at line 345 of file KV1Writer.h.

Member Function Documentation

◆ bake() [1/2]

template<typename S = std::string>
std::string kvpp::KV1Writer< S >::bake ( ) const
inlinenodiscard

Definition at line 357 of file KV1Writer.h.

◆ bake() [2/2]

template<typename S = std::string>
void kvpp::KV1Writer< S >::bake ( const std::filesystem::path & kv1Path) const
inline

Definition at line 365 of file KV1Writer.h.

Member Data Documentation

◆ useEscapeSequences

template<typename S = std::string>
bool kvpp::KV1Writer< S >::useEscapeSequences
protected

Definition at line 378 of file KV1Writer.h.


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