-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathNSWFL_StringBuilder.H
135 lines (106 loc) · 4.73 KB
/
NSWFL_StringBuilder.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright © NetworkDLS 2023, All rights reserved
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef _NSWFL_STRINGBUILDER_H_
#define _NSWFL_STRINGBUILDER_H_
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace NSWFL {
namespace String {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define StringBuilder_GRANDULARITY 1024
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class StringBuilder {
public:
operator const char* (void);
operator char* (void);
operator int(void);
StringBuilder operator+ (StringBuilder& pStr);
StringBuilder operator+= (StringBuilder& pStr);
bool operator== (StringBuilder& pStr);
bool operator> (StringBuilder& pStr);
bool operator< (StringBuilder& pStr);
bool operator>= (StringBuilder& pStr);
bool operator<= (StringBuilder& pStr);
bool operator!= (StringBuilder& pStr);
char& operator[] (unsigned int i);
char& operator[] (int i);
bool Initialize(const int iInAllocAhead);
bool Initialize(void);
void Destroy(void);
StringBuilder(StringBuilder* pSource);
StringBuilder(int InitialSize);
StringBuilder(const char* String, int Size);
StringBuilder(const char* String);
StringBuilder(const char* String, int Size, int InitialSize);
StringBuilder(void);
~StringBuilder(void);
bool WriteToFileByHandle(FILE* hTarget);
bool WriteToFile(const char* sFileName);
bool AppendFromTextBox(HWND hTextBox);
bool AppendFromFile(const char* sFileName);
bool AppendFromFileByHandle(FILE* hSource);
bool Prepend(const char* sDat2Append, const int iDat2AppendSz);
bool Prepend(const char* sDat2Append);
bool Prepend(StringBuilder* pBuffer);
int PrependF(const char* sFormat, ...);
bool Append(StringBuilder* pBuffer);
int StrCmp(StringBuilder* pStr);
int StrCmpi(StringBuilder* pStr);
int StrnCmp(StringBuilder* pStr, int iChars);
int StrnCmpi(StringBuilder* pStr, int iChars);
bool Append(const int iNum);
bool Append(const unsigned int iNum);
bool Append(const long iNum);
bool Append(const unsigned long iNum);
bool Append(const __int64 i64Dat2Append);
bool Append(const unsigned __int64 i64Dat2Append);
int AppendF(const char* sFormat, ...);
bool Append(const char* sDat2Append);
bool Append(const unsigned char* sDat2Append);
bool Append(const char* sDat2Append, const int iDat2AppendSz);
bool Append(const unsigned char* sDat2Append, const int iDat2AppendSz);
bool Append(const char cCharacter2Append);
bool Append(const float fDat2Append, int iDecimalPlaces);
bool Append(const float fDat2Append);
bool Append(const double dDat2Append, int iDecimalPlaces);
bool Append(const double dDat2Append);
int Set(const char* sString, int iLength);
int Set(const char* sString);
int Set(StringBuilder* pBuilder);
int SetF(const char* sFormat, ...);
char* ToString(void);
int InStr(const char* sSearchFor, int sSearchForSz, const int iStartPos);
int InStr(const char* sSearchFor, const int iStartPos);
int InStr(const char* sSearchFor);
int InStrI(const char* sSearchFor, int sSearchForSz, const int iStartPos);
int InStrI(const char* sSearchFor, const int iStartPos);
int InStrI(const char* sSearchFor);
bool IncreaseSizeBy(int iAdditionalBytes);
bool Resize(int iAtLeast);
void Clear(void);
bool Terminate(void);
bool Terminate(int iPosition);
int RemoveWhiteSpaces(void);
int Trim(void);
int Replace(const char* sReplace, int iReplaceLen, const char* sWith, int iWithLen, bool bCaseSensitive);
int Replace(const char* sReplace, const char* sWith, bool bCaseSensitive);
int Replace(const char* sReplace, const char* sWith);
int ReplaceRange(int iBegin, int iEnd, const char* sWith, int iWithSz);
int FirstCharPos(void);
int LastCharPos(void);
int Right(char* sOutBuf, int iMaxSz, int iRight);
int Left(char* sOutBuf, int iMaxSz, int iLeft);
char* Buffer;
int Alloc;
int AllocAhead;
int Length;
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} //namespace::String
} //namespace::NSWFL
#endif