SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
bsppp::BSPEntityKeyValues Class Reference

#include <EntityLump.h>

Collaboration diagram for bsppp::BSPEntityKeyValues:

Classes

class  Element

Public Member Functions

 BSPEntityKeyValues ()=default
bool hasChild (std::string_view childKey) const
 Check if this entity has one or more keyvalues with the given name.
uint64_t getKeyValuesCount () const
 Get the number of keyvalues.
uint64_t getKeyValuesCount (std::string_view childKey) const
 Get the number of keyvalues with the given key.
const std::vector< Element > & getKeyValues () const
 Get the keyvalues of the entity.
const Elementoperator[] (unsigned int n) const
 Get the keyvalue of the entity at the given index.
Elementoperator[] (unsigned int n)
 Get the keyvalue of the entity at the given index.
const Elementoperator[] (std::string_view childKey) const
 Get the first keyvalue of the entity with the given key.
Elementoperator[] (std::string_view childKey)
 Get the first keyvalue of the entity with the given key, or create a new keyvalue if it doesn't exist.
const Elementoperator() (std::string_view childKey) const
 Get the first keyvalue of the entity with the given key.
Elementoperator() (std::string_view childKey)
 Get the first keyvalue of the entity with the given key, or create a new keyvalue if it doesn't exist.
const Elementoperator() (std::string_view childKey, unsigned int n) const
 Get the nth keyvalue of the entity with the given key.
Elementoperator() (std::string_view childKey, unsigned int n)
 Get the nth keyvalue of the entity with the given key, or create a new entity if it doesn't exist.
template<BSPEntityKeyValueType V = std::string_view>
ElementaddKeyValue (std::string_view key_, V value_={})
 Add a new keyvalue to the entity.
void removeKeyValue (std::string_view childKey, int n=-1)
 Remove a keyvalue from the entity. -1 means all keyvalues with the given key.
std::string bake (bool useEscapes) const

Protected Attributes

std::vector< Elementkeyvalues

Detailed Description

Definition at line 21 of file EntityLump.h.

Constructor & Destructor Documentation

◆ BSPEntityKeyValues()

bsppp::BSPEntityKeyValues::BSPEntityKeyValues ( )
default

Member Function Documentation

◆ addKeyValue()

template<BSPEntityKeyValueType V = std::string_view>
Element & bsppp::BSPEntityKeyValues::addKeyValue ( std::string_view key_,
V value_ = {} )
inline

Add a new keyvalue to the entity.

Definition at line 122 of file EntityLump.h.

◆ bake()

std::string BSPEntityKeyValues::bake ( bool useEscapes) const
nodiscard

Definition at line 124 of file EntityLump.cpp.

◆ getKeyValues()

const std::vector< BSPEntityKeyValues::Element > & BSPEntityKeyValues::getKeyValues ( ) const
nodiscard

Get the keyvalues of the entity.

Definition at line 45 of file EntityLump.cpp.

◆ getKeyValuesCount() [1/2]

uint64_t BSPEntityKeyValues::getKeyValuesCount ( ) const
nodiscard

Get the number of keyvalues.

Definition at line 31 of file EntityLump.cpp.

◆ getKeyValuesCount() [2/2]

uint64_t BSPEntityKeyValues::getKeyValuesCount ( std::string_view childKey) const
nodiscard

Get the number of keyvalues with the given key.

Definition at line 35 of file EntityLump.cpp.

◆ hasChild()

bool BSPEntityKeyValues::hasChild ( std::string_view childKey) const
nodiscard

Check if this entity has one or more keyvalues with the given name.

Definition at line 27 of file EntityLump.cpp.

◆ operator()() [1/4]

BSPEntityKeyValues::Element & BSPEntityKeyValues::operator() ( std::string_view childKey)
nodiscard

Get the first keyvalue of the entity with the given key, or create a new keyvalue if it doesn't exist.

Definition at line 74 of file EntityLump.cpp.

◆ operator()() [2/4]

const BSPEntityKeyValues::Element & BSPEntityKeyValues::operator() ( std::string_view childKey) const
nodiscard

Get the first keyvalue of the entity with the given key.

Definition at line 65 of file EntityLump.cpp.

◆ operator()() [3/4]

BSPEntityKeyValues::Element & BSPEntityKeyValues::operator() ( std::string_view childKey,
unsigned int n )
nodiscard

Get the nth keyvalue of the entity with the given key, or create a new entity if it doesn't exist.

Definition at line 96 of file EntityLump.cpp.

◆ operator()() [4/4]

const BSPEntityKeyValues::Element & BSPEntityKeyValues::operator() ( std::string_view childKey,
unsigned int n ) const
nodiscard

Get the nth keyvalue of the entity with the given key.

Definition at line 83 of file EntityLump.cpp.

◆ operator[]() [1/4]

BSPEntityKeyValues::Element & BSPEntityKeyValues::operator[] ( std::string_view childKey)
nodiscard

Get the first keyvalue of the entity with the given key, or create a new keyvalue if it doesn't exist.

Definition at line 61 of file EntityLump.cpp.

◆ operator[]() [2/4]

const BSPEntityKeyValues::Element & BSPEntityKeyValues::operator[] ( std::string_view childKey) const
nodiscard

Get the first keyvalue of the entity with the given key.

Definition at line 57 of file EntityLump.cpp.

◆ operator[]() [3/4]

BSPEntityKeyValues::Element & BSPEntityKeyValues::operator[] ( unsigned int n)
nodiscard

Get the keyvalue of the entity at the given index.

Definition at line 53 of file EntityLump.cpp.

◆ operator[]() [4/4]

const BSPEntityKeyValues::Element & BSPEntityKeyValues::operator[] ( unsigned int n) const
nodiscard

Get the keyvalue of the entity at the given index.

Definition at line 49 of file EntityLump.cpp.

◆ removeKeyValue()

void BSPEntityKeyValues::removeKeyValue ( std::string_view childKey,
int n = -1 )

Remove a keyvalue from the entity. -1 means all keyvalues with the given key.

Definition at line 109 of file EntityLump.cpp.

Member Data Documentation

◆ keyvalues

std::vector<Element> bsppp::BSPEntityKeyValues::keyvalues
protected

Definition at line 136 of file EntityLump.h.


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