home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- *
- * WStringData
- *
- *************************************************************************/
-
- #ifndef _WSTRDATA_HPP_INCLUDED
- #define _WSTRDATA_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- //
- // Header for the reference-counted string data.
- //
-
- struct WStringData;
-
- struct WStringHeader {
- WULong _stringLength; // length in characters
- WULong _stringSize; // size in bytes
- WULong _bufferSize; // total size of buffer
- WULong _refCount;
- WStringData *_other; // for translation
- WDWord _flags;
-
- void Clear() { _stringLength = _stringSize = _bufferSize =
- _refCount = _flags = 0; _other = NULL; }
- };
-
- //
- // The reference-counted string itself
- //
-
- struct WStringData : public WStringHeader {
- union {
- WAnsiChar _ansiBuffer[1];
- WUnicodeChar _unicodeBuffer[1];
- WChar _buffer[1];
- };
-
- void Clear() { WStringHeader::Clear(); _unicodeBuffer[0] = 0; }
-
- static WStringData * Allocate( WStringData *old, WULong bufSize,
- WBool makeCopy );
-
- static void Deallocate( WStringData *old );
- };
-
- #define WSSTR_DIRTY 0x0001
- #define WSSTR_UNICODE 0x0002
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WSTRDATA_HPP_INCLUDED
-