VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::ConVar< T > Class Template Reference

#include <ConVar.hpp>

Public Member Functions

 ConVar ()=default
 
T Get () const
 
Status Set (const T &value)
 
void SetFor (int slot, const T &value) const
 
ConVarRawScope< T > RawScope (const T &value)
 
std::string_view Name () const
 
 operator bool () const noexcept
 

Friends

class ConVarRawScope< T >
 
class ConVars
 

Detailed Description

template<class T>
class VoltMod::ConVar< T >

Typed convar handle resolved once by name. Supported types are bool, int, float, and std::string. Handles remain valid across map changes. Unresolved handles read as T{} and reject writes.

Definition at line 71 of file ConVar.hpp.

Constructor & Destructor Documentation

◆ ConVar()

template<class T >
VoltMod::ConVar< T >::ConVar ( )
default

Member Function Documentation

◆ Get()

template<class T >
T VoltMod::ConVar< T >::Get ( ) const

Current server value, or T{} when unresolved.

Definition at line 69 of file ConVar.cpp.

References VoltMod::Int16, VoltMod::ReadFile(), VoltMod::T, and VoltMod::UInt16.

◆ Name()

template<class T >
std::string_view VoltMod::ConVar< T >::Name ( ) const
inline

Definition at line 95 of file ConVar.hpp.

◆ operator bool()

template<class T >
VoltMod::ConVar< T >::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 97 of file ConVar.hpp.

◆ RawScope()

template<class T >
ConVarRawScope< T > VoltMod::ConVar< T >::RawScope ( const T &  value)
inline

Set without callbacks or networking until the returned scope is destroyed.

Definition at line 89 of file ConVar.hpp.

References VoltMod::ConVar< T >::ConVarRawScope< T >.

◆ Set()

template<class T >
Status VoltMod::ConVar< T >::Set ( const T &  value)

Set through the server console. Success means queued; Error::NotReady means unavailable.

Definition at line 107 of file ConVar.cpp.

References VoltMod::ConVarText(), and VoltMod::Error::NotReady().

◆ SetFor()

template<class T >
void VoltMod::ConVar< T >::SetFor ( int  slot,
const T &  value 
) const

Override one client's replicated view without changing the server value. Connect and map snapshots replace the override, so resend it after spawn when persistence is required.

Definition at line 156 of file ConVar.cpp.

References VoltMod::ConVarText(), and VoltMod::ReadFile().

Friends And Related Symbol Documentation

◆ ConVarRawScope< T >

template<class T >
friend class ConVarRawScope< T >
friend

Definition at line 97 of file ConVar.hpp.

Referenced by VoltMod::ConVar< T >::RawScope().

◆ ConVars

template<class T >
friend class ConVars
friend

Definition at line 101 of file ConVar.hpp.


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