libcyberradio  22.01.24
ConfigString Class Reference

Configuration value string class. More...

#include <ConfigString.h>

Inherits string.

Public Member Functions

 ConfigString ()
 Constructs an empty ConfigString object.
 
 ConfigString (const std::string &str)
 Constructs a ConfigString object from a string. More...
 
 ConfigString (const std::string &str, size_t pos, size_t len=npos)
 Constructs a ConfigString object from a substring. More...
 
 ConfigString (const char *s)
 Constructs a ConfigString object from a string literal. More...
 
 ConfigString (const char *s, size_t n)
 Constructs a ConfigString object from a buffer. More...
 
 ConfigString (size_t n, char c)
 Constructs a ConfigString object from a fill character.
 
template<class InputIterator >
 ConfigString (InputIterator first, InputIterator last)
 Constructs a ConfigString object from a range. More...
 
 ConfigString (std::initializer_list< char > il)
 Constructs a ConfigString object from an initializer list. More...
 
 ConfigString (std::string &&str) noexcept
 Move constructor. More...
 
 ConfigString (int i)
 Constructs a ConfigString object. More...
 
 ConfigString (unsigned int i)
 Constructs a ConfigString object. More...
 
 ConfigString (long l)
 Constructs a ConfigString object. More...
 
 ConfigString (bool b)
 Constructs a ConfigString object. More...
 
 ConfigString (float f)
 Constructs a ConfigString object. More...
 
 ConfigString (double f)
 Constructs a ConfigString object. More...
 
virtual ~ConfigString ()
 Destroys a ConfigString object.
 
ConfigStringoperator= (const std::string &s)
 Assigns a value to this object. More...
 
ConfigStringoperator= (const char *s)
 Assigns a value to this object. More...
 
ConfigStringoperator= (int i)
 Assigns a value to this object. More...
 
ConfigStringoperator= (unsigned int i)
 Assigns a value to this object. More...
 
ConfigStringoperator= (long l)
 Assigns a value to this object. More...
 
ConfigStringoperator= (bool b)
 Assigns a value to this object. More...
 
ConfigStringoperator= (float f)
 Assigns a value to this object. More...
 
ConfigStringoperator= (double f)
 Assigns a value to this object. More...
 
int asInt () const
 Retrieves a value from this object. More...
 
unsigned int asUInt () const
 Retrieves a value from this object. More...
 
long asLong () const
 Retrieves a value from this object. More...
 
bool asBool () const
 Retrieves a value from this object. More...
 
float asFloat () const
 Retrieves a value from this object. More...
 
double asDouble () const
 Retrieves a value from this object. More...
 

Detailed Description

Configuration value string class.

This class supports all standard std::string semantics for manipulating the string form of the value.

This class overloads the assignment (=) operator for setting values using non-string data values, and defines several methods for converting the stored value back to non-string data types.

Definition at line 39 of file ConfigString.h.

Constructor & Destructor Documentation

◆ ConfigString() [1/13]

ConfigString ( const std::string &  str)
inline

Constructs a ConfigString object from a string.

Parameters
strString to copy.

Definition at line 50 of file ConfigString.h.

◆ ConfigString() [2/13]

ConfigString ( const std::string &  str,
size_t  pos,
size_t  len = npos 
)
inline

Constructs a ConfigString object from a substring.

Parameters
strString to extract from
posStart position (0 = beginning)
lenLength of substring. If this is npos, copy to end.

Definition at line 57 of file ConfigString.h.

◆ ConfigString() [3/13]

ConfigString ( const char *  s)
inline

Constructs a ConfigString object from a string literal.

Parameters
sString to copy.

Definition at line 63 of file ConfigString.h.

◆ ConfigString() [4/13]

ConfigString ( const char *  s,
size_t  n 
)
inline

Constructs a ConfigString object from a buffer.

Parameters
sString buffer
nNumber of characters to copy

Definition at line 69 of file ConfigString.h.

◆ ConfigString() [5/13]

ConfigString ( InputIterator  first,
InputIterator  last 
)
inline

Constructs a ConfigString object from a range.

Parameters
firstIterator to first character in the range
lastIterator to last character in the range

Definition at line 80 of file ConfigString.h.

◆ ConfigString() [6/13]

