104 operator const WCHAR * (void)
const;
109 int Compare (
const WCHAR *
string)
const;
115 void Erase (
int start_index,
int char_count);
116 int _cdecl
Format (
const WCHAR *format, ...);
117 int _cdecl
Format_Args (
const WCHAR *format,
const va_list & arg_list );
141 typedef struct _HEADER
143 int allocated_length;
154 MAX_TEMP_BYTES = (MAX_TEMP_LEN *
sizeof (WCHAR)) +
sizeof (HEADER),
160 void Get_String (
int length,
bool is_temp);
161 WCHAR * Allocate_Buffer (
int length);
162 void Resize (
int size);
163 void Uninitialised_Grow (
int length);
164 void Free_String (
void);
166 inline void Store_Length (
int length);
167 inline void Store_Allocated_Length (
int allocated_length);
168 inline HEADER * Get_Header (
void)
const;
169 int Get_Allocated_Length (
void)
const;
171 void Set_Buffer_And_Allocated_Length (WCHAR *buffer,
int length);
181 static char m_TempString1[MAX_TEMP_BYTES];
182 static char m_TempString2[MAX_TEMP_BYTES];
183 static char m_TempString3[MAX_TEMP_BYTES];
184 static char m_TempString4[MAX_TEMP_BYTES];
185 static WCHAR * m_FreeTempPtr[MAX_TEMP_STRING];
186 static WCHAR * m_ResTempPtr[MAX_TEMP_STRING];
188 static int m_UsedTempStringCount;
191 static WCHAR m_NullChar;
192 static WCHAR * m_EmptyString;
200 : m_Buffer (m_EmptyString)
202 Get_String (initial_len, hint_temporary);
203 m_Buffer[0] = m_NullChar;
213 : m_Buffer (m_EmptyString)
215 Get_String (2, hint_temporary);
225 : m_Buffer (m_EmptyString)
227 if (hint_temporary || (
string.
Get_Length()>1)) {
228 Get_String(
string.
Get_Length()+1, hint_temporary);
240 : m_Buffer (m_EmptyString)
242 int len=
string ? wcslen(
string) : 0;
243 if (hint_temporary || len>0) {
244 Get_String (len+1, hint_temporary);
257 : m_Buffer (m_EmptyString)
259 if (hint_temporary || (
string && strlen(
string)>0)) {
260 Get_String (strlen(
string) + 1, hint_temporary);
284 return (m_Buffer[0] == m_NullChar);
294 return wcscmp (m_Buffer,
string);
307 return _wcsicmp (m_Buffer,
string);
320 return m_Buffer[index];
327 return m_Buffer[index];
334WideStringClass::operator
const WCHAR * (void)
const
345 return (
Compare (rvalue) == 0);
354 return (
Compare (rvalue) != 0);
363 return operator= ((
const WCHAR *)
string);
373 return (wcscmp (m_Buffer,
string) < 0);
386 return (wcscmp (m_Buffer,
string) <= 0);
399 return (wcscmp (m_Buffer,
string) > 0);
412 return (wcscmp (m_Buffer,
string) >= 0);
427 if (start_index < len) {
429 if (start_index + char_count > len) {
430 char_count = len - start_index;
433 ::memmove ( &m_Buffer[start_index],
434 &m_Buffer[start_index + char_count],
435 (len - (start_index + char_count) + 1) *
sizeof (WCHAR));
437 Store_Length( wcslen(m_Buffer) );
449 int len = wcslen(m_Buffer);
461 int len = wcslen (
string);
462 Uninitialised_Grow (len + 1);
465 ::memcpy (m_Buffer,
string, (len + 1) *
sizeof (WCHAR));
487 Uninitialised_Grow (2);
490 m_Buffer[1] = m_NullChar;
504 int src_len = wcslen (
string);
505 int new_len = cur_len + src_len;
510 Resize (new_len + 1);
511 Store_Length (new_len);
516 ::memcpy (&m_Buffer[cur_len],
string, (src_len + 1) *
sizeof (WCHAR));
529 Resize (cur_len + 2);
531 m_Buffer[cur_len] = ch;
532 m_Buffer[cur_len + 1] = m_NullChar;
534 if (ch != m_NullChar) {
535 Store_Length (cur_len + 1);
547 Uninitialised_Grow (new_length);
570 int new_len = cur_len + src_len;
575 Resize (new_len + 1);
576 Store_Length (new_len);
581 ::memcpy (&m_Buffer[cur_len], (
const WCHAR *)
string, (src_len + 1) *
sizeof (WCHAR));
594 new_string += string2;
605 new_string += string2;
616 new_string += string2;
626WideStringClass::Get_Allocated_Length (
void)
const
628 int allocated_length = 0;
633 if (m_Buffer != m_EmptyString) {
634 HEADER *header = Get_Header ();
635 allocated_length = header->allocated_length;
638 return allocated_length;
654 if (m_Buffer != m_EmptyString) {
659 HEADER *header = Get_Header ();
660 length = header->length;
667 length = wcslen (m_Buffer);
682WideStringClass::Set_Buffer_And_Allocated_Length (WCHAR *buffer,
int length)
690 if (m_Buffer != m_EmptyString) {
691 Store_Allocated_Length (length);
704WideStringClass::Allocate_Buffer (
int length)
710 char *
buffer =
W3DNEWARRAY char[(
sizeof (WCHAR) * length) +
sizeof (WideStringClass::_HEADER)];
715 HEADER *header =
reinterpret_cast<HEADER *
>(
buffer);
717 header->allocated_length = length;
722 return reinterpret_cast<WCHAR *
>(
buffer +
sizeof (WideStringClass::_HEADER));
728inline WideStringClass::HEADER *
729WideStringClass::Get_Header (
void)
const
731 return reinterpret_cast<HEADER *
>(((
char *)m_Buffer) -
sizeof (WideStringClass::_HEADER));
738WideStringClass::Store_Allocated_Length (
int allocated_length)
740 if (m_Buffer != m_EmptyString) {
741 HEADER *header = Get_Header ();
742 header->allocated_length = allocated_length;
757WideStringClass::Store_Length (
int length)
759 if (m_Buffer != m_EmptyString) {
760 HEADER *header = Get_Header ();
761 header->length = length;
775 return (
string.Copy_Wide (m_Buffer));
782 return (
string.Copy_Wide (m_Buffer));
bool operator>(const WCHAR *string) const
int Get_Length(void) const
int _cdecl Format(const WCHAR *format,...)
int _cdecl Format_Args(const WCHAR *format, const va_list &arg_list)
friend WideStringClass operator+(const WideStringClass &string1, const WideStringClass &string2)
bool Convert_To(StringClass &string)
bool Convert_From(const char *text)
WCHAR * Peek_Buffer(void)
WCHAR operator[](int index) const
const WideStringClass & operator+=(const WideStringClass &string)
bool operator<(const WCHAR *string) const
static void Release_Resources(void)
WCHAR * Get_Buffer(int new_length)
void Erase(int start_index, int char_count)
int Compare_No_Case(const WCHAR *string) const
WideStringClass(int initial_len=0, bool hint_temporary=false)
bool operator==(const WCHAR *rvalue) const
bool Is_Empty(void) const
int Compare(const WCHAR *string) const
bool operator<=(const WCHAR *string) const
bool operator>=(const WCHAR *string) const
const WideStringClass & operator=(const WideStringClass &string)
bool operator!=(const WCHAR *rvalue) const
LOCALEFILE_HEADERCHUNK HEADER
wchar_t * wcstrim(wchar_t *buffer)
WideStringClass operator+(const WideStringClass &string1, const WideStringClass &string2)