20 #ifndef KERNEL_UTILITIES_STRING_H 21 #define KERNEL_UTILITIES_STRING_H 26 #include "pedigree/kernel/compiler.h" 27 #include "pedigree/kernel/processor/types.h" 28 #include "pedigree/kernel/utilities/StringView.h" 29 #include "pedigree/kernel/utilities/Vector.h" 30 #include "pedigree/kernel/utilities/template.h" 34 #define STRING_WITH_CONSTEXPR_CONSTRUCTOR 0 39 #define STRING_DISABLE_COPY_CONSTRUCTION 0 45 #define STRING_DISABLE_JIT_HASHING 0 55 String(
const char *s,
size_t length);
56 #if STRING_DISABLE_COPY_CONSTRUCTION 64 #if STRING_WITH_CONSTEXPR_CONSTRUCTOR 66 constexpr
String(
const char (&s)[N]);
69 String &operator=(String &&x);
70 #if !STRING_DISABLE_COPY_CONSTRUCTION 71 String &operator=(
const String &x);
72 String &operator=(
const char *s);
74 operator const char *()
const 76 if (m_Size == StaticSize)
89 String &operator+=(
const String &x);
90 String &operator+=(
const char *s);
110 uint32_t hash()
const;
117 size_t nextCharacter(
size_t c)
const;
121 size_t prevCharacter(
size_t c)
const;
141 String split(
size_t offset);
142 void split(
size_t offset, String &back);
153 static size_t Utf32ToUtf8(uint32_t utf32,
char *utf8);
155 void Format(
const char *format, ...)
FORMAT(printf, 2, 3);
157 void assign(
const String &x);
164 void assign(
const char *s,
size_t len = 0,
bool unsafe =
false);
165 void reserve(
size_t size);
169 bool endswith(
const char c)
const;
170 bool endswith(
const String &s)
const;
171 bool endswith(
const char *s,
size_t len = 0)
const;
174 bool startswith(
const char c)
const;
175 bool startswith(
const String &s)
const;
176 bool startswith(
const char *s,
size_t len = 0)
const;
179 ssize_t find(
const char c)
const;
180 ssize_t rfind(
const char c)
const;
192 void reserve(
size_t size,
bool zero);
194 char *extract()
const;
198 uint32_t computeHash()
const;
200 void move(String &&other);
202 static constexpr
const size_t StaticSize = 64;
212 char m_Static[StaticSize];
216 bool iswhitespace(
const char c)
const;
222 #if STRING_WITH_CONSTEXPR_CONSTRUCTOR 225 : m_Data(nullptr), m_ConstData(s), m_Length(N ? N - 1 : 0), m_Size(N),
A vector / dynamic array.
#define FORMAT(type, idx, first)
bool operator==(const Iterator< originalT, Struct, FunctionPrev, FunctionNext, T1 > &x1, const Iterator< originalT, Struct, FunctionPrev, FunctionNext, T2 > &x2)