steam-min-cpp
Loading...
Searching...
No Matches
Steam::Utils::VDF::VDFNode Struct Reference

Node in a VDF tree. More...

#include <vdf.hpp>

Public Member Functions

const VDFNodeget (const std::string &key) const
 Find a child node by key.
VDFNodeget (const std::string &key)
 Find a child node by key.
std::string get_string_or (const std::string &key, std::string def) const
 Retrieve a string value by key with a default fallback.
int32_t get_int_or (const std::string &key, int32_t def) const
 Retrieve an int32_t value by key with fallback.
uint64_t get_uint64_or (const std::string &key, uint64_t def) const
 Retrieve a uint64_t value by key with fallback.
float get_float_or (const std::string &key, float def) const
 Retrieve a float value by key with fallback.
const VDFNodeget_path (std::initializer_list< std::string > keys) const
 Find a nested node using a path of keys.
Objectas_object ()
 Access the node as an object.
const Objectas_object () const
 Access the node as an object.
std::string & as_string ()
 Access the node as a string.
const std::string & as_string () const
 Access the node as a string.
int32_t as_int () const
 Access the node as an int32_t.
uint64_t as_uint64 () const
 Access the node as a uint64_t.
float as_float () const
 Access the node as a float.

Public Attributes

Value value
 Stored node value.

Detailed Description

Node in a VDF tree.

A node contains a variant value which may represent a primitive type or a nested object. Object nodes can be queried using get or get_path.

Member Function Documentation

◆ as_object() [1/2]

Object & Steam::Utils::VDF::VDFNode::as_object ( )
inline

Access the node as an object.

Exceptions
std::bad_variant_accessif the node is not an object.

◆ as_object() [2/2]

const Object & Steam::Utils::VDF::VDFNode::as_object ( ) const
inline

Access the node as an object.

Exceptions
std::bad_variant_accessif the node is not an object.

◆ as_string() [1/2]

std::string & Steam::Utils::VDF::VDFNode::as_string ( )
inline

Access the node as a string.

Exceptions
std::bad_variant_accessif the node is not a string.

◆ as_string() [2/2]

const std::string & Steam::Utils::VDF::VDFNode::as_string ( ) const
inline

Access the node as a string.

Exceptions
std::bad_variant_accessif the node is not a string.

◆ get() [1/2]

VDFNode * Steam::Utils::VDF::VDFNode::get ( const std::string & key)
inline

Find a child node by key.

Parameters
keyObject key to search for.
Returns
Pointer to the child node or nullptr if not found.

◆ get() [2/2]

const VDFNode * Steam::Utils::VDF::VDFNode::get ( const std::string & key) const
inline

Find a child node by key.

Parameters
keyObject key to search for.
Returns
Pointer to the child node or nullptr if not found.

◆ get_path()

const VDFNode * Steam::Utils::VDF::VDFNode::get_path ( std::initializer_list< std::string > keys) const
inline

Find a nested node using a path of keys.

Example:

node.get_path({"appinfo","common","name"});
Parameters
keysSequence of nested object keys.
Returns
Pointer to the final node or nullptr.

◆ get_string_or()

std::string Steam::Utils::VDF::VDFNode::get_string_or ( const std::string & key,
std::string def ) const
inline

Retrieve a string value by key with a default fallback.

Parameters
keyKey to search for.
defDefault value returned if the key is missing or not a string.

The documentation for this struct was generated from the following file:
  • include/steamclient/utilities/vdf.hpp