alternative Standard Libary  0.29.8
std::fixed_substring< E, N > Template-Klassenreferenz

#include <fixed_substring.hpp>

+ Klassendiagramm für std::fixed_substring< E, N >:
+ Zusammengehörigkeiten von std::fixed_substring< E, N >:

Öffentliche Typen

using value_type = E
 
using size_type = size_t
 

Öffentliche Methoden

 fixed_substring ()
 
 fixed_substring (const value_type *str)
 
template<size_t M>
 fixed_substring (const fixed_substring< E, M > &rhs)
 
template<size_t M>
fixed_substringoperator= (const fixed_substring< E, M > &rhs)
 
fixed_substringoperator= (const value_type *str)
 
const char * c_str () const
 
void assign (const value_type *str)
 
void assign (const fixed_substring &rhs)
 
void append (const value_type *str)
 
void append (const fixed_substring &rhs)
 
size_type find_index_of (value_type ch) const
 
size_type find_index_of_last (value_type ch) const
 
void trim_end (size_type index)
 
bool empty () const
 
size_type length () const
 
bool operator== (const fixed_substring &rhs) const
 
bool operator!= (const fixed_substring &rhs) const
 

Private Methoden

void assign (const E &value)
 

Ausführliche Beschreibung

template<typename E, size_t N>
class std::fixed_substring< E, N >

Dokumentation der benutzerdefinierten Datentypen

◆ size_type

template<typename E , size_t N>
using std::fixed_substring< E, N >::size_type = size_t

◆ value_type

template<typename E , size_t N>
using std::fixed_substring< E, N >::value_type = E

Beschreibung der Konstruktoren und Destruktoren

◆ fixed_substring() [1/3]

template<typename E , size_t N>
std::fixed_substring< E, N >::fixed_substring ( )
inline
51  {
52  data()[0] = value_type(0);
53  }
iterator data()
Definition: array.hpp:86
E value_type
Definition: fixed_substring.hpp:47

◆ fixed_substring() [2/3]

template<typename E , size_t N>
std::fixed_substring< E, N >::fixed_substring ( const value_type str)
inlineexplicit
55  {
56  assign(str);
57  }
std::string str(T begin, T end)
Definition: utils.hpp:39
void assign(const value_type *str)
Definition: fixed_substring.hpp:85

◆ fixed_substring() [3/3]

template<typename E , size_t N>
template<size_t M>
std::fixed_substring< E, N >::fixed_substring ( const fixed_substring< E, M > &  rhs)
inline
60  {
61  assign(rhs.data());
62  }
void assign(const value_type *str)
Definition: fixed_substring.hpp:85

Dokumentation der Elementfunktionen

◆ append() [1/2]

template<typename E , size_t N>
void std::fixed_substring< E, N >::append ( const value_type str)
inline
99  {
100  const size_type strLen = (size_type)std::strlen(str);
101  const size_type ourLen = (size_type)std::strlen(data());
102  size_type toAppend = strLen;
103  if (ourLen + toAppend > N)
104  toAppend = N - ourLen;
105  Sys::MemCpy(data() + ourLen, str, toAppend * sizeof(value_type));
106  data()[ourLen + toAppend] = value_type(0);
107  }
iterator data()
Definition: array.hpp:86
size_t size_type
Definition: fixed_substring.hpp:48
E value_type
Definition: fixed_substring.hpp:47
static void MemCpy(void *to, const void *from, size_t bytes)
Definition: PLATFORM.cpp:39
std::string str(T begin, T end)
Definition: utils.hpp:39

◆ append() [2/2]

template<typename E , size_t N>
void std::fixed_substring< E, N >::append ( const fixed_substring< E, N > &  rhs)
inline
109  {
110  append(rhs.data());
111  }
void append(const value_type *str)
Definition: fixed_substring.hpp:98

◆ assign() [1/2]

template<typename E , size_t N>
void std::fixed_substring< E, N >::assign ( const value_type str)
inline
86  {
87  assert(str != data());
88  const size_type len = (size_type)std::strlen(str);
89  const size_type toCopy = len < N ? len : N;
90  Sys::MemCpy(data(), str, toCopy * sizeof(value_type));
91  data()[toCopy] = value_type(0);
92  }
iterator data()
Definition: array.hpp:86
size_t size_type
Definition: fixed_substring.hpp:48
E value_type
Definition: fixed_substring.hpp:47
static void MemCpy(void *to, const void *from, size_t bytes)
Definition: PLATFORM.cpp:39
std::string str(T begin, T end)
Definition: utils.hpp:39

