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 SendTo (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 64 of file ConVar.cpp.

References VoltMod::Int16, VoltMod::T, and VoltMod::UInt16.

Referenced by VoltMod::ConVarOverrides::Set().

◆ Name()

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

Definition at line 95 of file ConVar.hpp.

Referenced by VoltMod::ConVarOverrides::Restore(), and VoltMod::ConVarOverrides::Set().

◆ 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)
inlinenodiscard

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

Definition at line 89 of file ConVar.hpp.

References ConVarRawScope< T >.

◆ SendTo()

template<class T>
void VoltMod::ConVar< T >::SendTo ( 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 151 of file ConVar.cpp.

References VoltMod::ConVarText().

◆ 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 102 of file ConVar.cpp.

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

Referenced by VoltMod::ConVarOverrides::Set().

◆ ConVarRawScope< T >

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

Definition at line 97 of file ConVar.hpp.

Referenced by RawScope().

◆ ConVars

template<class T>
friend class ConVars
friend

Definition at line 101 of file ConVar.hpp.

References ConVars.

Referenced by ConVars.


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