3 karl 1.3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development
4 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
|
7 kumpf 1.1 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24 //==============================================================================
25 //
26 // Author: Barbara Packard (barbara_packard@hp.com)
27 //
|
57 kumpf 1.1
58 BSTR Bstr();
59 BOOL Compare(BSTR bStr);
60 BOOL Compare(LPCTSTR szStr);
61
62 // Attributes & Operations
63 // as an array of characters
64 int GetLength() const{return m_nStrLen;}
65 BOOL IsEmpty() const {return m_nBufLen == 0;}
66 int GetBufLength() const {return m_nBufLen;}
67 void Empty(){DeallocBuffer();} // free up the buffer
68 void GetPrintableHex(int len, const unsigned char* data); //format data buffer in hex
69 int Find(TCHAR ch) const;
70 int Find(TCHAR ch, int nStart) const;
71
72
73 LPTSTR Copy();
74
75 operator LPCTSTR() const;
76
77 // overloaded assignment
78 kumpf 1.1 const CMyString& operator=(const CMyString& stringSrc);
79 const CMyString& operator=(LPCWSTR lpsz);
80 const CMyString& operator=(LPCSTR lpsz);
81 const CMyString& operator=(const unsigned char* psz);
82 const CMyString& operator=(BSTR bStr);
83 const CMyString& operator=(String sStr);
84
85 // string concatenation
86 const CMyString& operator+=(const CMyString& stringSrc);
87 const CMyString& operator+=(LPCTSTR lpsz);
|
89 kumpf 1.1
90 // Implementation
91 public:
92 // BOOL LoadString(UINT nID);
93 int Format(LPCTSTR lpszFormat, int iSize, ...);
94 // int Format(UINT nID, int iSize, ...);
95
96 ~CMyString();
97 HRESULT ErrorStatus(){return m_nStatus;}
98
99 protected:
100 void Init();
101 BOOL AllocBuffer(int nLen);
102 void AllocBeforeWrite(int nLen);
103 void AssignCopy( int nLen, LPCTSTR lpsz);
104 void DeallocBuffer();
105 void ConcatCopy(int nLen1, LPCTSTR lpszSrc1, int nLen2, LPCTSTR lpszSrc2);
106 void ConcatInPlace(int nSrcLen, LPCTSTR lpszSrc);
107 int FormatV(LPCTSTR lpszFormat, int iSize, va_list argList);
108
109 // lengths/sizes in characters
110 kumpf 1.1 // (note: an extra character is always allocated)
111 // (note: the buffer storage is always type TCHAR)
112 LPTSTR m_pszData; // actual string (zero terminated)
113 int m_nStrLen; // does not include terminating 0
114 int m_nBufLen; // length of buffer in TCHARs
115 HRESULT m_nStatus;
116 };
117
118 PEGASUS_NAMESPACE_END
119
120 #endif // __MYSTRING_H_
121
|