VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::CharBuf< N > Struct Template Reference

A value for a fixed engine character array (char m_name[N]). More...

#include <CharBuf.hpp>

Public Member Functions

 CharBuf ()=default
 CharBuf (std::string_view text) noexcept
 CharBuf (const char *text) noexcept
CharBuf & operator= (std::string_view text) noexcept
CharBuf & operator= (const char *text) noexcept
std::string_view View () const noexcept
std::string Str () const
bool Empty () const noexcept
void Assign (std::string_view text) noexcept

Public Attributes

char Value [N] {}

Detailed Description

template<size_t N>
struct VoltMod::CharBuf< N >

A value for a fixed engine character array (char m_name[N]).

Assignment truncates to N-1 characters, adds a NUL, and clears the unused tail. View borrows this buffer; Str returns a copy.

Definition at line 19 of file CharBuf.hpp.

Constructor & Destructor Documentation

◆ CharBuf() [1/3]

template<size_t N>
VoltMod::CharBuf< N >::CharBuf ( )
default

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

◆ CharBuf() [2/3]

template<size_t N>
VoltMod::CharBuf< N >::CharBuf ( std::string_view text)
inlinenoexcept

Definition at line 26 of file CharBuf.hpp.

References Assign().

◆ CharBuf() [3/3]

template<size_t N>
VoltMod::CharBuf< N >::CharBuf ( const char * text)
inlinenoexcept

Supports direct construction from a literal without two user-defined conversions.

Definition at line 29 of file CharBuf.hpp.

References Assign().

Member Function Documentation

◆ Assign()

template<size_t N>
void VoltMod::CharBuf< N >::Assign ( std::string_view text)
inlinenoexcept

Definition at line 59 of file CharBuf.hpp.

References Value.

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

◆ Empty()

template<size_t N>
bool VoltMod::CharBuf< N >::Empty ( ) const
inlinenoexcept

Definition at line 57 of file CharBuf.hpp.

References Value.

◆ operator=() [1/2]

template<size_t N>
CharBuf & VoltMod::CharBuf< N >::operator= ( const char * text)
inlinenoexcept

Avoids ambiguous assignment from a string literal.

Definition at line 38 of file CharBuf.hpp.

References Assign(), and CharBuf().

◆ operator=() [2/2]

template<size_t N>
CharBuf & VoltMod::CharBuf< N >::operator= ( std::string_view text)
inlinenoexcept

Definition at line 31 of file CharBuf.hpp.

References Assign(), and CharBuf().

◆ Str()

template<size_t N>
std::string VoltMod::CharBuf< N >::Str ( ) const
inline

Definition at line 55 of file CharBuf.hpp.

References View().

◆ View()

template<size_t N>
std::string_view VoltMod::CharBuf< N >::View ( ) const
inlinenoexcept

Contents before the first NUL, borrowed from this buffer.

Definition at line 45 of file CharBuf.hpp.

References Value.

Referenced by Str().

Member Data Documentation

◆ Value

template<size_t N>
char VoltMod::CharBuf< N >::Value[N] {}

Definition at line 23 of file CharBuf.hpp.

Referenced by Assign(), Empty(), and View().


The documentation for this struct was generated from the following file: