Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Core/GameEngine/Include/Common/AsciiString.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,14 @@ class AsciiString
~AsciiString();

/**
Return the length, in characters (not bytes!), of the string.
Return the length, in characters, of the string up to the first zero or null terminator.
*/
int getLength() const;

/**
Return the number of bytes used by the string up to the first zero or null terminator.
*/
int getByteCount() const;
/**
Return true iff the length of the string is zero. Equivalent
to (getLength() == 0) but slightly more efficient.
Expand Down Expand Up @@ -391,6 +396,13 @@ inline int AsciiString::getLength() const
return m_data ? strlen(peek()) : 0;
}

// -----------------------------------------------------
inline int AsciiString::getByteCount() const
{
validate();
return m_data ? getLength() : 0;
}

// -----------------------------------------------------
inline Bool AsciiString::isEmpty() const
{
Expand Down
14 changes: 13 additions & 1 deletion Core/GameEngine/Include/Common/UnicodeString.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,14 @@ class UnicodeString
~UnicodeString();

/**
Return the length, in characters (not bytes!), of the string.
Return the length, in characters, of the string up to the first zero or null terminator.
*/
int getLength() const;

/**
Return the number of bytes used by the string up to the first zero or null terminator.
*/
int getByteCount() const;
/**
Return true iff the length of the string is zero. Equivalent
to (getLength() == 0) but slightly more efficient.
Expand Down Expand Up @@ -341,6 +346,13 @@ inline int UnicodeString::getLength() const
return m_data ? wcslen(peek()) : 0;
}

// -----------------------------------------------------
inline int UnicodeString::getByteCount() const
{
validate();
return m_data ? getLength() * sizeof(WideChar) : 0;
}

// -----------------------------------------------------
inline Bool UnicodeString::isEmpty() const
{
Expand Down
Loading