19 return this == &getInvalid();
37 for (
const auto& element : this->
keyvalues) {
66 for (
const auto& element : this->
keyvalues) {
84 unsigned int count = 0;
85 for (
const auto& element : this->
keyvalues) {
97 unsigned int count = 0;
110 unsigned int count = 0;
111 for (
auto element = this->
keyvalues.begin(); element != this->keyvalues.end(); ++element) {
113 if (n < 0 || count == n) {
114 element = this->
keyvalues.erase(element);
125 std::string out =
"{\n";
126 for (
const auto& elem : this->
keyvalues) {
static const Element & getInvalid()
std::string_view getKey() const
Get the key associated with the element.
std::string_view getValue() const
Get the value associated with the element.
bool isInvalid() const
Check if the given element is invalid.
void setKey(std::string_view key_)
Set the key associated with the element.
const Element & operator()(std::string_view childKey) const
Get the first keyvalue of the entity with the given key.
bool hasChild(std::string_view childKey) const
Check if this entity has one or more keyvalues with the given name.
Element & addKeyValue(std::string_view key_, V value_={})
Add a new keyvalue to the entity.
uint64_t getKeyValuesCount() const
Get the number of keyvalues.
std::string bake(bool useEscapes) const
const std::vector< Element > & getKeyValues() const
Get the keyvalues of 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::vector< Element > keyvalues
const Element & operator[](unsigned int n) const
Get the keyvalue of the entity at the given index.
std::string convertSpecialCharsToEscapes(std::string_view str, const EscapeSequenceMap &escapeSequences)
Convert special characters like \n to escaped special characters like \\n.
const EscapeSequenceMap NO_ESCAPE_SEQUENCES
const EscapeSequenceMap DEFAULT_ESCAPE_SEQUENCES
bool iequals(std::string_view s1, std::string_view s2)