ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
adtf_string< T >

Wrapping template for a rvalue reference of an IString interface for the type T (see Supported types for adtf_string<T> for writing and reading strings via interface IString). More...

#include <string_intf.h>

Inheritance diagram for adtf_string< T >:
[legend]

Public Member Functions

 adtf_string (value_type *pstrAssignValue)
 CTOR with pointer to the value of value_type.
 
 ~adtf_string ()
 DTOR.
 
tResult Set (const char *strValue) override
 Sets the given null-terminated string to the implementation.
 
const char * Get () const override
 Gets the pointer to the current associated nullterminated-string.
 
size_t GetLength () const override
 Gets the current size of the strng.
 

Private Types

typedef adtf_string< T > self_type
 self type
 
typedef T value_type
 value type
 
typedef adtf_string_forward< T > base_type
 base type
 

Private Member Functions

 adtf_string ()=delete
 CTOR.
 
 adtf_string (const adtf_string &strValue)=delete
 copy CTOR
 
 adtf_string (adtf_string &&strValue)=delete
 move CTOR
 
adtf_stringoperator= (const adtf_string &strValue)=delete
 copy operator
 
adtf_stringoperator= (adtf_string &&strValue)=delete
 move operator
 

Private Attributes

value_typem_pAssignValue
 pointer to the value
 

Additional Inherited Members

- Static Public Attributes inherited from IString
static constexpr size_t InvalidPos = g_npos
 Invalid Position size.
 
- Static Protected Member Functions inherited from adtf_string_forward< T >
static const char * GetConstChar (const T *const pValue)
 Retrieves a const char pointer (null-terminated).
 
static size_t GetCurrentLength (const T *const pValue)
 Retrieves the string size of the given pValue.
 
static tResult SetValue (T *const pValue, const char *strValue)
 Sets the given strValue to the string type implementation of the given pValue.
 

Detailed Description

template<typename T>
class adtf::base::ant::adtf_string< T >

Wrapping template for a rvalue reference of an IString interface for the type T (see Supported types for adtf_string<T> for writing and reading strings via interface IString).

Usually the IString is given as rvalue reference to a function call. This template used adtf_string_forward for special types.

Template Parameters
TThe String implementation to wrap into IString.

Definition at line 194 of file string_intf.h.

Member Typedef Documentation

◆ base_type

template<typename T>
typedef adtf_string_forward<T> base_type
private

base type

Definition at line 202 of file string_intf.h.

◆ self_type

template<typename T>
typedef adtf_string<T> self_type
private

self type

Definition at line 198 of file string_intf.h.

◆ value_type

template<typename T>
typedef T value_type
private

value type

Definition at line 200 of file string_intf.h.

Constructor & Destructor Documentation

◆ adtf_string() [1/3]

template<typename T>
adtf_string ( const adtf_string< T > & strValue)
privatedelete

copy CTOR

Parameters
[in]strValueinitial value

References adtf_string().

◆ adtf_string() [2/3]

template<typename T>
adtf_string ( adtf_string< T > && strValue)
privatedelete

move CTOR

Parameters
[in]strValueinitial value

References adtf_string().

◆ adtf_string() [3/3]

template<typename T>
adtf_string ( value_type * pstrAssignValue)
inlineexplicit

CTOR with pointer to the value of value_type.

Parameters
pstrAssignValue[in] pointer to the value

Definition at line 226 of file string_intf.h.

References m_pAssignValue.

◆ ~adtf_string()

template<typename T>
~adtf_string ( )
inline

DTOR.

Definition at line 231 of file string_intf.h.

References m_pAssignValue.

Member Function Documentation

◆ Get()

template<typename T>
const char * Get ( ) const
inlineoverridevirtual

Gets the pointer to the current associated nullterminated-string.

Returns
The pointer to the null-terminated string.
Remarks
Check the pointer, because it depends on the implementation of IString!

Implements IString.

Definition at line 246 of file string_intf.h.

References adtf_string_forward< T >::GetConstChar(), and m_pAssignValue.

◆ GetLength()

template<typename T>
size_t GetLength ( ) const
inlineoverridevirtual

Gets the current size of the strng.

Usually this is in Bytes (null-termination is not included!)

Returns
The size of the string.
Return values
Ifnot valid return InvalidPos!

Implements IString.

Definition at line 255 of file string_intf.h.

References adtf_string_forward< T >::GetCurrentLength(), IString::InvalidPos, and m_pAssignValue.

◆ operator=() [1/2]

template<typename T>
adtf_string & operator= ( adtf_string< T > && strValue)
privatedelete

move operator

Parameters
[in]strValuevalue to move from
Returns
this

References adtf_string().

◆ operator=() [2/2]

template<typename T>
adtf_string & operator= ( const adtf_string< T > & strValue)
privatedelete

copy operator

Parameters
[in]strValuevalue to copy from
Returns
this

References adtf_string().

◆ Set()

template<typename T>
tResult Set ( const char * strValue)
inlineoverridevirtual

Sets the given null-terminated string to the implementation.

Parameters
strValue[in] The null-terminated string to set.
Return values
ERR_NOERRORThe value is set successfully
ERR_MEMORYThe value can not be set. Too long. No truncating provided.

Implements IString.

Definition at line 235 of file string_intf.h.

References m_pAssignValue, RETURN_ERROR, and adtf_string_forward< T >::SetValue().

Member Data Documentation

◆ m_pAssignValue

template<typename T>
value_type* m_pAssignValue
private

pointer to the value

Definition at line 206 of file string_intf.h.

Referenced by adtf_string(), ~adtf_string(), Get(), GetLength(), and Set().