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

#include <CommandNames.hpp>

Public Types

using OwnerId = const void *
 

Public Member Functions

bool Register (OwnerId owner, std::string_view ownerName, std::string_view name)
 
void Reserve (std::string_view name)
 
std::string_view OwnerOf (std::string_view name) const
 
void RemoveAll (OwnerId owner)
 

Detailed Description

Which plugin owns each console command name, so two plugins cannot register the same one.

Definition at line 11 of file CommandNames.hpp.

Member Typedef Documentation

◆ OwnerId

The opaque pointer the host identifies a plugin by.

Definition at line 15 of file CommandNames.hpp.

Member Function Documentation

◆ OwnerOf()

std::string_view VoltMod::CommandNames::OwnerOf ( std::string_view  name) const

The owner's name, "the host" for the host's own, empty while name is free.

Definition at line 33 of file CommandNames.cpp.

References VoltMod::ReadFile().

Referenced by VoltMod::PluginContext::IsCommandRegistered(), and VoltMod::PluginContext::RegisterCommand().

◆ Register()

bool VoltMod::CommandNames::Register ( OwnerId  owner,
std::string_view  ownerName,
std::string_view  name 
)

False when another owner already has name. ownerName is what OwnerOf answers with.

Definition at line 8 of file CommandNames.cpp.

References VoltMod::ReadFile().

Referenced by VoltMod::PluginContext::RegisterCommand().

◆ RemoveAll()

void VoltMod::CommandNames::RemoveAll ( OwnerId  owner)

Remove every name owner registered. A plugin has no other way to give one back.

Definition at line 39 of file CommandNames.cpp.

References VoltMod::ReadFile().

Referenced by VoltMod::PluginContext::RemoveAll().

◆ Reserve()

void VoltMod::CommandNames::Reserve ( std::string_view  name)

Keep name for the host's own console commands.

Definition at line 25 of file CommandNames.cpp.

Referenced by VoltMod::PluginRegistry::RegisterHostCommand().


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