00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#if !defined(STRING_ARRAY)
00026
00027
#if defined(UNICODE)
00028
00029
#define LPCOSTR LPCSTR
00030
#define LPOSTR LPSTR
00031
#define OCHAR CHAR
00032
00033
#if !defined(_UNICODE)
00034
#define _UNICODE
00035
#endif
00036
00037
#else
00038
00039 #define LPCOSTR LPCWSTR
00040 #define LPOSTR LPWSTR
00041 #define OCHAR WCHAR
00042
00043
#endif
00044
#include <tchar.h>
00045
00046 #define STRING_ARRAY
00047
00048 class CString {
00049 LPTSTR
m_acContents;
00050 LPOSTR m_acConverted;
00051 BOOL m_bConverted;
00052
void Flip(LPCWSTR lpstrIn, LPSTR& lpstrOut);
00053
void Flip(LPCSTR lpstrIn, LPWSTR& lpstrOut);
00054
00055
public:
00056
CString();
00057
CString(
const CString& csRef);
00058
CString(LPCTSTR lpstrRef);
00059
CString(LPCOSTR lpstrRef);
00060
00061
~CString();
00062
00063 BOOL IsEmpty()
const {
return !
m_acContents || !
m_acContents[0]; }
00064
void Empty();
00065
00066 operator LPCTSTR()
const {
return m_acContents; }
00067 operator LPTSTR()
const {
return m_acContents; }
00068 operator LPARAM()
const {
return (LPARAM)
m_acContents; }
00069
operator LPCOSTR();
00070
const CString& operator = (
const CString& csSrc);
00071
const CString& operator = (LPCTSTR lpstrSrc);
00072
const CString& operator = (LPCOSTR lpstrSrc);
00073
CString NameOnly() const;
00074
CString NameAndExtension() const;
00075
void Load(
int id, HINSTANCE hiWhere = NULL);
00076
void Load(HWND hwnd);
00077
void LoadAndFormat(
int id,
00078 HINSTANCE hiWhere,
00079 BOOL bSystemMessage,
00080 DWORD dwNumMsg,
00081 va_list *argList);
00082 BOOL IsEqualString(
CString& csRef1);
00083
00084 friend
CString operator + (const
CString& csRef1, LPCTSTR lpstrRef2);
00085 };
00086
00087 class
CStringArray {
00088 CString m_aStore[20];
00089 CStringArray *m_pcsaNext;
00090 unsigned m_ucUsed;
00091
00092 const unsigned ChunkSize()
const {
00093
return sizeof m_aStore /
sizeof m_aStore[0];
00094 }
00095
00096 LPCTSTR Borrow();
00097
00098
public:
00099
00100 CStringArray();
00101 ~CStringArray();
00102
00103 unsigned Count()
const {
return m_ucUsed; }
00104
00105
00106
void Add(LPCTSTR lpstrNew);
00107
00108
CString& operator [](
unsigned u)
const;
00109
00110
void Remove(
unsigned u);
00111
void Empty();
00112
00113
00114
00115
unsigned Map(LPCTSTR lpstrRef);
00116 };
00117
00118 class CUintArray {
00119 unsigned m_aStore[20];
00120 CUintArray *m_pcuaNext;
00121 unsigned m_ucUsed;
00122
00123 const unsigned ChunkSize()
const {
00124
return sizeof m_aStore /
sizeof m_aStore[0];
00125 }
00126
00127
unsigned Borrow();
00128
00129
public:
00130
00131
CUintArray();
00132 ~
CUintArray();
00133
00134 unsigned Count()
const {
return m_ucUsed; }
00135
00136
00137
void Add(
unsigned u);
00138
00139
unsigned operator [](
unsigned u)
const;
00140
00141
void Remove(
unsigned u);
00142
void Empty();
00143 };
00144
00145
#endif