8#ifndef HPP_ALIB_STRINGS_CHARARRAYTRAITS
9#define HPP_ALIB_STRINGS_CHARARRAYTRAITS 1
11#if !defined(HPP_ALIB_STRINGS_STRING)
12# error "ALib sources with ending '.inl' must not be included from outside."
16namespace alib {
namespace strings {
19template<
typename TChar>
struct T_SuppressAutoCast<TAString<TChar>, characters::ConstructionType::Implicit, TCString<TChar> > :
public std::true_type {};
20template<
typename TChar>
struct T_SuppressAutoCast<TAString<TChar>, characters::ConstructionType::Implicit, TSubstring<TChar> > :
public std::true_type {};
21template<
typename TChar>
struct T_SuppressAutoCast<TCString<TChar>, characters::ConstructionType::Implicit, TSubstring<TChar> > :
public std::true_type {};
26}
namespace characters {
28template<
typename TChar>
struct T_CharArray<strings::TString<TChar>, TChar>
31 static constexpr const TChar*
Buffer (
const strings::TString<TChar>& src) {
return src.Buffer(); }
32 static constexpr integer Length (
const strings::TString<TChar>& src) {
return src.Length(); }
35 static constexpr strings::TString<TChar>
Construct(
const TChar* array,
integer length) {
return strings::TString<TChar>(array, length); }
38template<
typename TChar>
struct T_CharArray<strings::TSubstring<TChar>, TChar>
41 static constexpr const TChar*
Buffer(
const strings::TSubstring<TChar>& src) {
return src.Buffer(); }
42 static constexpr integer Length(
const strings::TSubstring<TChar>& src) {
return src.Length(); }
45 static constexpr strings::TSubstring<TChar>
Construct(
const TChar* array,
integer length) {
return strings::TSubstring<TChar>(array, length); }
48template<
typename TChar>
struct T_CharArray<strings::TCString<TChar>, TChar>
51 static constexpr const TChar*
Buffer(
const strings::TCString<TChar>& src) {
return src.Buffer(); }
52 static constexpr integer Length(
const strings::TCString<TChar>& src) {
return src.Length(); }
55 static constexpr strings::TCString<TChar>
Construct(
const TChar* array,
integer length){
return strings::TCString<TChar>(array, length); }
59template<
typename TChar>
struct T_CharArray<strings::TAString<TChar>, TChar>
62 static constexpr const TChar*
Buffer(
const strings::TAString<TChar>& src) {
return src.Buffer(); }
63 static constexpr integer Length(
const strings::TAString<TChar>& src) {
return src.Length(); }
66 static constexpr strings::TAString<TChar>
Construct(
const TChar* array,
integer length){
return strings::TAString<TChar>().Append(array, length); }
69template<
typename TChar,
integer TCapacity>
70struct T_CharArray<strings::TLocalString<TChar,TCapacity>, TChar>
73 static constexpr const TChar*
Buffer(
const strings::TLocalString<TChar, TCapacity>& src) {
return src.Buffer(); }
74 static constexpr integer Length(
const strings::TLocalString<TChar, TCapacity>& src) {
return src.Length(); }
79template<
typename TChar>
struct T_CharArray<strings::TStringNZT<TChar>, TChar>
82 static constexpr const TChar*
Buffer (
const strings::TString<TChar>& src) {
return src.Buffer(); }
83 static constexpr integer Length (
const strings::TString<TChar>& src) {
return src.Length(); }
93template<
typename TChar>
struct T_ZTCharArray<strings::TString<TChar>, TChar>
96 static constexpr const TChar*
Buffer(
const strings::TString<TChar>& src) {
return src.Buffer(); }
97 static constexpr integer Length(
const strings::TString<TChar>& src) {
return src.Length(); }
100 static constexpr strings::TString<TChar>
Construct(
const TChar* array,
integer length ) {
return strings::TString<TChar>(array, length); }
103template<
typename TChar>
struct T_ZTCharArray<strings::TSubstring<TChar>, TChar>
106 static constexpr const TChar*
Buffer(
const strings::TSubstring<TChar>& src) {
return src.Buffer(); }
107 static constexpr integer Length(
const strings::TSubstring<TChar>& src) {
return src.Length(); }
110 static constexpr strings::TSubstring<TChar>
Construct(
const TChar* array,
integer length ) {
return strings::TSubstring<TChar>(array, length); }
114template<
typename TChar>
struct T_ZTCharArray<strings::TCString<TChar>, TChar>
117 static constexpr const TChar*
Buffer(
const strings::TCString<TChar>& src) {
return src.Buffer(); }
118 static constexpr integer Length(
const strings::TCString<TChar>& src) {
return src.Length(); }
121 static constexpr strings::TCString<TChar>
Construct(
const TChar* array,
integer length ) {
return strings::TCString<TChar>(array, length); }
125template<
typename TChar>
struct T_ZTCharArray<strings::TAString<TChar>, TChar>
128 static constexpr const TChar*
Buffer(
const strings::TAString<TChar>& src) {
return src.Terminate(); }
129 static constexpr integer Length(
const strings::TAString<TChar>& src) {
return src.Length(); }
132 static constexpr strings::TAString<TChar>
Construct(
const TChar* array,
integer length ) {
return strings::TAString<TChar>().Append(array, length); }
135template<
typename TChar,
integer TCapacity>
136struct T_ZTCharArray<strings::TLocalString<TChar,TCapacity>, TChar>
139 static constexpr const TChar*
Buffer(
const strings::TLocalString<TChar, TCapacity>& src) {
return src.Terminate(); }
140 static constexpr integer Length(
const strings::TLocalString<TChar, TCapacity>& src) {
return src.Length(); }
lang::integer integer
Type alias in namespace alib.
static const TChar * Buffer(const TString &src)
static constexpr ConstructionType Construction
static TString Construct(const TChar *array, integer length)
static constexpr AccessType Access
static integer Length(const TString &src)
static const TChar * Buffer(const TString &src)
static TString Construct(const TChar *array, integer length)
static integer Length(const TString &src)