Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
FastString Class Reference

Public Member Functions

 FastString (int initialCapacity=32)
 
bool IsEmpty ()
 
override string ToString ()
 
bool IsModified (int newControlValue)
 
bool IsModified (object newControlValue)
 
void Set (string str)
 
void Set (object str)
 
void Set< T1, T2 > (T1 str1, T2 str2)
 
void Set< T1, T2, T3 > (T1 str1, T2 str2, T3 str3)
 
void Set< T1, T2, T3, T4 > (T1 str1, T2 str2, T3 str3, T4 str4)
 
void Set (params object[] str)
 
FastString Clear ()
 
FastString Append (string value)
 
FastString Append (object value)
 
FastString Append (int value)
 
FastString Append (float valueF)
 
FastString Replace (string oldStr, string newStr)
 

Private Member Functions

void ReallocateIFN (int nbCharsToAdd)
 

Private Attributes

string m_stringGenerated = ""
 
bool m_isStringGenerated
 
char[] m_buffer
 
int m_bufferPos
 
int m_charsCapacity
 
List< char > m_replacement
 
object m_valueControl
 
int m_valueControlInt = int.MinValue
 

Detailed Description

Definition at line 4 of file FastString.cs.

Constructor & Destructor Documentation

◆ FastString()

FastString.FastString ( int  initialCapacity = 32)
inline

Definition at line 22 of file FastString.cs.

23 {
24 m_buffer = new char[m_charsCapacity = initialCapacity];
25 }
char[] m_buffer
Definition: FastString.cs:10
int m_charsCapacity
Definition: FastString.cs:14

References m_buffer, and m_charsCapacity.

Member Function Documentation

◆ Append() [1/4]

FastString FastString.Append ( float  valueF)
inline

Definition at line 164 of file FastString.cs.

165 {
166 double num = valueF;
167 m_isStringGenerated = false;
168 ReallocateIFN(32);
169 if (num == 0.0)
170 {
171 m_buffer[m_bufferPos++] = '0';
172 return this;
173 }
174 if (num < 0.0)
175 {
176 num = 0.0 - num;
177 m_buffer[m_bufferPos++] = '-';
178 }
179 int num2 = 0;
180 while (num < 1000000.0)
181 {
182 num *= 10.0;
183 num2++;
184 }
185 long num3 = (long)Math.Round(num);
186 int num4 = 0;
187 bool flag = true;
188 while (num3 != 0L || num2 >= 0)
189 {
190 if (num3 % 10 != 0L || num2 <= 0)
191 {
192 flag = false;
193 }
194 if (!flag)
195 {
196 m_buffer[m_bufferPos + num4++] = (char)(48 + num3 % 10);
197 }
198 if (--num2 == 0 && !flag)
199 {
200 m_buffer[m_bufferPos + num4++] = '.';
201 }
202 num3 /= 10;
203 }
204 m_bufferPos += num4;
205 for (int num5 = num4 / 2 - 1; num5 >= 0; num5--)
206 {
207 char c = m_buffer[m_bufferPos - num5 - 1];
208 m_buffer[m_bufferPos - num5 - 1] = m_buffer[m_bufferPos - num4 + num5];
209 m_buffer[m_bufferPos - num4 + num5] = c;
210 }
211 return this;
212 }
bool m_isStringGenerated
Definition: FastString.cs:8
int m_bufferPos
Definition: FastString.cs:12
void ReallocateIFN(int nbCharsToAdd)
Definition: FastString.cs:262

References m_buffer, m_bufferPos, m_isStringGenerated, and ReallocateIFN().

◆ Append() [2/4]

FastString FastString.Append ( int  value)
inline

Definition at line 138 of file FastString.cs.

