Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CString Class Reference

#include <stringar.h>

List of all members.

Public Member Functions

 CString ()
 CString (const CString &csRef)
 CString (LPCTSTR lpstrRef)
 CString (LPCOSTR lpstrRef)
 ~CString ()
BOOL IsEmpty () const
void Empty ()
 operator LPCTSTR () const
 operator LPTSTR () const
 operator LPARAM () const
 operator LPCOSTR ()
const CStringoperator= (const CString &csSrc)
const CStringoperator= (LPCTSTR lpstrSrc)
const CStringoperator= (LPCOSTR lpstrSrc)
CString NameOnly () const
CString NameAndExtension () const
void Load (int id, HINSTANCE hiWhere=NULL)
void Load (HWND hwnd)
void LoadAndFormat (int id, HINSTANCE hiWhere, BOOL bSystemMessage, DWORD dwNumMsg, va_list *argList)
BOOL IsEqualString (CString &csRef1)

Private Member Functions

void Flip (LPCWSTR lpstrIn, LPSTR &lpstrOut)
void Flip (LPCSTR lpstrIn, LPWSTR &lpstrOut)

Private Attributes

LPTSTR m_acContents
LPOSTR m_acConverted
BOOL m_bConverted

Friends

CString operator+ (const CString &csRef1, LPCTSTR lpstrRef2)


Constructor & Destructor Documentation

CString::CString  ) 
 

Definition at line 101 of file stringar.cpp.

References FALSE, m_acContents, m_acConverted, m_bConverted, and NULL.

00101 { 00102 m_acContents = NULL; 00103 m_acConverted = NULL; 00104 m_bConverted = FALSE; 00105 }

CString::CString const CString csRef  ) 
 

Definition at line 107 of file stringar.cpp.

References FALSE, m_acContents, m_acConverted, m_bConverted, and NULL.

00107 { 00108 m_acContents = csRef.m_acContents ? _tcsdup(csRef.m_acContents) : NULL; 00109 m_acConverted = NULL; 00110 m_bConverted = FALSE; 00111 }

CString::CString LPCTSTR  lpstrRef  ) 
 

Definition at line 113 of file stringar.cpp.

References FALSE, m_acContents, m_acConverted, m_bConverted, and NULL.

00113 { 00114 m_acContents = lpstrRef ? _tcsdup(lpstrRef) : NULL; 00115 m_acConverted = NULL; 00116 m_bConverted = FALSE; 00117 }

CString::CString LPCOSTR  lpstrRef  ) 
 

Definition at line 119 of file stringar.cpp.

References FALSE, Flip(), m_acContents, m_acConverted, m_bConverted, and NULL.

00119 { 00120 m_acConverted = NULL; 00121 m_bConverted = FALSE; 00122 00123 if (!lpstrRef) { 00124 m_acContents = NULL; 00125 return; 00126 } 00127 00128 Flip(lpstrRef, m_acContents); 00129 }

CString::~CString  ) 
 

Definition at line 133 of file stringar.cpp.

References Empty().

00133 { 00134 Empty(); 00135 }


Member Function Documentation

void CString::Empty  ) 
 

Definition at line 79 of file stringar.cpp.

References FALSE, m_acContents, m_acConverted, m_bConverted, and NULL.

Referenced by CDeviceProfileManagement::FillList(), Load(), LoadAndFormat(), operator=(), CColorMatchDialog::~CColorMatchDialog(), and ~CString().

00079 { 00080 if (m_acContents) 00081 free(m_acContents); 00082 00083 if (m_acConverted) 00084 free(m_acConverted); 00085 00086 m_acContents = NULL; 00087 m_acConverted = NULL; 00088 m_bConverted = FALSE; 00089 }

void CString::Flip LPCSTR  lpstrIn,
LPWSTR &  lpstrOut
[private]
 

Definition at line 56 of file stringar.cpp.

References Flip(), and NULL.

00056 { 00057 if (!lpstrIn) { 00058 lpstrOut = NULL; 00059 return; 00060 } 00061 00062 int iLength = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpstrIn, -1, 00063 NULL, 0); 00064 00065 if (!iLength) { 00066 lpstrOut = NULL; 00067 return; 00068 } 00069 00070 lpstrOut = (LPWSTR) malloc(++iLength * sizeof (WCHAR)); 00071 if(lpstrOut) { 00072 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpstrIn, -1, lpstrOut, 00073 iLength); 00074 } 00075 }

void CString::Flip LPCWSTR  lpstrIn,
LPSTR &  lpstrOut
[private]
 

Definition at line 34 of file stringar.cpp.

References Flip(), and NULL.

Referenced by CString(), Flip(), operator LPCOSTR(), and operator=().

00034 { 00035 if (!lpstrIn) { 00036 lpstrOut = NULL; 00037 return; 00038 } 00039 int iLength = WideCharToMultiByte(CP_ACP, 0, lpstrIn, -1, NULL, 0, NULL, 00040 NULL); 00041 00042 if (!iLength) { 00043 lpstrOut = NULL; 00044 return; 00045 } 00046 00047 lpstrOut = (LPSTR) malloc(++iLength); 00048 if(lpstrOut) { 00049 WideCharToMultiByte(CP_ACP, 0, lpstrIn, -1, lpstrOut, iLength, NULL, 00050 NULL); 00051 } 00052 }

BOOL CString::IsEmpty  )  const [inline]
 

Definition at line 63 of file stringar.h.

References BOOL, and m_acContents.

Referenced by CColorMatchDialog::CompleteInitialization(), CProfile::Enumerate(), CDeviceProfileManagement::FillList(), CColorMatchDialog::FillStructure(), IsEqualString(), CICMUserInterface::Load(), CColorMatchDialog::OnInit(), operator+(), and CColorMatchDialog::UpdateControls().

00063 { return !m_acContents || !m_acContents[0]; }

BOOL CString::IsEqualString CString csRef1  ) 
 

Definition at line 93 of file stringar.cpp.

References BOOL, FALSE, IsEmpty(), IsEqualString(), and m_acContents.

Referenced by IsEqualString(), and CColorMatchDialog::OnCommand().

00094 { 00095 if (IsEmpty() || csRef1.IsEmpty()) 00096 return (FALSE); 00097 00098 return (_tcsicmp(m_acContents,(LPTSTR)csRef1) == 0); 00099 }

void CString::Load HWND  hwnd  ) 
 

Definition at line 202 of file stringar.cpp.

References Empty(), GetWindowText(), GetWindowTextLength(), Load(), and m_acContents.

00202 { 00203 Empty(); 00204 00205 int iccNeeded = GetWindowTextLength(hwnd); 00206 if (!iccNeeded) 00207 return; 00208 m_acContents = (LPTSTR) malloc(++iccNeeded * sizeof (TCHAR)); 00209 if(m_acContents) { 00210 GetWindowText(hwnd, m_acContents, iccNeeded); 00211 } 00212 }

void CString::Load int  id,
HINSTANCE  hiWhere = NULL
 

Definition at line 189 of file stringar.cpp.

References CGlobals::Instance(), Load(), and MAX_PATH.

Referenced by CAddProfileDialog::CAddProfileDialog(), CColorMatchDialog::CompleteInitialization(), CMonitorProfileManagement::FillList(), CPrinterProfileManagement::FillList(), CICMUserInterface::GetCommandString(), CDeviceProfileManagement::GetDeviceTypeString(), Load(), LoadAndFormat(), CProfilePropertySheet::OnInit(), CProfileInformationPage::OnInit(), CColorMatchDialog::OnInit(), CAddProfileDialog::OpenFileHookProc(), CICMUserInterface::QueryContextMenu(), CGlobals::Report(), and CGlobals::ReportEx().

00189 { 00190 00191 if (!hi) 00192 hi = CGlobals::Instance(); 00193 00194 TCHAR acWork[MAX_PATH]; 00195 LoadString(hi, id, acWork, MAX_PATH); 00196 *this = acWork; 00197 }

void CString::LoadAndFormat int  id,
HINSTANCE  hiWhere,
BOOL  bSystemMessage,
DWORD  dwNumMsg,
va_list *  argList
 

Definition at line 214 of file stringar.cpp.

References dwFlags, DWORD, Empty(), Load(), LoadAndFormat(), lpSource, and NULL.

Referenced by LoadAndFormat(), and CGlobals::ReportEx().

00215 { 00216 Empty(); 00217 00218 TCHAR acWork[1024]; 00219 CString csTemplate; 00220 LPTSTR lpSource; 00221 DWORD dwFlags; 00222 00223 if (bSystemMessage) { 00224 lpSource = NULL; 00225 dwFlags = FORMAT_MESSAGE_FROM_SYSTEM; 00226 } else { 00227 csTemplate.Load(id); 00228 lpSource = csTemplate; 00229 dwFlags = FORMAT_MESSAGE_FROM_STRING; 00230 id = 0; 00231 } 00232 00233 if (FormatMessage(dwFlags,lpSource, id, 0, acWork, 1024, argList)) { 00234 *this = acWork; 00235 } 00236 }

CString CString::NameAndExtension  )  const
 

