ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Static Fields | Public Static Methods | List of all members
T_CharArray< TString, TChar, TEnableIf > Struct Template Reference

#include <characters.hpp>

Class Description

template<typename TString, typename TChar, typename TEnableIf = void>
struct aworx::lib::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 294 of file characters.hpp.

Public Static Fields

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

Public Static Methods

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

Member Function Documentation

◆ Buffer()

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()

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()

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.

Member Data Documentation

◆ Access

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 298 of file characters.hpp.

◆ Construction

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 302 of file characters.hpp.


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