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
154154 ~AsciiString ();
155155
156156 /* *
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 .
158158 */
159159 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 ;
160165 /* *
161166 Return true iff the length of the string is zero. Equivalent
162167 to (getLength() == 0) but slightly more efficient.
@@ -391,6 +396,13 @@ inline int AsciiString::getLength() const
391396 return m_data ? strlen (peek ()) : 0 ;
392397}
393398
399+ // -----------------------------------------------------
400+ inline int AsciiString::getByteCount () const
401+ {
402+ validate ();
403+ return m_data ? getLength () : 0 ;
404+ }
405+
394406// -----------------------------------------------------
395407inline Bool AsciiString::isEmpty () const
396408{
Original file line number Diff line number Diff line change @@ -154,9 +154,14 @@ class UnicodeString
154154 ~UnicodeString ();
155155
156156 /* *
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 .
158158 */
159159 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 ;
160165 /* *
161166 Return true iff the length of the string is zero. Equivalent
162167 to (getLength() == 0) but slightly more efficient.
@@ -341,6 +346,13 @@ inline int UnicodeString::getLength() const
341346 return m_data ? wcslen (peek ()) : 0 ;
342347}
343348
349+ // -----------------------------------------------------
350+ inline int UnicodeString::getByteCount () const
351+ {
352+ validate ();
353+ return m_data ? getLength () * sizeof (WideChar) : 0 ;
354+ }
355+
344356// -----------------------------------------------------
345357inline Bool UnicodeString::isEmpty () const
346358{
You can’t perform that action at this time.
0 commit comments