Source code of Windows XP (NT5)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#pragma once
#define CRT_ALLOC 0
#define COM_ALLOC 1
//-----------------------------------------------------------------------------
// Minimal string class
//-----------------------------------------------------------------------------
class CString { public:
enum AllocFlags { COM_Allocator = 0, CRT_Allocator };
enum HashFlags { CaseInsensitive = 0, CaseSensitive };
DWORD _dwSig; HRESULT _hr; LPWSTR _pwz; // Str ptr.
DWORD _cc; // String length
DWORD _ccBuf; // Buffer length
AllocFlags _eAlloc; // Allocator
// ctor
CString(); // ctor w/ allocator
CString(AllocFlags eAlloc);
// dtor
~CString();
// Allocations
HRESULT ResizeBuffer(DWORD ccNew);
// Deallocations
VOID FreeBuffer();
// Assume control for a buffer.
HRESULT TakeOwnership(WCHAR* pwz, DWORD cc); HRESULT TakeOwnership(LPWSTR pwz); // Release control.
HRESULT ReleaseOwnership(); // Direct copy assign from string.
HRESULT Assign(LPWSTR pwzSource);
// Direct copy assign from CString
HRESULT Assign(CString& sSource);
// Append given wchar string.
HRESULT Append(LPWSTR pwzSource);
// Append given CString
HRESULT Append(CString& sSource);
// Return ith element.
WCHAR& operator [] (DWORD i);
HRESULT LastElement(CString &sSource);
HRESULT RemoveLastElement();
HRESULT Combine(LPWSTR pwzSource, BOOL fUrl);
HRESULT PathCombine(LPWSTR pwzSource);
HRESULT PathCombine(CString &sSource);
HRESULT UrlCombine(LPWSTR pwzSource);
HRESULT UrlCombine(CString &sSource);
HRESULT PathFindFileName(LPWSTR *ppwz);
HRESULT PathFindFileName(CString &sPath);
HRESULT PathPrefixMatch(LPWSTR pwzPrefix); // / -> \ in string
VOID PathNormalize();\ VOID Get65599Hash(LPDWORD pdwHash, DWORD dwFlags); };
|