Definition at line 176 of file stringar.cpp.

References m_acContents, and NULL.

Referenced by CProfile::Associate(), CColorMatchDialog::CColorMatchDialog(), CProfile::Dissociate(), CProfile::Install(), and CProfile::Uninstall().

00176 { 00177 TCHAR acName[_MAX_FNAME], acExtension[_MAX_EXT]; 00178 00179 if (!m_acContents) 00180 return *this; 00181 00182 _tsplitpath(m_acContents, NULL, NULL, acName, acExtension); 00183 00184 lstrcat(acName, acExtension); 00185 00186 return acName; 00187 }

CString CString::NameOnly  )  const
 

Definition at line 165 of file stringar.cpp.

References m_acContents, and NULL.

Referenced by CProfile::AssociationCheck(), CProfile::GetName(), CProfile::InstallCheck(), and CGlobals::IsInstalled().

00165 { 00166 TCHAR acName[_MAX_FNAME]; 00167 00168 if (!m_acContents) 00169 return *this; 00170 00171 _tsplitpath(m_acContents, NULL, NULL, acName, NULL); 00172 00173 return acName; 00174 }

CString::operator LPARAM  )  const [inline]
 

Definition at line 68 of file stringar.h.

References m_acContents.

00068 { return (LPARAM) m_acContents; }

CString::operator LPCOSTR  ) 
 

Definition at line 139 of file stringar.cpp.

References Flip(), m_acContents, m_acConverted, m_bConverted, and TRUE.

00139 { 00140 if (!m_bConverted) { 00141 Flip(m_acContents, m_acConverted); 00142 m_bConverted = TRUE; 00143 } 00144 return m_acConverted; 00145 }

CString::operator LPCTSTR  )  const [inline]
 

Definition at line 66 of file stringar.h.

References m_acContents.

00066 { return m_acContents; }

CString::operator LPTSTR  )  const [inline]
 

Definition at line 67 of file stringar.h.

References m_acContents.

00067 { return m_acContents; }

const CString & CString::operator= LPCOSTR  lpstrSrc  ) 
 

Definition at line 159 of file stringar.cpp.

References Empty(), Flip(), and m_acContents.

00159 { 00160 Empty(); 00161 Flip(lpstrSrc, m_acContents); 00162 return *this; 00163 }

const CString & CString::operator= LPCTSTR  lpstrSrc  ) 
 

Definition at line 153 of file stringar.cpp.

References Empty(), m_acContents, and NULL.

00153 { 00154 Empty(); 00155 m_acContents = lpstrSrc ? _tcsdup(lpstrSrc) : NULL; 00156 return *this; 00157 }

const CString & CString::operator= const CString csSrc  ) 
 

Definition at line 147 of file stringar.cpp.

References Empty(), m_acContents, and NULL.

00147 { 00148 Empty(); 00149 m_acContents = csSrc.m_acContents ? _tcsdup(csSrc.m_acContents) : NULL; 00150 return *this; 00151 }


Friends And Related Function Documentation

CString operator+ const CString csRef1,
LPCTSTR  lpstrRef2
[friend]
 

Definition at line 238 of file stringar.cpp.

00238 { 00239 if (!lpstrRef || !*lpstrRef) 00240 return csRef; 00241 00242 if (csRef.IsEmpty()) 00243 return lpstrRef; 00244 00245 CString csReturn; 00246 00247 csReturn.m_acContents = (LPTSTR) malloc((1 + lstrlen(csRef.m_acContents) + 00248 lstrlen(lpstrRef)) * sizeof(TCHAR)); 00249 if(csReturn.m_acContents) { 00250 lstrcat(lstrcpy(csReturn.m_acContents, csRef.m_acContents), lpstrRef); 00251 } 00252 00253 return csReturn; 00254 }


Member Data Documentation

LPTSTR CString::m_acContents [private]
 

Definition at line 49 of file stringar.h.

Referenced by CString(), Empty(), IsEmpty(), IsEqualString(), Load(), NameAndExtension(), NameOnly(), operator LPARAM(), operator LPCOSTR(), operator LPCTSTR(), operator LPTSTR(), operator+(), and operator=().

LPOSTR CString::m_acConverted [private]
 

Definition at line 50 of file stringar.h.

Referenced by CString(), Empty(), and operator LPCOSTR().

BOOL CString::m_bConverted [private]
 

Definition at line 51 of file stringar.h.

Referenced by CString(), Empty(), and operator LPCOSTR().


The documentation for this class was generated from the following files:
Generated on Sat May 15 19:46:28 2004 for test by doxygen 1.3.7