139 {
140 ReallocateIFN(16);
141 if (value < 0)
142 {
143 value = -value;
144 m_buffer[m_bufferPos++] = '-';
145 }
146 int num = 0;
147 do
148 {
149 m_buffer[m_bufferPos++] = (char)(48 + value % 10);
150 value /= 10;
151 num++;
152 }
153 while (value != 0);
154 for (int num2 = num / 2 - 1; num2 >= 0; num2--)
155 {
156 char c = m_buffer[m_bufferPos - num2 - 1];
157 m_buffer[m_bufferPos - num2 - 1] = m_buffer[m_bufferPos - num + num2];
158 m_buffer[m_bufferPos - num + num2] = c;
159 }
160 m_isStringGenerated = false;
161 return this;
162 }

References m_buffer, m_bufferPos, m_isStringGenerated, and ReallocateIFN().

◆ Append() [3/4]

FastString FastString.Append ( object  value)
inline

Definition at line 132 of file FastString.cs.

133 {
134 Append(value.ToString());
135 return this;
136 }
FastString Append(string value)
Definition: FastString.cs:119

References Append().

◆ Append() [4/4]

FastString FastString.Append ( string  value)
inline

Definition at line 119 of file FastString.cs.

120 {
121 ReallocateIFN(value.Length);
122 int length = value.Length;
123 for (int i = 0; i < length; i++)
124 {
125 m_buffer[m_bufferPos + i] = value[i];
126 }
127 m_bufferPos += length;
128 m_isStringGenerated = false;
129 return this;
130 }

References m_buffer, m_bufferPos, m_isStringGenerated, and ReallocateIFN().

Referenced by WidgetStockTracker._Refresh(), Append(), ItemQuestTracker.Refresh(), WidgetTracker.Refresh(), Set(), Set< T1, T2 >(), Set< T1, T2, T3 >(), and Set< T1, T2, T3, T4 >().

◆ Clear()

FastString FastString.Clear ( )
inline

◆ IsEmpty()

bool FastString.IsEmpty ( )
inline

Definition at line 27 of file FastString.cs.

28 {
30 {
31 return m_bufferPos == 0;
32 }
33 return m_stringGenerated == null;
34 }
string m_stringGenerated
Definition: FastString.cs:6

References m_bufferPos, m_isStringGenerated, and m_stringGenerated.

Referenced by WidgetTracker.Refresh().

◆ IsModified() [1/2]

bool FastString.IsModified ( int  newControlValue)
inline

Definition at line 46 of file FastString.cs.

47 {
48 bool num = newControlValue != m_valueControlInt;
49 if (num)
50 {
51 m_valueControlInt = newControlValue;
52 }
53 return num;
54 }
int m_valueControlInt
Definition: FastString.cs:20

References m_valueControlInt.

◆ IsModified() [2/2]

bool FastString.IsModified ( object  newControlValue)
inline

Definition at line 56 of file FastString.cs.

57 {
58 bool num = !newControlValue.Equals(m_valueControl);
59 if (num)
60 {
61 m_valueControl = newControlValue;
62 }
63 return num;
64 }
object m_valueControl
Definition: FastString.cs:18

References m_valueControl.

◆ ReallocateIFN()

void FastString.ReallocateIFN ( int  nbCharsToAdd)
inlineprivate

Definition at line 262 of file FastString.cs.

263 {
264 if (m_bufferPos + nbCharsToAdd > m_charsCapacity)
265 {
266 m_charsCapacity = Math.Max(m_charsCapacity + nbCharsToAdd, m_charsCapacity * 2);
267 char[] array = new char[m_charsCapacity];
268 m_buffer.CopyTo(array, 0);
269 m_buffer = array;
270 }
271 }

References m_buffer, m_bufferPos, and m_charsCapacity.

Referenced by Append(), and Replace().

◆ Replace()

FastString FastString.Replace ( string  oldStr,
string  newStr 
)
inline

Definition at line 214 of file FastString.cs.

215 {
216 if (m_bufferPos == 0)
217 {
218 return this;
219 }
220 if (m_replacement == null)
221 {
222 m_replacement = new List<char>();
223 }
224 for (int i = 0; i < m_bufferPos; i++)
225 {
226 bool flag = false;
227 if (m_buffer[i] == oldStr[0])
228 {
229 int j;
230 for (j = 1; j < oldStr.Length && m_buffer[i + j] == oldStr[j]; j++)
231 {
232 }
233 flag = j >= oldStr.Length;
234 }
235 if (flag)
236 {
237 i += oldStr.Length - 1;
238 if (newStr != null)
239 {
240 for (int k = 0; k < newStr.Length; k++)
241 {
242 m_replacement.Add(newStr[k]);
243 }
244 }
245 }
246 else
247 {
248 m_replacement.Add(m_buffer[i]);
249 }
250 }
252 for (int l = 0; l < m_replacement.Count; l++)
253 {
254 m_buffer[l] = m_replacement[l];
255 }
257 m_replacement.Clear();
258 m_isStringGenerated = false;
259 return this;
260 }
List< char > m_replacement
Definition: FastString.cs:16

References m_buffer, m_bufferPos, m_isStringGenerated, m_replacement, and ReallocateIFN().

◆ Set() [1/3]

void FastString.Set ( object  str)
inline

Definition at line 74 of file FastString.cs.

75 {
76 Set(str.ToString());
77 }
void Set(string str)
Definition: FastString.cs:66

References Set().

◆ Set() [2/3]

void FastString.Set ( params object[]  str)
inline

Definition at line 103 of file FastString.cs.

104 {
105 Clear();
106 for (int i = 0; i < str.Length; i++)
107 {
108 Append(str[i]);
109 }
110 }
FastString Clear()
Definition: FastString.cs:112

References Append(), and Clear().

◆ Set() [3/3]

void FastString.Set ( string  str)
inline

◆ Set< T1, T2 >()

void FastString.Set< T1, T2 > ( T1  str1,
T2  str2 
)
inline

Definition at line 79 of file FastString.cs.

80 {
81 Clear();
82 Append(str1);
83 Append(str2);
84 }

References Append(), and Clear().

◆ Set< T1, T2, T3 >()

void FastString.Set< T1, T2, T3 > ( T1  str1,
T2  str2,
T3  str3 
)
inline

Definition at line 86 of file FastString.cs.

87 {
88 Clear();
89 Append(str1);
90 Append(str2);
91 Append(str3);
92 }

References Append(), and Clear().

◆ Set< T1, T2, T3, T4 >()

void FastString.Set< T1, T2, T3, T4 > ( T1  str1,
T2  str2,
T3  str3,
T4  str4 
)
inline

Definition at line 94 of file FastString.cs.

95 {
96 Clear();
97 Append(str1);
98 Append(str2);
99 Append(str3);
100 Append(str4);
101 }

References Append(), and Clear().

◆ ToString()

override string FastString.ToString ( )
inline

Member Data Documentation

◆ m_buffer

char [] FastString.m_buffer
private

Definition at line 10 of file FastString.cs.

Referenced by Append(), FastString(), ReallocateIFN(), Replace(), and ToString().

◆ m_bufferPos

int FastString.m_bufferPos
private

Definition at line 12 of file FastString.cs.

Referenced by Append(), Clear(), IsEmpty(), ReallocateIFN(), Replace(), and ToString().

◆ m_charsCapacity

int FastString.m_charsCapacity
private

Definition at line 14 of file FastString.cs.

Referenced by FastString(), and ReallocateIFN().

◆ m_isStringGenerated

bool FastString.m_isStringGenerated
private

Definition at line 8 of file FastString.cs.

Referenced by Append(), Clear(), IsEmpty(), Replace(), Set(), and ToString().

◆ m_replacement

List<char> FastString.m_replacement
private

Definition at line 16 of file FastString.cs.

Referenced by Replace().

◆ m_stringGenerated

string FastString.m_stringGenerated = ""
private

Definition at line 6 of file FastString.cs.

Referenced by IsEmpty(), Set(), and ToString().

◆ m_valueControl

object FastString.m_valueControl
private

Definition at line 18 of file FastString.cs.

Referenced by IsModified().

◆ m_valueControlInt

int FastString.m_valueControlInt = int.MinValue
private

Definition at line 20 of file FastString.cs.

Referenced by IsModified().


The documentation for this class was generated from the following file: