API Documentation
String.h
1 // String.h
3 //
5 
6 namespace nkMemory
7 {
21  class String final
22  {
23  public :
24 
29  String () noexcept ;
36  String (const char* data) noexcept ;
43  String (unsigned long long size) noexcept ;
52  String (const char* data, unsigned long long size) noexcept ;
59  String (StringView view) noexcept ;
65  String (const String& other) noexcept ;
71  String (String&& other) noexcept ;
75  ~String () ;
76 
77  // Getters
81  char* getData () const ;
85  unsigned long long getSize () const ;
89  bool empty () const ;
93  char front () const ;
97  char& front () ;
101  char back () const ;
105  char& back () ;
109  const char* begin () const ;
113  char* begin () ;
117  const char* end () const ;
121  char* end () ;
122 
123  // Management
127  void clear () ;
134  void resize (unsigned long long size) ;
135 
136  // Utils
144 
145  // Operators
151  String& operator= (const char* data) noexcept ;
157  String& operator= (StringView other) noexcept ;
163  String& operator= (const String& other) noexcept ;
169  String& operator= (String&& other) noexcept ;
175  char operator[] (unsigned long long index) const ;
181  char& operator[] (unsigned long long index) ;
187  void operator+= (char value) ;
193  void operator+= (StringView other) ;
200  String operator+ (char c) const ;
207  String operator+ (const char* other) const ;
214  String operator+ (StringView other) const ;
221  bool operator== (const char* other) const ;
228  bool operator== (StringView other) const ;
235  bool operator!= (const char* other) const ;
242  bool operator!= (StringView other) const ;
243 
244  public :
245 
246  // Inlined constructors
253  template<typename T = std::string>
254  String (const std::string& str) noexcept ;
261  template<typename T = std::string_view>
262  String (const std::string_view& str) noexcept ;
263 
264  public :
265 
266  // Inlined operators
270  operator std::string () const ;
274  operator std::string_view () const ;
278  operator nkLog::String () const ;
282  operator nkLog::StringView () const ;
283 
290  String& operator= (const std::string& data) ;
297  String& operator= (const std::string_view& data) ;
298  } ;
299 
307  inline bool operator== (const char* c, const nkMemory::String& str) ;
308 
316  inline nkMemory::String operator+ (char c, const nkMemory::String& str) ;
324  inline nkMemory::String operator+ (const char* c, const nkMemory::String& str) ;
325 }
nkMemory::String::end
const char * end() const
nkMemory::String::split
BufferCast< StringView > split(StringView separator)
nkMemory::String::back
char back() const
nkMemory::String::empty
bool empty() const
nkLog
Encompasses all API of component NilkinsLog.
Definition: String.h:7
nkMemory::String
Class holding information about a string, with ownership over the data.
Definition: String.h:22
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkMemory::String::String
String() noexcept
nkMemory::BufferCast
Holds a Buffer and make it easy to cast the binary data.
Definition: BufferCast.h:18
nkMemory::String::clear
void clear()
nkMemory::String::getData
char * getData() const
nkMemory::String::resize
void resize(unsigned long long size)
nkMemory::String::begin
const char * begin() const
nkMemory::String::getSize
unsigned long long getSize() const
nkMemory::String::front
char front() const
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7