#ifndef __STRINGUTIL__ #define __STRINGUTIL__ inline int GetANumber(CString &str) { int num=0; int comma=str.Find(_T(',')); if(comma != -1) { num= _ttol(str.Left(comma)); str=str.Mid(comma+1); } else { num= _ttol(str); str.Empty(); } return num; } inline int GetPositiveNumber(CString &str) { int value = GetANumber(str); if(value < 0) return 0; else return value; } inline CString LoadStringResource(UINT nID) { // detect missing string resources CString result; if(!result.LoadString(nID)) { TRACE1("Error: failed to load string resource 0x%04x.\n", nID); // Avoid an annoying assert when displaying a message // box to say that we couldn't load the resource dll ASSERT(AfxGetResourceHandle() == AfxGetInstanceHandle()); } return result; } inline CString TruncateString(LPCTSTR str, int limit) { // truncate a string so that it has at most limit characters // don't truncate mid-character LPCTSTR pEnd = str; while(limit-- && *pEnd) pEnd = CharNext(pEnd); return CString(str, pEnd - str); } inline void ConvertDates( CString &date1, CString &date2 ) { ASSERT( date1[ 2 ] == _T('/') || date1[ 4 ] == _T('/') ); if( date1[ 2 ] == _T('/') ) { ASSERT( date1[ 5 ] == _T('/') ); date1 = date1.Mid( 6 ) + date1.Left( 2 ) + date1.Mid( 3,2 ); date2 = date2.Mid( 6 ) + date2.Left( 2 ) + date2.Mid( 3,2 ); } } // a handy macro for determining # of bytes or wchars in static strings #define STRLEN(str) (sizeof(str)/sizeof(TCHAR) - 1) // provide more familiar sounding names for some generic string functions // some of these are provided by the Shell Lightweight API #include <shlwapi.h> //#define StrNCmp _tcsncmp //#define StrCmp _tcscmp //#define StrStr _tcsstr //#define StrChr _tcschr #define StrLen lstrlen //#define StrCSpn _tcscspn #endif // __STRINGUTIL__
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 19924 | YourUncleBob |
Populate -o //guest/perforce_software/p4win/... //guest/YourUncleBob/p4win/..... |
||
//guest/perforce_software/p4win/main/common/StringUtil.h | |||||
#1 | 16169 | perforce_software | Move files to follow new path scheme for branches. | ||
//guest/perforce_software/p4win/common/StringUtil.h | |||||
#1 | 8562 | Matt Attaway |
These feet never stop running. Initial commit of the P4Win source code. To the best of our knowledge this compiles and runs using the 2013.3 P4 API and VS 2010. Expect a few changes as we refine the build process. Please post any build issues to the forums. |