ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
T_CharArray< TString, TChar, TEnableIf > Struct Template Reference

Description:

template<typename TString, typename TChar, typename TEnableIf = void>
struct alib::characters::T_CharArray< TString, TChar, TEnableIf >

This type provides type traits for character arrays. Specializations of this struct for a custom type TString , expose information about that type representing a character array and how the array data may be accessed.
In addition, information about how the type may be constructed from character array data may be provided with specializations of this type.

See also
For detailed information, see chapter 4. Character Arrays of the Programmer's Manual of module ALib Characters .
Template Parameters
TStringThe type for which specializations of this struct provide array type traits.
TCharThe character type of the character array that specializations provide type traits for.
TEnableIfOptional TMP parameter to allow templated and/or selective specializations.

Definition at line 264 of file characters.hpp.

#include <characters.hpp>

Public Static Field Index:

static constexpr AccessType Access = AccessType::NONE
 
static constexpr ConstructionType Construction = ConstructionType::NONE
 

Public Static Method Index:

static const TChar * Buffer (const TString &src)
 
static TString Construct (const TChar *array, integer length)
 
static integer Length (const TString &src)
 

Field Details:

◆ Access

template<typename TString , typename TChar , typename TEnableIf = void>
constexpr AccessType Access = AccessType::NONE
staticconstexpr

Provides information about how the character array data of instances of type TString may be accessed

Definition at line 268 of file characters.hpp.

◆ Construction

template<typename TString , typename TChar , typename TEnableIf = void>
constexpr ConstructionType Construction = ConstructionType::NONE
staticconstexpr

Provides information about if and how instances of type TString may be created from character array data.

Definition at line 272 of file characters.hpp.

Method Details:

◆ Buffer()

template<typename TString , typename TChar , typename TEnableIf = void>
static const TChar * Buffer ( const TString & src)
static

In specialized versions, this method has to be provided in case that field Access is not equal to AccessType::NONE . In addition to this static method, sibling method Length has to be provoided.

For example, in a specialization for standard C++ class std::string, this method returns the result of method std::string::data().

Note, that in the case of access type AccessType::MutableOnly , the signature of this method needs to be slightly different with the specialization: argument src in this case must be of type TString&, hence must not be const.

Parameters
srcThe source object of external type TString .
Returns
Specializatins have to return a pointer to the start of the character array represented by the given object src of type TString .

◆ Construct()

template<typename TString , typename TChar , typename TEnableIf = void>
static TString Construct ( const TChar * array,
integer length )
static

In specialized versions, this method has to be provided in case that field Construction is not equal to ConstructionType::NONE .

If so, this method needs to construct and return an instance of type TString , created from the character array specified by arguments array and length

Parameters
arrayThe external array to be used to create the return value.
lengthThe length of the external array.
Returns
A new instance (value) of type TString .

◆ Length()

template<typename TString , typename TChar , typename TEnableIf = void>
static integer Length ( const TString & src)
static

In specialized versions, this method has to be provided in case that field Access is not equal to AccessType::NONE . In addition to this static method, sibling method Buffer has to be provoided.

For example, in a specialization for standard C++ class std::string, this method returns the result of method std::string::size().

Note, that in the case of access type AccessType::MutableOnly , the signature of this method needs to be slightly different with the specialization: argument src in this case must be of type TString&, hence must not be const.

Parameters
srcThe source object of external type TString .
Returns
Specializatins have to return the length of the character array represented by the given object src of type TString .

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