OpenBarnyard
 
Loading...
Searching...
No Matches
T2String8.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 TCHAR* strings
8//-----------------------------------------------------------------------------
10{
11public:
12 static constexpr TSIZE SCRATCH_MEM_SIZE = 2048;
13
14public:
15 static TCHAR* CreateCopy( const TCHAR* a_pcString, TSIZE a_uiSize = -1 );
16
17 static TINT FormatV( TCHAR* a_pcString, TINT size, const TCHAR* a_pcFormat, va_list args );
18 static TINT FormatV( TCHAR* a_pcString, const TCHAR* a_pcFormat, va_list args );
19
20 static TINT Format( TCHAR* a_pcString, TINT size, const TCHAR* a_pcFormat, ... );
21 static TINT Format( TCHAR* a_pcString, const TCHAR* a_pcFormat, ... );
22
23 static TINT Compare( const TCHAR* str1, const TCHAR* str2, TSIZE size = -1 );
24 static TINT CompareNoCase( const TCHAR* str1, const TCHAR* str2, TSIZE size = -1 );
25
26 static TCHAR* Copy( TCHAR* dst, const TCHAR* src, TSIZE size = -1 );
27 static TCHAR* CopySafe( TCHAR* dst, const TCHAR* src, TSIZE size );
28
29 static TCHAR* Concat( TCHAR* dst, const TCHAR* src, TSIZE size = -1 );
30
31 static TCHAR* FindChar( TCHAR* str, TCHAR character );
32 static const TCHAR* FindChar( const TCHAR* str, TCHAR character );
33
34 static TCHAR* FindString( TCHAR* str, const TCHAR* substr );
35 static const TCHAR* FindString( const TCHAR* str, const TCHAR* substr );
36
37 static TSIZE Length( const TCHAR* str );
38
39 static TBOOL IsLowerCase( const TCHAR* str );
40 static TBOOL IsUpperCase( const TCHAR* str );
41
42 static void ToLowerCase( TCHAR* str );
43 static void ToUpperCase( TCHAR* str );
44
45 static void IntToString( TINT value, TCHAR* dst, TINT unused, TINT radix );
46 static void IntToString( TINT value, TCHAR* dst, TINT radix );
47
48 static TINT StringToInt( const TCHAR* src );
49 static TFLOAT StringToFloat( const TCHAR* src );
50
51 static TCHAR* SkipSpaces( TCHAR* str );
52 static const TCHAR* SkipSpaces( const TCHAR* 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
size_t TSIZE
Definition Typedefs.h:9
char TCHAR
Definition Typedefs.h:20
float TFLOAT
Definition Typedefs.h:4
int TINT
Definition Typedefs.h:7
bool TBOOL
Definition Typedefs.h:6
static TCHAR * FindChar(TCHAR *str, TCHAR character)
static TCHAR * CreateCopy(const TCHAR *a_pcString, TSIZE a_uiSize=-1)
static TSIZE Length(const TCHAR *str)
static TCHAR * SkipSpaces(TCHAR *str)
static void ToUpperCase(TCHAR *str)
static TCHAR ms_aScratchMem[SCRATCH_MEM_SIZE]
Definition T2String8.h:61
static TBOOL IsLowerCase(const TCHAR *str)
static T2Allocator * sm_pDefaultAllocatorCB
Definition T2String8.h:60
static T2Allocator * GetDefaultAllocatorCB()
Definition T2String8.h:54
static TINT FormatV(TCHAR *a_pcString, TINT size, const TCHAR *a_pcFormat, va_list args)
Definition T2String8.cpp:22
static TINT Format(TCHAR *a_pcString, TINT size, const TCHAR *a_pcFormat,...)
Definition T2String8.cpp:41
static void IntToString(TINT value, TCHAR *dst, TINT unused, TINT radix)
static TFLOAT StringToFloat(const TCHAR *src)
static void ToLowerCase(TCHAR *str)
static TBOOL IsUpperCase(const TCHAR *str)
static TCHAR * Concat(TCHAR *dst, const TCHAR *src, TSIZE size=-1)
Definition T2String8.cpp:76
static TCHAR * CopySafe(TCHAR *dst, const TCHAR *src, TSIZE size)
Definition T2String8.cpp:84
static TINT Compare(const TCHAR *str1, const TCHAR *str2, TSIZE size=-1)
Definition T2String8.cpp:52
static TINT CompareNoCase(const TCHAR *str1, const TCHAR *str2, TSIZE size=-1)
Definition T2String8.cpp:60
static TCHAR * Copy(TCHAR *dst, const TCHAR *src, TSIZE size=-1)
Definition T2String8.cpp:68
static constexpr TSIZE SCRATCH_MEM_SIZE
Definition T2String8.h:12
static TCHAR * FindString(TCHAR *str, const TCHAR *substr)
static TINT StringToInt(const TCHAR *src)