3 #ifndef GET_SAFE_STRING
4 #define GET_SAFE_STRING(str) ( (str)?(str):_T("") )
9 #define _vsnprintf_hw _vsnwprintf
11 #define _vsnprintf_hw _vsnprintf
14 #define HANDLE_IS_VALID(h) ( (HANDLE)(h)!=NULL && (HANDLE)(h)!=INVALID_HANDLE_VALUE )
17 int FindFromStaticArray ( IN T
*pAry
, IN
int nArySize
, IN T Find
)
19 if ( !pAry
) return -1;
20 for ( int i
=0; i
<nArySize
; i
++ )
22 if ( pAry
[i
] == Find
)
29 // ×¢Ò⣺Èç¹ûÊÇ´Ó CString ÖвéÕÒʱ Find ǧÍò²»ÒªÓà LPCTSTR »òÕß char* ±äÁ¿£¬Ò»¶¨ÊÇÒªÓà CString ±äÁ¿
31 template<class T1
, class T2
>
32 int FindFromArray ( IN T1
&Ary
, IN T2 Find
)
34 int nCount
= (int)Ary
.GetSize();
35 for ( int i
=0; i
<nCount
; i
++ )
37 T2 tGetValue
= Ary
.GetAt(i
);
38 if ( tGetValue
== Find
)
45 // ´ÓÊý×é Ary_Org ÖвéÕÒ£¬Ö»Òª Ary_Find ÖÐÈκÎÒ»¸öÔªËØÔÚ Ary_Org ÖгöÏÖ¹ý
46 // ¾Í·µ»Ø¸ÃÔªËØÔÚ Ary_Org ÖеÄλÖÃ
48 template<class T1
, class T2
>
49 int FindFromArray ( IN T1
&Ary_Org
, IN T1
&Ary_Find
, OUT T2
&Element
)
51 int nCount
= Ary_Find
.GetSize();
52 for ( int i
=0; i
<nCount
; i
++ )
54 T2 tGetValue
= Ary_Find
.GetAt(i
);
55 int nFindPos
= FindFromArray ( Ary_Org
, tGetValue
);
58 Element
= Ary_Org
.GetAt ( nFindPos
);
65 template<class T1
, class T2
, class T3
, class T4
>
66 int FindFromArray ( IN T1
&Ary
, IN T2 Find
, IN T3
&AppAry
, IN T4 AppFind
)
68 int nCount
= Ary
.GetSize();
69 for ( int i
=0; i
<nCount
; i
++ )
71 if ( Ary
.GetAt(i
) == Find
&&
72 AppAry
.GetAt(i
) == AppFind
)
81 int FindFromArray ( IN T1
&Ary_Src
, IN T1
&Ary_Find
)
83 int nCount
= Ary_Src
.GetSize();
84 for ( int i
=0; i
<nCount
; i
++ )
86 if ( FindFromArray ( Ary_Find
, Ary_Src
.GetAt(i
) ) >= 0 )
94 STRING_IS_MULTICHARS
= 0, // ÊǶà×Ö½Ú×Ö·û´®
95 STRING_IS_UNICODE
, // ÊÇUNICODE×Ö·û´®
96 STRING_IS_SOFTCODE
, // ÊǺͳÌÐòÒ»ÑùµÄ×Ö·û´®±àÂë
99 class CMultiByteString
102 CMultiByteString ( LPCTSTR lpszOrg
, int nOrgStringEncodeType
=STRING_IS_SOFTCODE
, OUT
char *pOutBuf
=NULL
, int nOutBufSize
=0 );
103 ~CMultiByteString ();
106 if ( m_pszData
) return m_pszData
;
112 return m_nCharactersNumber
;
114 // »ñÈ¡×Ö·û´®Õ¼ÓÃÄÚ´æ´óС£¨×Ö½ÚÊý£¬°üÀ¨×Ö·û´®½áÊøµÄ'\0'ËùÕ¼µÄλÖã©
120 char *m_pszData
; // ±£´æÄ¿±ê×Ö·û´®µÄ»º³å
121 int m_nDataSize
; // Ä¿±ê×Ö·û´®Õ¼ÓõÄÄÚ´æ´óС£¨×Ö½ÚÊý£¬°üÀ¨×Ö·û´®½áÊøµÄ'\0'£©
122 int m_nCharactersNumber
; // Ä¿±ê×Ö·û´®µÄ¸öÊý
123 BOOL m_bNewBuffer
; // ÊÇ·ñÔÚÕâ¸öÀàÖÐÉêÇëÁËÄÚ´æ
126 CString
GetCompatibleString ( LPVOID lpszOrg
, BOOL bOrgIsUnicode
, int nOrgLength
=-1 );
127 CString
FormatDateTime ( COleDateTime
&DateTime
, LPCTSTR pFormat
);
128 CString
FormatString ( LPCTSTR lpszStr
, ... );
129 int hwGetFileAttr ( LPCTSTR lpFileName
, OUT CFileStatus
*pFileStatus
=NULL
);
130 CString
FormatBytes ( double fBytesNum
, BOOL bShowUnit
=TRUE
, int nFlag
=0 );
131 BOOL
WaitForThreadEnd ( HANDLE
*phThread
, DWORD dwWaitTime
=10*1000 );
133 //{{AFX_INSERT_LOCATION}}
134 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.