VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::ConVars Class Reference

#include <ConVar.hpp>

Public Member Functions

 ConVars (Interfaces &interfaces)
 ~ConVars ()
 ConVars (const ConVars &)=delete
ConVars & operator= (const ConVars &)=delete
Status Available () const
template<ConVarValue T>
Result< ConVar< T > > Find (std::string_view name)
void ExecuteServerCommand (std::string_view command)
Status ExecuteFile (std::string_view path)
void SetByConsole (std::string_view name, std::string_view value)
 Assign a convar over the console, quoting the value.

Public Attributes

Event< const ConVarChange & > Changed

Friends

template<class U>
class ConVar

Detailed Description

Convar lookup, console commands, client overrides, and global change events.

Definition at line 113 of file ConVar.hpp.

Constructor & Destructor Documentation

◆ ConVars() [1/2]

VoltMod::ConVars::ConVars ( Interfaces & interfaces)
explicit

interfaces must outlive this service.

Definition at line 41 of file ConVars.cpp.

References Changed.

Referenced by ConVars(), and operator=().

◆ ~ConVars()

VoltMod::ConVars::~ConVars ( )

Definition at line 46 of file ConVars.cpp.

◆ ConVars() [2/2]

VoltMod::ConVars::ConVars ( const ConVars & )
delete

References ConVars().

Member Function Documentation

◆ Available()

Status VoltMod::ConVars::Available ( ) const

NotReady when ICvar is unavailable.

Definition at line 52 of file ConVars.cpp.

References VoltMod::Error::NotReady().

◆ ExecuteFile()

Status VoltMod::ConVars::ExecuteFile ( std::string_view path)

Queue each line of a cfg file, skipping blanks and // comments; exec reads only csgo/cfg.

Definition at line 87 of file ConVars.cpp.

References ExecuteServerCommand(), VoltMod::ReadAllText(), and VoltMod::Strings::Trim().

◆ ExecuteServerCommand()

void VoltMod::ConVars::ExecuteServerCommand ( std::string_view command)

Queue a server console line. A line with an embedded newline is refused and logged.

Definition at line 61 of file ConVars.cpp.

References VoltMod::Log::Warn().

Referenced by ExecuteFile(), and SetByConsole().

◆ Find()

template<ConVarValue T>
template Result< ConVar< float > > VoltMod::ConVars::Find< float > ( std::string_view name)

Resolve by name. Returns NotFound when absent and Invalid on a type mismatch.

Definition at line 33 of file ConVar.cpp.

References ConVar, VoltMod::ConVarTypeMatches(), VoltMod::Error::Engine(), VoltMod::Error::Invalid(), and VoltMod::Error::NotFound().

Referenced by VoltMod::ConVars::Find< std::string >().

◆ operator=()

ConVars & VoltMod::ConVars::operator= ( const ConVars & )
delete

References ConVars().

◆ SetByConsole()

void VoltMod::ConVars::SetByConsole ( std::string_view name,
std::string_view value )

Assign a convar over the console, quoting the value.

The one place the name value console line is built, so the quoting rule is not rediscovered per call site: a space would truncate the value and a ; would start a second command. A replicated payload sent straight to a client stays unquoted.

Definition at line 111 of file ConVars.cpp.

References ExecuteServerCommand(), and VoltMod::Strings::QuoteConsoleArg().

◆ ConVar

template<class U>
friend class ConVar
friend

Definition at line 149 of file ConVar.hpp.

References ConVar.

Referenced by ConVar, and Find().

Member Data Documentation

◆ Changed

Event<const ConVarChange&> VoltMod::ConVars::Changed

All engine convar changes. The global callback exists only while this event has subscribers.

Definition at line 145 of file ConVar.hpp.

Referenced by ConVars().


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