12GX_CORE_NAMESPACE_BEGIN()
29 static constexpr u32 MARGIN_LENGTH = 115;
35 static constexpr u32 LENGTH_MAX = 0x0FFFFFFF;
49 static constexpr u32 NUM_SJIS_FAST_TABLE = 22;
51 static const u32 SJIS_FAST_TABLE[NUM_SJIS_FAST_TABLE][2];
53 static constexpr u32 NUM_UTF8_UTF16_TABLE = 3557;
55 static constexpr u32 NUM_HALF_KANA = 63;
57 static const u8 SJIS_UTF8_UTF16_TABLE[NUM_UTF8_UTF16_TABLE][
static_cast<s32
>(CODE::MAX)][3];
60 static constexpr s32 FTOA_DEFAULT = -2;
62 static constexpr s32 FTOA_REAL = -1;
64 static constexpr s32 FTOA_INT = 0;
73 GxString(
void) : _pString(nullptr), _allocSize(0){ setString(
""); }
75 GX_FORCE_INLINE
GxString(
const GxString&
string) : _pString(nullptr), _allocSize(0){ setString(
string._pString ?
string._pString :
""); }
77 GX_FORCE_INLINE
GxString(GX_CSTR
string) : _pString(nullptr), _allocSize(0){ setString(
string); }
81 GX_FORCE_INLINE
void clear(
void){ copyString(
""); }
90 GX_FORCE_INLINE
const GxString& operator = (GX_CSTR
string){ copyString(
string);
return *
this; }
92 GX_FORCE_INLINE
const GxString& operator = (
const GxString&
string){ copyString(
string._pString);
return *
this; }
94 GX_FORCE_INLINE
void operator += (GX_CCHAR character){ GX_CCHAR temporary[2] = {character,
'\0'}; concatenate(temporary); }
96 GX_FORCE_INLINE
void operator += (GX_CSTR
string){ concatenate(
string); }
98 GX_FORCE_INLINE
void operator += (
const GxString&
string){ concatenate(
string.getString()); }
104 GX_FORCE_INLINE
b32 operator == (GX_CSTR
string)
const {
return compare(
string) == 0; }
108 GX_FORCE_INLINE
b32 operator != (GX_CSTR
string)
const {
return compare(
string) != 0; }
121 static u32 getLength(GX_CSTR
string);
123 static u32 getLengthUtf8(GX_CSTR
string);
125 static u32 getLengthSjis(GX_CSTR
string);
127 static u32 getBytesUtf8(GX_CSTR
string);
129 static u32 getBytesSjis(GX_CSTR
string);
131 u32 getStartUtf8(u32 characterNum)
const;
133 u32 getStartSjis(u32 characterNum)
const;
135 static b32 isHalfUtf8(GX_CSTR
string);
137 static b32 isHalfSjis(GX_CSTR
string);
139 static b32 isHalfKanaUtf8(GX_CSTR
string);
141 static b32 isHalfKanaSjis(GX_CSTR
string);
143 static b32 isAscii(GX_CSTR
string);
145 static b32 isNumber(GX_CCHAR character);
147 static b32 isUnsignedInteger(GX_CSTR
string);
149 static b32 isSignedInteger(GX_CSTR
string);
151 static b32 isFloat(GX_CSTR
string);
153 static b32 isHexadecimal(GX_CSTR
string);
155 static b32 isBinaryDigit(GX_CSTR
string);
157 static b32 isWhiteSpace(GX_CCHAR character){
return (character == 0x20) || (character == 0x09); }
159 b32 isContain(GX_CSTR
string)
const;
161 b32 isStartsWith(GX_CSTR
string)
const;
163 b32 isEndsWith(GX_CSTR
string)
const;
165 GX_FORCE_INLINE GX_STR
getString(
void){
return _pString; }
167 constexpr GX_CSTR
getString(
void)
const {
return _pString; }
169 GX_FORCE_INLINE
void getLeft(
GxString& left, u32 length)
const { getSubString(left, 0, length); }
171 GX_FORCE_INLINE
void getRight(
GxString& right, u32 length)
const { getSubString(right, _length - length, length); }
173 void getSubString(
GxString& subString, u32 start, u32 length = LENGTH_MAX)
const;
176 static b32 decodeUnsignedInteger(GX_CSTR
string, u64& result);
178 static b32 decodeSignedInteger(GX_CSTR
string, s64& result);
180 static b32 decodeFloat(GX_CSTR
string, f64& result);
184 void getStringProperty(
void* pValue);
186 void setStringProperty(
const void* pValue);
195 s32 find(GX_CSTR
string, u32 start = 0,
b32 isIgnoreCase =
false)
const;
197 s32 find(GX_CHAR character, u32 start = 0,
b32 isIgnoreCase =
false)
const;
199 s32 findReverse(GX_CSTR
string, s32 start = -1,
b32 isIgnoreCase =
false)
const;
201 s32 findReverse(GX_CHAR character, s32 start = -1,
b32 isIgnoreCase =
false)
const;
203 s32 findUtf8(GX_CSTR
string, u32 start = 0)
const;
205 s32 findUtf8(GX_CHAR character, u32 start = 0)
const;
207 s32 findSjis(GX_CSTR
string, u32 start = 0)
const;
209 s32 findSjis(GX_CHAR character, u32 start = 0)
const;
211 u32 findCount(GX_CSTR
string, u32 start = 0,
b32 isIgnoreCase =
false)
const;
213 u32 findCount(GX_CHAR character, u32 start = 0,
b32 isIgnoreCase =
false)
const;
215 GX_FORCE_INLINE s32
compare(GX_CSTR
string)
const {
return compare(_pString,
string); }
219 static s32 compare(GX_CSTR string0, GX_CSTR string1);
225 static s32 icompare(GX_CSTR string0, GX_CSTR string1);
227 static GX_FORCE_INLINE s32
ncompare(GX_CSTR string0, GX_CSTR string1, u32 length){
return strncmp(string0, string1, length); }
229 static s32 nicompare(GX_CSTR string0, GX_CSTR string1, u32 length);
231 static GX_STR copy(GX_STR dst, GX_CSTR src);
233 static GX_STR ncopy(GX_STR dst, GX_CSTR src, u32 length);
235 static GX_STR concatenate(GX_STR dst, GX_CSTR src);
237 static GX_STR nconcatenate(GX_STR dst, GX_CSTR src, u32 length);
239 void insert(u32 start, GX_CSTR
string, u32 stringStart = 0, s32 stringLength = -1);
241 void eraseLeft(u32 length);
243 void eraseRight(u32 length);
245 void erase(u32 start, u32 length = LENGTH_MAX);
249 void trimStart(
void);
254 static void itoa(s64 value, GX_STR
string);
256 static void uitoa(u64 value, GX_STR
string);
258 static void ftoa(f64 value, GX_STR
string, s32 figure = -2);
260 static void uitoh(u64 value, GX_STR
string, u32 figure);
262 static void uitob(u64 value, GX_STR
string, u32 figure);
264 static s64 atoi(GX_CSTR
string);
266 static u64 atoui(GX_CSTR
string);
268 static f64 atof(GX_CSTR
string);
270 static u64 htoui(GX_CSTR
string);
272 static u64 btoui(GX_CSTR
string);
274 static GX_FORCE_INLINE GX_CHAR
utol(GX_CHAR character) {
return (
'Z' >= character && character >=
'A') ? (character + 0x20) : character; }
276 static GX_FORCE_INLINE GX_CHAR
ltou(GX_CHAR character) {
return (
'z' >= character && character >=
'a') ? (character - 0x20) : character; }
278 static void sjisToUtf8(GX_CSTR sjis, GX_STR utf8);
280 static void utf8ToSjis(GX_CSTR utf8, GX_STR sjis);
286 const GxString& format(GX_CSTR format, ...);
290 void replace(GX_CSTR oldString, GX_CSTR newString);
292 void replaceUtf8(GX_CSTR oldString, GX_CSTR newString);
294 void replaceSjis(GX_CSTR oldString, GX_CSTR newString);
296 void paddingLeft(u32 totalWidth, GX_CHAR paddingCharacter =
' ');
298 void paddingRight(u32 totalWidth, GX_CHAR paddingCharacter =
' ');
302 static s32 vsnprintfUtf8(GX_STR str, s32 bufferSize, GX_CSTR format, va_list ap);
304 const GxString& formatUtf8(GX_CSTR format, ...);
309 void setString(GX_CSTR
string);
311 void concatenate(GX_CSTR
string);
313 void copyString(GX_CSTR
string);
315 void deleteString(
void);
326 GX_CHAR _marginString[MARGIN_LENGTH + 1];
360 GxTokenizer(GX_CSTR
string, GX_CHAR delimiter,
b32 copyFlag =
true);
362 void initialize(GX_CSTR
string, GX_CHAR delimiter,
b32 copyFlag =
true);
366 constexpr void setIgnore(GX_CHAR character){ _ignore = character; }
402 u32 getCurrentLength(
void);
404 b32 isDelimiter(GX_CHAR character);
456 GxStringW(
void) : _pString(
nullptr), _allocSize(0){ setString(
L""); }
460 GxStringW(GX_CWSTR
string) : _pString(nullptr), _allocSize(0){ setString(
string); }
464 GX_FORCE_INLINE
void clear(
void){ copyString(
L""); }
477 GX_FORCE_INLINE
void operator += (GX_CWCHAR character){ GX_CWCHAR temporary[2] = {character, 0x0000}; concatenate(temporary); }
479 GX_FORCE_INLINE
void operator += (GX_CWSTR
string){ concatenate(
string); }
504 GX_FORCE_INLINE GX_WSTR
getString(
void){
return _pString; }
506 constexpr GX_CWSTR
getString(
void)
const {
return _pString; }
529 s32
find(GX_CWSTR
string, u32 start = 0)
const;
531 s32
find(GX_WCHAR character, u32 start = 0)
const;
533 s32
findReverse(GX_WCHAR character, s32 start = -1)
const;
535 GX_FORCE_INLINE s32
compare(GX_CWSTR
string)
const {
return compare(_pString,
string); }
539 static s32
compare(GX_CWSTR string0, GX_CWSTR string1);
545 static s32
icompare(GX_CWSTR string0, GX_CWSTR string1);
547 static void itoa(s64 value, GX_WSTR
string);
549 static void uitoa(u64 value, GX_WSTR
string);
551 static s64
atoi(GX_CWSTR
string);
553 static u64
atoui(GX_CWSTR
string);
555 static GX_FORCE_INLINE GX_WCHAR
utol(GX_WCHAR character) {
return (
L'Z' >= character && character >=
L'A') ? (character + 0x20) : character; }
557 static GX_FORCE_INLINE GX_WCHAR
ltou(GX_WCHAR character) {
return (
L'z' >= character && character >=
L'a') ? (character - 0x20) : character; }
559 static void sjisToUtf16(GX_CSTR sjis, GX_WSTR utf16);
561 static void utf16ToSjis(GX_CWSTR utf16, GX_STR sjis);
563 static void utf8ToUtf16(GX_CSTR utf8, GX_WSTR utf16);
565 static void utf16ToUtf8(GX_CWSTR utf16, GX_STR utf8);
577 void setString(GX_CWSTR
string);
579 void concatenate(GX_CWSTR
string);
581 void copyString(GX_CWSTR
string);
583 void deleteString(
void);
604#define GX_STRLEN(__STRING__) GxString::getLength(__STRING__)
606#define GX_WCSLEN(__STRING__) GxStringW::getLength(__STRING__)
608#define GX_STRCAT(__DST__, __SRC__) GxString::concatenate(__DST__, __SRC__)
610#define GX_STRNCAT(__DST__, __SRC__, __LENGTH__) GxString::nconcatenate(__DST__, __SRC__, __LENGTH__)
612#define GX_STRCPY(__DST__, __SRC__) GxString::copy(__DST__, __SRC__)
614#define GX_STRNCPY(__DST__, __SRC__, __LENGTH__) GxString::ncopy(__DST__, __SRC__, __LENGTH__)
616#define GX_STRCMP(__STRING0__, __STRING1__) GxString::compare(__STRING0__, __STRING1__)
618#define GX_STRICMP(__STRING0__, __STRING1__) GxString::icompare(__STRING0__, __STRING1__)
620#define GX_STRNCMP(__STRING0__, __STRING1__, __LENGTH__) GxString::ncompare(__STRING0__, __STRING1__, __LENGTH__)
622#define GX_STRNICMP(__STRING0__, __STRING1__, __LENGTH__) GxString::nicompare(__STRING0__, __STRING1__, __LENGTH__)
624#define GX_WSTRCMP(__STRING0__, __STRING1__) GxStringW::compare(__STRING0__, __STRING1__)
626#define GX_WSTRICMP(__STRING0__, __STRING1__) GxStringW::icompare(__STRING0__, __STRING1__)
628GX_CORE_NAMESPACE_END()
GX_FORCE_INLINE b32 operator==(const GxColor color0, const GxColor color1)
Definition GxColor.inl:274
GX_FORCE_INLINE const GxColor operator+(const GxColor color, u32 scalar)
Definition GxColor.inl:178
GX_FORCE_INLINE b32 operator!=(const GxColor color0, const GxColor color1)
Definition GxColor.inl:285
ハンドラ基本クラス
Definition GxCallback.h:27
算術演算クラス
Definition GxMath.h:84
static constexpr u32 VALUE_512
512
Definition GxMath.h:128
static constexpr u32 VALUE_2K
2K
Definition GxMath.h:130
static constexpr u32 VALUE_16
16
Definition GxMath.h:123
トークン操作クラス
Definition GxString.h:337
constexpr void setIgnore(GX_CHAR character)
無視する囲い文字の設定
Definition GxString.h:366
constexpr u32 getSplitLength(void) const
分割した数を取得
Definition GxString.h:398
void addDelimiter(GX_CHAR delimiter)
区切り文字の追加
Definition GxString.cpp:2276
static constexpr u32 TEMPORARY_LENGTH
テンポラリサイズ
Definition GxString.h:346
void getRest(GxString *pString) const
残りの文字列を取得
Definition GxString.cpp:2370
b32 getPrevious(GxString *pString=nullptr)
前の文字列を取得
Definition GxString.cpp:2298
static constexpr u32 DELIMITER_MAX
区切り文字最大数
Definition GxString.h:348
void getCurrent(GxString *pString)
現在の文字列を取得
Definition GxString.cpp:2345
u32 split(void)
文字列を分割する
Definition GxString.cpp:2250
GX_CSTR getFromIndex(u32 index) const
指定されたインデックスの文字列を取得
Definition GxString.cpp:2381
void initialize(GX_CSTR string, GX_CHAR delimiter, b32 copyFlag=true)
初期化
Definition GxString.cpp:2226
GX_FORCE_INLINE const GxString & getString(void) const
全体の文字列を取得
Definition GxString.h:394
b32 getNext(GxString *pString=nullptr)
次の文字列を取得
Definition GxString.cpp:2323
void getTop(GxString *pString=nullptr)
先頭の文字列を取得
Definition GxString.cpp:2286
文字列型クラス
Definition GxString.h:18
static GX_FORCE_INLINE GX_CHAR utol(GX_CHAR character)
大文字→小文字
Definition GxString.h:274
GX_FORCE_INLINE s32 compare(const GxString &string) const
比較
Definition GxString.h:217
GX_FORCE_INLINE GxString(const GxString &string)
コンストラクタ
Definition GxString.h:75
GX_FORCE_INLINE s32 compare(GX_CSTR string) const
比較
Definition GxString.h:215
static GX_FORCE_INLINE void setCallbackUtf8ToSjis(GxCallback::GxHandlerBase handler)
UTF-8→SJIS変換拡張コールバックを設定
Definition GxString.h:284
constexpr GX_CSTR getString(void) const
文字列取得
Definition GxString.h:167
GxString(void)
デフォルトコンストラクタ
Definition GxString.h:73
GX_FORCE_INLINE GxString(GX_CSTR string)
コンストラクタ
Definition GxString.h:77
GX_FORCE_INLINE void getRight(GxString &right, u32 length) const
右文字列取得
Definition GxString.h:171
static GX_FORCE_INLINE s32 ncompare(GX_CSTR string0, GX_CSTR string1, u32 length)
比較(長さ指定)
Definition GxString.h:227
static GX_FORCE_INLINE GX_CHAR ltou(GX_CHAR character)
小文字→大文字
Definition GxString.h:276
GX_FORCE_INLINE s32 icompare(const GxString &string) const
比較(大文字、小文字の区別なし)
Definition GxString.h:223
GX_FORCE_INLINE void getLeft(GxString &left, u32 length) const
左文字列取得
Definition GxString.h:169
constexpr u32 getLength(void) const
文字列の長さを取得
Definition GxString.h:119
CODE
コード分類定義
Definition GxString.h:41
GX_FORCE_INLINE GX_STR getString(void)
文字列取得
Definition GxString.h:165
GX_FORCE_INLINE void clear(void)
クリア
Definition GxString.h:81
static b32 isWhiteSpace(GX_CCHAR character)
空白文字か判定
Definition GxString.h:157
static GX_FORCE_INLINE void setCallbackSjisToUtf8(GxCallback::GxHandlerBase handler)
SJIS→UTF-8変換拡張コールバックを設定
Definition GxString.h:282
GX_FORCE_INLINE s32 icompare(GX_CSTR string) const
比較(大文字、小文字の区別なし)
Definition GxString.h:221
ワイド文字列型クラス(UTF-16用)
Definition GxString.h:430
static constexpr u32 MARGIN_LENGTH
元々持っている文字列の長さ
Definition GxString.h:439
static u32 constexpr getBytesUtf16(GX_CWSTR)
文字のバイト数取得(UTF16)
Definition GxString.h:502
static GX_FORCE_INLINE void setCallbackUtf16ToUtf8(GxCallback::GxHandlerBase handler)
UTF-16→UTF-8変換拡張コールバックを設定
Definition GxString.h:573
static void utf8ToUtf16(GX_CSTR utf8, GX_WSTR utf16)
UTF-8をUTF-16へ変換
Definition GxString.cpp:2831
GX_FORCE_INLINE void getLeft(GxStringW &left, u32 length) const
左文字列取得
Definition GxString.h:510
static void itoa(s64 value, GX_WSTR string)
整数→文字列
Definition GxString.cpp:2608
static constexpr u32 ALLOC_BLOCK_SIZE
確保する文字列のブロックサイズ
Definition GxString.h:441
GxStringW(const GxStringW &string)
コンストラクタ
Definition GxString.h:458
GX_FORCE_INLINE s32 icompare(GX_CWSTR string) const
比較(大文字、小文字の区別なし)
Definition GxString.h:541
GX_FORCE_INLINE const GxStringW & operator=(GX_CWSTR string)
代入
Definition GxString.h:473
GX_FORCE_INLINE s32 compare(const GxStringW &string) const
比較
Definition GxString.h:537
GX_FORCE_INLINE void getRight(GxStringW &right, u32 length) const
右文字列取得
Definition GxString.h:512
static b32 isHalfKanaUtf16(GX_CWCHAR character)
半角カナか判定(UTF16)
Definition GxString.cpp:2477
static GX_FORCE_INLINE void setCallbackUtf16ToSjis(GxCallback::GxHandlerBase handler)
UTF-16→SJIS変換拡張コールバックを設定
Definition GxString.h:569
static u64 atoui(GX_CWSTR string)
文字列→非負整数
Definition GxString.cpp:2674
s32 find(GX_CWSTR string, u32 start=0) const
文字列検索
Definition GxString.cpp:2510
static constexpr u32 TEMPORARY_LENGTH
一時領域のサイズ
Definition GxString.h:443
static GX_FORCE_INLINE void setCallbackSjisToUtf16(GxCallback::GxHandlerBase handler)
SJIS→UTF-16変換拡張コールバックを設定
Definition GxString.h:567
static GX_FORCE_INLINE GX_WCHAR ltou(GX_WCHAR character)
小文字→大文字
Definition GxString.h:557
s32 findReverse(GX_WCHAR character, s32 start=-1) const
文字検索(終端から検索)
Definition GxString.cpp:2558
static s64 atoi(GX_CWSTR string)
文字列→整数
Definition GxString.cpp:2654
~GxStringW(void)
デストラクタ
Definition GxString.cpp:2457
GX_FORCE_INLINE void operator+=(GX_CWCHAR character)
結合代入
Definition GxString.h:477
GX_FORCE_INLINE b32 operator!=(GX_CWSTR string) const
不一致
Definition GxString.h:487
constexpr GX_CWSTR getString(void) const
文字列取得
Definition GxString.h:506
GX_FORCE_INLINE b32 operator==(GX_CWSTR string) const
一致
Definition GxString.h:483
static void uitoa(u64 value, GX_WSTR string)
非負整数→文字列
Definition GxString.cpp:2635
void getSubString(GxStringW &subString, u32 start, u32 length=MAX_LENGTH) const
指定位置からの抜き出し
Definition GxString.cpp:2492
static void utf16ToUtf8(GX_CWSTR utf16, GX_STR utf8)
UTF-16をUTF-8へ変換
Definition GxString.cpp:2918
static GX_FORCE_INLINE void setCallbackUtf8ToUtf16(GxCallback::GxHandlerBase handler)
UTF-8→UTF-16変換拡張コールバックを設定
Definition GxString.h:571
constexpr u32 getLength(void) const
文字列の長さを取得
Definition GxString.h:498
GX_FORCE_INLINE GX_WSTR getString(void)
文字列取得
Definition GxString.h:504
GX_FORCE_INLINE s32 icompare(const GxStringW &string) const
比較(大文字、小文字の区別なし)
Definition GxString.h:543
GxStringW(GX_CWSTR string)
コンストラクタ
Definition GxString.h:460
static void utf16ToSjis(GX_CWSTR utf16, GX_STR sjis)
UTF-16をSJISへ変換
Definition GxString.cpp:2772
void setStringProperty(const void *pValue)
文字列設定(プロパティ用)
Definition GxString.cpp:2984
static GX_FORCE_INLINE GX_WCHAR utol(GX_WCHAR character)
大文字→小文字
Definition GxString.h:555
GX_FORCE_INLINE void clear(void)
クリア
Definition GxString.h:464
GX_FORCE_INLINE GxStringW operator+(GX_CWSTR string)
結合
Definition GxString.h:481
static constexpr u32 MAX_LENGTH
最大長定義
Definition GxString.h:445
static constexpr u32 TEMPORARY_STACK_SIZE
一時メモリにスタックを使うか閾値
Definition GxString.h:447
GX_FORCE_INLINE s32 compare(GX_CWSTR string) const
比較
Definition GxString.h:535
void getStringProperty(void *pValue)
文字列取得(プロパティ用)
Definition GxString.cpp:2975
static void sjisToUtf16(GX_CSTR sjis, GX_WSTR utf16)
UTF-SJISをUTF-16へ変換
Definition GxString.cpp:2690
32bitブーリアン
Definition GxDefine.h:173