CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
DynamicString.hpp
1 #pragma once
3 namespace CYB {
4  namespace API {
5  namespace String {
7  class Dynamic : public CStyle {
8  private:
18  static char* CopyCStyle(const CStyle& AData, int ALength);
19 
29  static Dynamic MakeNumberString(const unsigned long long AValue, const bool ANegative);
30 
36  void DeallocateData(void);
37  protected:
45  static Dynamic FromData(char* const AData) noexcept;
46 
53  Dynamic(char* const AData) noexcept;
54  public:
66  template <typename ALambda> static bool BuildAndPopulateBuffer(const int ASize, const ALambda APopulateData, Dynamic& ADynamic);
67 
73  Dynamic() noexcept;
81  Dynamic(const unsigned long long AValue);
89  Dynamic(const long long AValue);
98  Dynamic(const char* const AData, const int ALength = -1);
107  Dynamic(const CStyle& AData, const int ALength = -1);
113  Dynamic(const Dynamic& ACopy);
114  Dynamic(Dynamic&& AMove) noexcept;
115  Dynamic& operator=(Dynamic&& AMove) noexcept;
116  ~Dynamic();
117 
126  Dynamic operator+(const CStyle& ARHS) const;
135  Dynamic& operator+=(const CStyle& ARHS);
145  Dynamic SubString(const int AIndex, const int ALength) const;
154  Container::Deque<Dynamic> Tokenize(const char ASeparator) const;
155 
162  virtual void Shrink(const int AMaxBytes) noexcept;
163 
165  int Length(void) const noexcept override;
166  };
167  };
168  };
169 };
static Dynamic MakeNumberString(const unsigned long long AValue, const bool ANegative)
Allocates data for a string that represents AValue.
Container::Deque< Dynamic > Tokenize(const char ASeparator) const
Split the string into a Deque of other strings based on a seperator.
Dynamic & operator+=(const CStyle &ARHS)
Appends to a Dynamic string in place.
~Dynamic()
Frees allocated string.
Dynamic SubString(const int AIndex, const int ALength) const
Get a substring of the contained string.
virtual void Shrink(const int AMaxBytes) noexcept
Move the null terminator of the string so that the readable length is AMaxBytes.
static char * CopyCStyle(const CStyle &AData, int ALength)
Allocates data for and initializes a copy of a CStyle string.
Used for string of allocated variable length.
Dynamic & operator=(Dynamic &&AMove) noexcept
See Default Constructors and Destructor.
std::deque< AType, Interop::STLAllocator< AType >> Deque
std::deque algorithms using the CyberEngine's allocator
Definition: Containers.hpp:10
A basic char contained string.
Definition: CStyleString.hpp:7
static Dynamic FromData(char *const AData) noexcept
Construct a Dynamic string from a pre-allocated char array.
Dynamic() noexcept
Construct an empty Dynamic string.
static bool BuildAndPopulateBuffer(const int ASize, const ALambda APopulateData, Dynamic &ADynamic)
Allocate a char array that is ASize bytes in length. Call APopulateData with the char array as a para...
void DeallocateData(void)
Frees the data of the current string.
int Length(void) const noexceptoverride
Get the number of characters in the contained string. The definition of character may change in deriv...
Dynamic operator+(const CStyle &ARHS) const
Appends to a Dynamic string and returns a new one.