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