ConfigString ( std::initializer_list< char >  il)
inline

Constructs a ConfigString object from an initializer list.

Parameters
ilInitializer list

Definition at line 86 of file ConfigString.h.

◆ ConfigString() [7/13]

ConfigString ( std::string &&  str)
inlinenoexcept

Move constructor.

Parameters
strString to move.

Definition at line 91 of file ConfigString.h.

◆ ConfigString() [8/13]

ConfigString ( int  i)
inline

Constructs a ConfigString object.

Parameters
iString value, as an integer.

Definition at line 96 of file ConfigString.h.

◆ ConfigString() [9/13]

ConfigString ( unsigned int  i)
inline

Constructs a ConfigString object.

Parameters
iString value, as an unsigned integer.

Definition at line 101 of file ConfigString.h.

◆ ConfigString() [10/13]

ConfigString ( long  l)
inline

Constructs a ConfigString object.

Parameters
lString value, as a long integer.

Definition at line 106 of file ConfigString.h.

◆ ConfigString() [11/13]

ConfigString ( bool  b)
inline

Constructs a ConfigString object.

Parameters
bString value, as a Boolean value.

Definition at line 111 of file ConfigString.h.

◆ ConfigString() [12/13]

ConfigString ( float  f)
inline

Constructs a ConfigString object.

Parameters
fString value, as a floating-point value.

Definition at line 116 of file ConfigString.h.

◆ ConfigString() [13/13]

ConfigString ( double  f)
inline

Constructs a ConfigString object.

Parameters
fString value, as a double floating-point value.

Definition at line 121 of file ConfigString.h.

Member Function Documentation

◆ asBool()

bool asBool ( ) const

Retrieves a value from this object.

Returns
The value, as a Boolean value.

Definition at line 100 of file ConfigString.cpp.

◆ asDouble()

double asDouble ( ) const

Retrieves a value from this object.

Returns
The value, as a double floating-point value.

Definition at line 111 of file ConfigString.cpp.

◆ asFloat()

float asFloat ( ) const

Retrieves a value from this object.

Returns
The value, as a floating-point value.

Definition at line 106 of file ConfigString.cpp.

◆ asInt()

int asInt ( ) const

Retrieves a value from this object.

Returns
The value, as an integer.

Definition at line 85 of file ConfigString.cpp.

◆ asLong()

long asLong ( ) const

Retrieves a value from this object.

Returns
The value, as a long integer.

Definition at line 95 of file ConfigString.cpp.

◆ asUInt()

unsigned int asUInt ( ) const

Retrieves a value from this object.

Returns
The value, as an unsigned integer.

Definition at line 90 of file ConfigString.cpp.

◆ operator=() [1/8]

ConfigString & operator= ( const std::string &  s)

Assigns a value to this object.

Parameters
sString value.

Definition at line 21 of file ConfigString.cpp.

◆ operator=() [2/8]

ConfigString & operator= ( const char *  s)

Assigns a value to this object.

Parameters
sString literal value.

Definition at line 29 of file ConfigString.cpp.

◆ operator=() [3/8]

ConfigString & operator= ( int  i)

Assigns a value to this object.

Parameters
iString value, as an integer.

Definition at line 37 of file ConfigString.cpp.

◆ operator=() [4/8]

ConfigString & operator= ( unsigned int  i)

Assigns a value to this object.

Parameters
iString value, as an unsigned integer.

Definition at line 45 of file ConfigString.cpp.

◆ operator=() [5/8]

ConfigString & operator= ( long  l)

Assigns a value to this object.

Parameters
lString value, as a long integer.

Definition at line 53 of file ConfigString.cpp.

◆ operator=() [6/8]

ConfigString & operator= ( bool  b)

Assigns a value to this object.

Parameters
bString value, as a Boolean value.

Definition at line 61 of file ConfigString.cpp.

◆ operator=() [7/8]

ConfigString & operator= ( float  f)

Assigns a value to this object.

Parameters
fString value, as a floating-point value.

Definition at line 69 of file ConfigString.cpp.

◆ operator=() [8/8]

ConfigString & operator= ( double  f)

Assigns a value to this object.

Parameters
fString value, as a double floating-point value.

Definition at line 77 of file ConfigString.cpp.


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