OpenBarnyard
 
Loading...
Searching...
No Matches
T2String16.h
Go to the documentation of this file.
1#pragma once
2#include "Toshi/T2Allocator.h"
3
5
6//-----------------------------------------------------------------------------
7// Purpose: Stores all common methods that let you operate with TWCHAR* strings
8//-----------------------------------------------------------------------------
10{
11public:
12 static constexpr TSIZE SCRATCH_MEM_SIZE = 512;
13
14public:
15 static TWCHAR* CreateCopy( const TWCHAR* a_wszString, TSIZE a_uiSize = -1 );
16
17 static TINT Format( TWCHAR* a_pcString, TINT size, const TWCHAR* a_pcFormat, ... );
18 static TINT Format( TWCHAR* a_pcString, const TWCHAR* a_pcFormat, ... );
19
20 static TINT FormatV( TWCHAR* a_pcString, TINT size, const TWCHAR* a_pcFormat, va_list args );
21 static TINT FormatV( TWCHAR* a_pcString, const TWCHAR* a_pcFormat, va_list args );
22
23 static TINT Compare( const TWCHAR* str1, const TWCHAR* str2, TSIZE size = -1 );
24 static TINT CompareNoCase( const TWCHAR* str1, const TWCHAR* str2, TSIZE size = -1 );
25
26 static TWCHAR* Copy( TWCHAR* dst, const TWCHAR* src, TSIZE size = -1 );
27 static TWCHAR* CopySafe( TWCHAR* dst, const TWCHAR* src, TSIZE size );
28
29 static TWCHAR* Concat( TWCHAR* dst, const TWCHAR* src, TSIZE size = -1 );
30
31 static TWCHAR* FindChar( TWCHAR* str, TWCHAR character );
32 static const TWCHAR* FindChar( const TWCHAR* str, TWCHAR character );
33
34 static TWCHAR* FindString( TWCHAR* str, const TWCHAR* substr );
35 static const TWCHAR* FindString( const TWCHAR* str, const TWCHAR* substr );
36
37 static TSIZE Length( const TWCHAR* str );
38
39 static TBOOL IsLowerCase( const TWCHAR* str );
40 static TBOOL IsUpperCase( const TWCHAR* str );
41
42 static void ToLowerCase( TWCHAR* str );
43 static void ToUpperCase( TWCHAR* str );
44
45 static void IntToString( TINT value, TWCHAR* dst, TINT unused, TINT radix );
46 static void IntToString( TINT value, TWCHAR* dst, TINT radix );
47
48 static TINT StringToInt( const TWCHAR* src );
49 static TFLOAT StringToFloat( const TWCHAR* src );
50
51 static TWCHAR* SkipSpaces( TWCHAR* str );
52 static const TWCHAR* SkipSpaces( const TWCHAR* str );
53
55 {
56 return GetGlobalAllocator();
57 }
58
59public:
62};
63
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
TFORCEINLINE T2Allocator * GetGlobalAllocator()
Definition T2Allocator.h:49
wchar_t TWCHAR
Definition Typedefs.h:21
size_t TSIZE
Definition Typedefs.h:9
float TFLOAT
Definition Typedefs.h:4
int TINT
Definition Typedefs.h:7
bool TBOOL
Definition Typedefs.h:6
static TWCHAR * FindString(TWCHAR *str, const TWCHAR *substr)
static void ToUpperCase(TWCHAR *str)
static TWCHAR * Copy(TWCHAR *dst, const TWCHAR *src, TSIZE size=-1)
static TWCHAR ms_aScratchMem[SCRATCH_MEM_SIZE]
Definition T2String16.h:61
static TINT FormatV(TWCHAR *a_pcString, TINT size, const TWCHAR *a_pcFormat, va_list args)
static constexpr TSIZE SCRATCH_MEM_SIZE
Definition T2String16.h:12
static TWCHAR * CopySafe(TWCHAR *dst, const TWCHAR *src, TSIZE size)
static TSIZE Length(const TWCHAR *str)
static TWCHAR * SkipSpaces(TWCHAR *str)
static void ToLowerCase(TWCHAR *str)
static T2Allocator * GetDefaultAllocatorCB()
Definition T2String16.h:54
static TINT CompareNoCase(const TWCHAR *str1, const TWCHAR *str2, TSIZE size=-1)
static T2Allocator * sm_pDefaultAllocatorCB
Definition T2String16.h:60
static TINT Compare(const TWCHAR *str1, const TWCHAR *str2, TSIZE size=-1)
static TFLOAT StringToFloat(const TWCHAR *src)
static TINT StringToInt(const TWCHAR *src)
static TWCHAR * Concat(TWCHAR *dst, const TWCHAR *src, TSIZE size=-1)
static void IntToString(TINT value, TWCHAR *dst, TINT unused, TINT radix)
static TBOOL IsUpperCase(const TWCHAR *str)
static TBOOL IsLowerCase(const TWCHAR *str)
static TWCHAR * FindChar(TWCHAR *str, TWCHAR character)
static TINT Format(TWCHAR *a_pcString, TINT size, const TWCHAR *a_pcFormat,...)
static TWCHAR * CreateCopy(const TWCHAR *a_wszString, TSIZE a_uiSize=-1)