| 1 | /* $Id: oString.h,v 1.1 2001-04-26 19:26:12 sandervl Exp $ */
 | 
|---|
| 2 | 
 | 
|---|
| 3 | #if !defined(OSTRING_INCLUDED)
 | 
|---|
| 4 | #define OSTRING_INCLUDED
 | 
|---|
| 5 | 
 | 
|---|
| 6 | class oStringBase
 | 
|---|
| 7 | {
 | 
|---|
| 8 | protected:
 | 
|---|
| 9 |     char *      m_strBuf;       // Buffer.
 | 
|---|
| 10 | 
 | 
|---|
| 11 |     long        m_bufLen;       // Current allocated length
 | 
|---|
| 12 |                                 // of buffer (bytes)
 | 
|---|
| 13 |                                 
 | 
|---|
| 14 |     long        m_bytePerChar;  // Number of bytes per character.
 | 
|---|
| 15 |     long        m_strLen;       // Length of string 
 | 
|---|
| 16 |                                 // incl. zero terminator
 | 
|---|
| 17 | 
 | 
|---|
| 18 |     HANDLE      m_Heap;         // heap handle.
 | 
|---|
| 19 | 
 | 
|---|
| 20 |     static long blockSize;
 | 
|---|
| 21 | 
 | 
|---|
| 22 |     oStringBase(long bytePerChar);
 | 
|---|
| 23 |     virtual ~oStringBase();
 | 
|---|
| 24 | 
 | 
|---|
| 25 |     void freeBuf();
 | 
|---|
| 26 |     void getBuf(long newLen);
 | 
|---|
| 27 |     void adjBuf(long newLen);
 | 
|---|
| 28 |     long calcBufLen(long newLen);
 | 
|---|
| 29 | };
 | 
|---|
| 30 | 
 | 
|---|
| 31 | class oStringA : public oStringBase
 | 
|---|
| 32 | {
 | 
|---|
| 33 | public:
 | 
|---|
| 34 |     oStringA(void);
 | 
|---|
| 35 |     oStringA(int defLen, int fill);
 | 
|---|
| 36 |     oStringA(LPCWSTR pUnicode);
 | 
|---|
| 37 |     oStringA(LPCSTR pAscii);
 | 
|---|
| 38 |     oStringA(REFCLSID pclsId);
 | 
|---|
| 39 |     oStringA(const oStringA &ref);
 | 
|---|
| 40 |     oStringA(const ULONG val);
 | 
|---|
| 41 |     oStringA(const LONG val);
 | 
|---|
| 42 |     oStringA(const USHORT val);
 | 
|---|
| 43 |     oStringA(const SHORT val);
 | 
|---|
| 44 | 
 | 
|---|
| 45 |     operator LPSTR();
 | 
|---|
| 46 | 
 | 
|---|
| 47 |     // Assignment
 | 
|---|
| 48 |     oStringA operator =  (const oStringA & string);
 | 
|---|
| 49 |     oStringA operator =  (LPCSTR pAscii);
 | 
|---|
| 50 |     oStringA operator =  (LPCWSTR pUnicode);
 | 
|---|
| 51 |     oStringA operator =  (REFCLSID pClsId);
 | 
|---|
| 52 | 
 | 
|---|
| 53 |     // Concatenation
 | 
|---|
| 54 |     oStringA operator +  (const oStringA & string);
 | 
|---|
| 55 |     oStringA operator +  (LPCSTR pAscii);
 | 
|---|
| 56 |     oStringA operator +  (LPCWSTR pUnicode);
 | 
|---|
| 57 | 
 | 
|---|
| 58 |     // Concatenation & Assignment.
 | 
|---|
| 59 |     oStringA operator += (const oStringA & string);
 | 
|---|
| 60 |     oStringA operator += (LPCSTR pAscii);
 | 
|---|
| 61 |     oStringA operator += (LPCWSTR pUnicode);
 | 
|---|
| 62 | 
 | 
|---|
| 63 | };
 | 
|---|
| 64 | 
 | 
|---|
| 65 | class oStringW : public oStringBase
 | 
|---|
| 66 | {
 | 
|---|
| 67 | public:
 | 
|---|
| 68 |     oStringW(void);
 | 
|---|
| 69 |     oStringW(int defLen, int fill);
 | 
|---|
| 70 |     oStringW(LPCWSTR pUnicode);
 | 
|---|
| 71 |     oStringW(const wchar_t * pUnicode);
 | 
|---|
| 72 |     oStringW(LPCSTR pAscii);
 | 
|---|
| 73 |     oStringW(REFCLSID pclsId);
 | 
|---|
| 74 |     oStringW(const oStringW &ref);
 | 
|---|
| 75 | 
 | 
|---|
| 76 |     operator LPWSTR();
 | 
|---|
| 77 | 
 | 
|---|
| 78 |     // Assignment
 | 
|---|
| 79 |     oStringW operator =  (const oStringW & string);
 | 
|---|
| 80 |     oStringW operator =  (LPCSTR pAscii);
 | 
|---|
| 81 |     oStringW operator =  (LPCWSTR pUnicode);
 | 
|---|
| 82 |     oStringW operator =  (const wchar_t * pUnicode);
 | 
|---|
| 83 |     oStringW operator =  (REFCLSID pClsId);
 | 
|---|
| 84 | 
 | 
|---|
| 85 |     // Concatenation
 | 
|---|
| 86 |     oStringW operator +  (const oStringW & string);
 | 
|---|
| 87 |     oStringW operator +  (LPCSTR pAscii);
 | 
|---|
| 88 |     oStringW operator +  (LPCWSTR pUnicode);
 | 
|---|
| 89 |     oStringW operator +  (const wchar_t * pUnicode);
 | 
|---|
| 90 | 
 | 
|---|
| 91 |     // Concatenation & Assignment.
 | 
|---|
| 92 |     oStringW operator += (const oStringW & string);
 | 
|---|
| 93 |     oStringW operator += (LPCSTR pAscii);
 | 
|---|
| 94 |     oStringW operator += (LPCWSTR pUnicode);
 | 
|---|
| 95 |     oStringW operator += (const wchar_t * pUnicode);
 | 
|---|
| 96 | 
 | 
|---|
| 97 | };
 | 
|---|
| 98 | 
 | 
|---|
| 99 | #endif // OSTRING_INCLUDED
 | 
|---|