◆ assign() [2/2]

template<typename E , size_t N>
void std::fixed_substring< E, N >::assign ( const fixed_substring< E, N > &  rhs)
inline
94  {
95  assign(rhs.data());
96  }
void assign(const value_type *str)
Definition: fixed_substring.hpp:85

◆ c_str()

template<typename E , size_t N>
const char* std::fixed_substring< E, N >::c_str ( ) const
inline
81  {
82  return data();
83  }
iterator data()
Definition: array.hpp:86

◆ empty()

template<typename E , size_t N>
bool std::fixed_substring< E, N >::empty ( ) const
inline
154  {
155  return length() == 0;
156  }
size_type length() const
Definition: fixed_substring.hpp:157

◆ find_index_of()

template<typename E , size_t N>
size_type std::fixed_substring< E, N >::find_index_of ( value_type  ch) const
inline
114  {
115  size_type retIndex(-1);
116  const E* ptr = data();
117  size_type currentIndex(0);
118  while (*ptr != value_type(0))
119  {
120  if (*ptr == ch)
121  {
122  retIndex = currentIndex;
123  break;
124  }
125  ++ptr;
126  ++currentIndex;
127  }
128  return retIndex;
129  }
iterator data()
Definition: array.hpp:86
size_t size_type
Definition: fixed_substring.hpp:48
E value_type
Definition: fixed_substring.hpp:47

◆ find_index_of_last()

template<typename E , size_t N>
size_type std::fixed_substring< E, N >::find_index_of_last ( value_type  ch) const
inline
131  {
132  size_type retIndex(-1);
133  const value_type* ptr = data();
134  size_type currentIndex(0);
135  while (*ptr != value_type(0))
136  {
137  if (*ptr == ch)
138  retIndex = currentIndex;
139  ++ptr;
140  ++currentIndex;
141  }
142  return retIndex;
143  }
iterator data()
Definition: array.hpp:86
size_t size_type
Definition: fixed_substring.hpp:48
E value_type
Definition: fixed_substring.hpp:47

◆ length()

template<typename E , size_t N>
size_type std::fixed_substring< E, N >::length ( ) const
inline
158  {
159  return std::strlen(data());
160  }
iterator data()
Definition: array.hpp:86

◆ operator!=()

template<typename E , size_t N>
bool std::fixed_substring< E, N >::operator!= ( const fixed_substring< E, N > &  rhs) const
inline
167  {
168  return !(*this == rhs);
169  }

◆ operator=() [1/2]

template<typename E , size_t N>
template<size_t M>
fixed_substring& std::fixed_substring< E, N >::operator= ( const fixed_substring< E, M > &  rhs)
inline
66  {
67  assign(rhs.data());
68  return *this;
69  }
void assign(const value_type *str)
Definition: fixed_substring.hpp:85

◆ operator=() [2/2]

template<typename E , size_t N>
fixed_substring& std::fixed_substring< E, N >::operator= ( const value_type str)
inline
71  {
72  assign(str);
73  return *this;
74  }
std::string str(T begin, T end)
Definition: utils.hpp:39
void assign(const value_type *str)
Definition: fixed_substring.hpp:85

◆ operator==()

template<typename E , size_t N>
bool std::fixed_substring< E, N >::operator== ( const fixed_substring< E, N > &  rhs) const
inline
163  {
164  return std::strcompare(data(), rhs.data()) == 0;
165  }
iterator data()
Definition: array.hpp:86

◆ trim_end()

template<typename E , size_t N>
void std::fixed_substring< E, N >::trim_end ( size_type  index)
inline
145  {
146  if (index >= 0)
147  {
148  assert(index < (size_type)std::strlen(data()));
149  data()[index] = value_type(0);
150  }
151  }
iterator data()
Definition: array.hpp:86
size_t size_type
Definition: fixed_substring.hpp:48
E value_type
Definition: fixed_substring.hpp:47

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: