File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
Core/GameEngine/Include/Common Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -154,9 +154,14 @@ class AsciiString
154
154
~AsciiString ();
155
155
156
156
/* *
157
- Return the length, in characters (not bytes!) , of the string.
157
+ Return the length, in characters, of the string up to the first zero or null terminator .
158
158
*/
159
159
int getLength () const ;
160
+
161
+ /* *
162
+ Return the number of bytes used by the string up to the first zero or null terminator.
163
+ */
164
+ int getByteCount () const ;
160
165
/* *
161
166
Return true iff the length of the string is zero. Equivalent
162
167
to (getLength() == 0) but slightly more efficient.
@@ -391,6 +396,13 @@ inline int AsciiString::getLength() const
391
396
return m_data ? strlen (peek ()) : 0 ;
392
397
}
393
398
399
+ // -----------------------------------------------------
400
+ inline int AsciiString::getByteCount () const
401
+ {
402
+ validate ();
403
+ return m_data ? getLength () : 0 ;
404
+ }
405
+
394
406
// -----------------------------------------------------
395
407
inline Bool AsciiString::isEmpty () const
396
408
{
Original file line number Diff line number Diff line change @@ -154,9 +154,14 @@ class UnicodeString
154
154
~UnicodeString ();
155
155
156
156
/* *
157
- Return the length, in characters (not bytes!) , of the string.
157
+ Return the length, in characters, of the string up to the first zero or null terminator .
158
158
*/
159
159
int getLength () const ;
160
+
161
+ /* *
162
+ Return the number of bytes used by the string up to the first zero or null terminator.
163
+ */
164
+ int getByteCount () const ;
160
165
/* *
161
166
Return true iff the length of the string is zero. Equivalent
162
167
to (getLength() == 0) but slightly more efficient.
@@ -341,6 +346,13 @@ inline int UnicodeString::getLength() const
341
346
return m_data ? wcslen (peek ()) : 0 ;
342
347
}
343
348
349
+ // -----------------------------------------------------
350
+ inline int UnicodeString::getByteCount () const
351
+ {
352
+ validate ();
353
+ return m_data ? getLength () * sizeof (WideChar) : 0 ;
354
+ }
355
+
344
356
// -----------------------------------------------------
345
357
inline Bool UnicodeString::isEmpty () const
346
358
{
You can’t perform that action at this time.
0 commit comments