Detailed Description
- See also:
- Class CStr, Character Strings.
- Description:
- A wide character string class. This class uses 16 bits to hold
each character. Methods and operators are provided for calculating
lengths, concatenation, substring operations, character searching,
case conversion, comparison, and formatted writing. All methods are
implemented by the system.
OLE file IO requires the wide characters of WStr.
- Note:
- The memory occupied by a WStr object is cannot be larger than
2Gb.
#include <strclass.h>
List of all members.
Constructor & Destructor Documentation
UtilExport WStr |
( |
const char * |
cs |
) |
|
UtilExport WStr |
( |
const mwchar_t * |
wcstr |
) |
|
Member Function Documentation
UtilExport mwchar_t* data |
( |
|
) |
|
UtilExport const mwchar_t* data |
( |
|
) |
const |
UtilExport operator mwchar_t * |
( |
|
) |
|
UtilExport operator const mwchar_t * |
( |
|
) |
const |
UtilExport void Resize |
( |
int |
nchars |
) |
|
- Parameters:
- int nchars
Specifies the new number of characters for the string.
UtilExport int Length |
( |
|
) |
const |
int length |
( |
|
) |
const [inline] |
UtilExport int ByteCount |
( |
|
) |
const |
UtilExport int LanguageCharacterCount |
( |
|
) |
const |
BOOL isNull |
( |
|
) |
const [inline] |
UtilExport WStr& operator= |
( |
const WStr & |
ws |
) |
|
UtilExport WStr& operator= |
( |
const mwchar_t * |
wcstr |
) |
|
UtilExport WStr& operator= |
( |
const char * |
cstr |
) |
|
UtilExport WStr operator+ |
( |
const WStr & |
ws |
) |
const |
UtilExport WStr& operator+= |
( |
const WStr & |
ws |
) |
|
WStr& Append |
( |
const WStr & |
ws |
) |
[inline] |
{ return ((*this) += ws); }
WStr& append |
( |
const WStr & |
ws |
) |
[inline] |
{ return ((*this) += ws); }
UtilExport WStr& remove |
( |
int |
pos |
) |
|
- Parameters:
- int pos
Specifies the position to begin removing characters.
int N
Specifies the number of characters to remove.
UtilExport WStr& remove |
( |
int |
pos, |
|
|
int |
N |
|
) |
|
|
UtilExport WStr Substr |
( |
int |
start, |
|
|
int |
nchars |
|
) |
|
const |
mwchar_t& operator[] |
( |
int |
i |
) |
[inline] |
{
DbgAssert((buf != NULL) && (i >= 0) && (i <= Length()));
return buf[i];
}
mwchar_t operator[] |
( |
int |
i |
) |
const [inline] |
{
DbgAssert((buf != NULL) && (i >= 0) && (i <= Length()));
return buf[i];
}
UtilExport int first |
( |
mwchar_t |
c |
) |
const |
UtilExport int last |
( |
mwchar_t |
c |
) |
const |
UtilExport int operator== |
( |
const WStr & |
ws |
) |
const |
- Returns:
- Nonzero if the strings are equal; otherwise 0.
UtilExport int operator!= |
( |
const WStr & |
ws |
) |
const |
- Returns:
- Zero if the strings are equal; otherwise 1.
UtilExport int operator< |
( |
const WStr & |
ws |
) |
const |
UtilExport int operator<= |
( |
const WStr & |
ws |
) |
const |
UtilExport int operator> |
( |
const WStr & |
ws |
) |
const |
UtilExport int operator>= |
( |
const WStr & |
ws |
) |
const |
UtilExport void toUpper |
( |
|
) |
|
UtilExport void toLower |
( |
|
) |
|
UtilExport int printf |
( |
const mwchar_t * |
format, |
|
|
|
... |
|
) |
|
|
Write a formatted string into this WStr.
Writes the format string, filled in by the optional arguments
into this WStr. See the
ISO C++ documentation for more information on printf and format
strings.
- Parameters:
-
format |
Specifies how to format the destination string. |
... |
optional arguments to format into the destination string. |
- Precondition:
- format is not null.
- There are the correct number of elliptical arguments to fill
the format string.
- Postcondition:
- This string is replaced with the formatted string.
- Returns:
- The number of characters written to this string, not including
the null terminating character, or a negative value if an error
occurs.
UtilExport int vprintf |
( |
const mwchar_t * |
format, |
|
|
va_list |
args |
|
) |
|
|
Write a formatted string into this WStr.
This method is similar to WStr::printf.
Instead of taking a variable list of arguments as parameter, it
takes a structure representing a variable list of argument. This
allows WStr objects to be
used to build strings based on a format string and a variable
number of arguments:
void LogMessage(WStr* format, ...) {
va_list args;
va_start(args, format);
WStr buf;
buf.printf(format, args);
va_end(args);
}