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);
|
---|
35 | oStringA(LPCWSTR pUnicode);
|
---|
36 | oStringA(LPCSTR pAscii);
|
---|
37 | oStringA(REFCLSID pclsId);
|
---|
38 | oStringA(const oStringA &ref);
|
---|
39 |
|
---|
40 | operator LPSTR();
|
---|
41 |
|
---|
42 | // Assignment
|
---|
43 | oStringA operator = (const oStringA & string);
|
---|
44 | oStringA operator = (LPCSTR pAscii);
|
---|
45 | oStringA operator = (LPCWSTR pUnicode);
|
---|
46 | oStringA operator = (REFCLSID pClsId);
|
---|
47 |
|
---|
48 | // Concatenation
|
---|
49 | oStringA operator + (const oStringA & string);
|
---|
50 | oStringA operator + (LPCSTR pAscii);
|
---|
51 | oStringA operator + (LPCWSTR pUnicode);
|
---|
52 |
|
---|
53 | // Concatenation & Assignment.
|
---|
54 | oStringA operator += (const oStringA & string);
|
---|
55 | oStringA operator += (LPCSTR pAscii);
|
---|
56 | oStringA operator += (LPCWSTR pUnicode);
|
---|
57 |
|
---|
58 | };
|
---|
59 |
|
---|
60 | class oStringW : public oStringBase
|
---|
61 | {
|
---|
62 | public:
|
---|
63 | oStringW(void);
|
---|
64 | oStringW(int defLen);
|
---|
65 | oStringW(LPCWSTR pUnicode);
|
---|
66 | oStringW(const wchar_t * pUnicode);
|
---|
67 | oStringW(LPCSTR pAscii);
|
---|
68 | oStringW(REFCLSID pclsId);
|
---|
69 | oStringW(const oStringW &ref);
|
---|
70 |
|
---|
71 | operator LPWSTR();
|
---|
72 |
|
---|
73 | // Assignment
|
---|
74 | oStringW operator = (const oStringW & string);
|
---|
75 | oStringW operator = (LPCSTR pAscii);
|
---|
76 | oStringW operator = (LPCWSTR pUnicode);
|
---|
77 | oStringW operator = (const wchar_t * pUnicode);
|
---|
78 | oStringW operator = (REFCLSID pClsId);
|
---|
79 |
|
---|
80 | // Concatenation
|
---|
81 | oStringW operator + (const oStringW & string);
|
---|
82 | oStringW operator + (LPCSTR pAscii);
|
---|
83 | oStringW operator + (LPCWSTR pUnicode);
|
---|
84 | oStringW operator + (const wchar_t * pUnicode);
|
---|
85 |
|
---|
86 | // Concatenation & Assignment.
|
---|
87 | oStringW operator += (const oStringW & string);
|
---|
88 | oStringW operator += (LPCSTR pAscii);
|
---|
89 | oStringW operator += (LPCWSTR pUnicode);
|
---|
90 | oStringW operator += (const wchar_t * pUnicode);
|
---|
91 |
|
---|
92 | };
|
---|
93 |
|
---|
94 | #endif // OSTRING_INCLUDED
|
---|