13 #include "adtf_base_type_traits.h"
45 virtual const char*
Get()
const = 0;
74 static_assert(penguin::detail::always_false<T>,
75 "Unsupported type T! See documentation which types are supported."
76 "adtf_string<T> only supports std::string and adtf_util::cString types unless you specialize the adtf_string_forward<T> for the type T!");
86 static_assert(penguin::detail::always_false<T>,
87 "Unsupported type T! See documentation which types are supported."
88 "adtf_string<T> only supports std::string and adtf_util::cString types unless you specialize the adtf_string_forward<T> for the type T!");
103 static_assert(penguin::detail::always_false<T>,
104 "Unsupported type T! See documentation which types are supported."
105 "adtf_string<T> only supports std::string and adtf_util::cString types unless you specialize the adtf_string_forward<T> for the type T!");
119 return pValue->c_str();
124 return static_cast<size_t>(pValue->length());
129 pValue->assign(strValue);
142 return pValue->GetPtr();
146 return static_cast<size_t>(pValue->GetLength());
150 pValue->Set(strValue);
170 static const char*
GetConstChar(
const char*
const pValue)
176 return static_cast<size_t>(adtf_util::cStringUtil::GetLength(pValue));
193 template <
typename T>
237 if (strValue !=
nullptr)
246 const char*
Get()
const override
248 const char* strValue =
"";
286 m_nSize = std::strlen(m_strValue);
292 const char*
Get()
const override
298 const char* m_strValue;
299 mutable std::optional<size_t> m_nSize;
306 m_fnForward(std::move(fnForward))
320 const char*
Get()
const override
331 using ant::adtf_string_forward;
332 using ant::adtf_string;
335 using spider::cStringRedirect;
371 #define adtf_string_intf( __string__) ::adtf::base::adtf_string<typename std::remove_reference<decltype(__string__)>::type>(& (__string__))
375 #define adtf_char_intf( __const_char_ptr__) ::adtf::base::adtf_string<const char>(__const_char_ptr__)
Copyright © Audi Electronics Venture GmbH.
constexpr tSize g_npos
npos size declaration
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
A common result class usable as return value throughout.
The IString interface provides methods for getting and setting strings through abstract interfaces.
virtual const char * Get() const =0
Gets the pointer to the current associated nullterminated-string.
static constexpr size_t InvalidPos
Invalid Position size.
virtual size_t GetLength() const =0
Gets the current size of the strng.
virtual tResult Set(const char *strValue)=0
Sets the given null-terminated string to the implementation.
Wrapping template for a rvalue reference of an IString interface for the type T (see Supported types ...
tResult Set(const char *strValue) override
Sets the given null-terminated string to the implementation.
adtf_string(adtf_string &&strValue)=delete
move CTOR
adtf_string(value_type *pstrAssignValue)
CTOR with pointer to the value of value_type.
value_type * m_pAssignValue
pointer to the value
adtf_string(const adtf_string &strValue)=delete
copy CTOR
adtf_string< T > self_type
self type
size_t GetLength() const override
Gets the current size of the strng.
adtf_string & operator=(const adtf_string &strValue)=delete
copy operator
adtf_string()=delete
CTOR.
adtf_string_forward< T > base_type
base type
const char * Get() const override
Gets the pointer to the current associated nullterminated-string.
adtf_string & operator=(adtf_string &&strValue)=delete
move operator
tResult Set(const char *) override
Sets the given null-terminated string to the implementation.
size_t GetLength() const override
Gets the current size of the strng.
const char * Get() const override
Gets the pointer to the current associated nullterminated-string.
tResult Set(const char *strValue) override
Sets the given null-terminated string to the implementation.
size_t GetLength() const override
Gets the current size of the strng.
const char * Get() const override
Gets the pointer to the current associated nullterminated-string.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Namespace for entire ADTF SDK.
static tResult SetValue(std::string *const pValue, const char *strValue)
Sets the given strValue to the string type implementation of the given pValue.
static size_t GetCurrentLength(const std::string *const pValue)
Retrieves the string size of the given pValue.
static const char * GetConstChar(const std::string *const pValue)
Retrieves a const char pointer (null-terminated).
Implementation concept template for user defined adtf_string type support (see Supported types for ad...
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.