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

◆ 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 VoltMod::CharBuf< N >::Assign(), and VoltMod::ReadFile().

◆ 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 VoltMod::CharBuf< N >::Assign(), and VoltMod::ReadFile().

Member Function Documentation

◆ Assign()

◆ Empty()

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

Definition at line 57 of file CharBuf.hpp.

References VoltMod::CharBuf< N >::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 VoltMod::CharBuf< N >::Assign(), and VoltMod::ReadFile().

◆ 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 VoltMod::CharBuf< N >::Assign(), and VoltMod::ReadFile().

◆ Str()

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

Definition at line 55 of file CharBuf.hpp.

References VoltMod::CharBuf< N >::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 VoltMod::ReadFile(), and VoltMod::CharBuf< N >::Value.

Referenced by VoltMod::CharBuf< N >::Str().

Member Data Documentation

◆ Value


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