ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::characters::ArrayTraits< TStringSource, TChar > Struct Template Reference

Description:

template<typename TStringSource, typename TChar>
struct alib::characters::ArrayTraits< TStringSource, TChar >

This type provides type-traits for character arrays. Specializations of this struct for a custom type TStringSource, 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
TStringSourceThe type for which specializations of this struct provide array type-traits.
TCharThe character type of the character array that specializations provide type-traits for.

Definition at line 62 of file chartraits.inl.

Public Static Field Index:

static constexpr Policy Access = Policy::NONE
 
static constexpr Policy Construction = Policy::NONE
 

Public Static Method Index:

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

Field Details:

◆ Access

template<typename TStringSource, typename TChar>
Policy alib::characters::ArrayTraits< TStringSource, TChar >::Access = Policy::NONE
staticconstexpr

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

Definition at line 66 of file chartraits.inl.

◆ Construction

template<typename TStringSource, typename TChar>
Policy alib::characters::ArrayTraits< TStringSource, TChar >::Construction = Policy::NONE
staticconstexpr

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

Definition at line 70 of file chartraits.inl.

Method Details:

◆ Buffer()

template<typename TStringSource, typename TChar>
const TChar * alib::characters::ArrayTraits< TStringSource, TChar >::Buffer ( const TStringSource & src)
static

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

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 Policy::MutableOnly, the signature of this method needs to be slightly different with the specialization: argument src in this case must be of type TStringSource&, hence must not be const.

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

◆ Construct()

template<typename TStringSource, typename TChar>
TStringSource alib::characters::ArrayTraits< TStringSource, TChar >::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 Policy::NONE.

If so, this method needs to construct and return an instance of type TStringSource, 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 TStringSource.

◆ Length()

template<typename TStringSource, typename TChar>
integer alib::characters::ArrayTraits< TStringSource, TChar >::Length ( const TStringSource & src)
static

In specialized versions, this method has to be provided in case that field Access is not equal to Policy::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 Policy::MutableOnly, the signature of this method needs to be slightly different with the specialization: argument src in this case must be of type TStringSource&, hence must not be const.

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

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