本文整理汇总了C++中CStringList::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringList::IsEmpty方法的具体用法?C++ CStringList::IsEmpty怎么用?C++ CStringList::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringList
的用法示例。
在下文中一共展示了CStringList::IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRequiredBufferSize
DWORD CShellFileOp::GetRequiredBufferSize ( const CStringList& list )
{
DWORD dwRetVal = 0;
POSITION pos;
CString cstr;
// If this assert fires, the passed-in list was empty. This ought to
// never fire, actually, since Go() won't even call this function if
// either list is empty.
ASSERT ( !list.IsEmpty() );
pos = list.GetHeadPosition();
while ( NULL != pos )
{
cstr = list.GetNext ( pos );
// **NOTE** The MFC docs for CString::GetLength() say that it returns
// the number of bytes in the string, but that's wrong!! In Unicode,
// it returns the number of characters (which is half the number of
// bytes). Thus the multiplication by sizeof(TCHAR).
dwRetVal += sizeof(TCHAR) * ( cstr.GetLength() + 1 );
}
return dwRetVal + sizeof(TCHAR); // add one more for the final null
}
示例2: FillSzzBuffer
void CShellFileOp::FillSzzBuffer ( TCHAR* pBuffer, const CStringList& list )
{
TCHAR* pCurrPos;
POSITION pos;
CString cstr;
// If this assert fires, the passed-in list was empty. This ought to
// never fire, actually, since Go() won't even call this function if
// either list is empty when it shouldn't be.
ASSERT ( !list.IsEmpty() );
ASSERT ( pBuffer != NULL );
pCurrPos = pBuffer;
pos = list.GetHeadPosition();
while ( NULL != pos )
{
cstr = list.GetNext ( pos );
_tcscpy ( pCurrPos, (LPCTSTR) cstr );
pCurrPos = _tcsinc ( _tcschr ( pCurrPos, '\0' ) );
}
// Tack on the final null
*pCurrPos = '\0';
}
示例3: PurgeDeletes
void CDownloads::PurgeDeletes()
{
CStringList pRemove;
HKEY hKey = NULL;
if ( ERROR_SUCCESS != RegOpenKeyEx( HKEY_CURRENT_USER,
_T("Software\\Shareaza\\Shareaza\\Delete"), 0, KEY_ALL_ACCESS, &hKey ) ) return;
for ( DWORD nIndex = 0 ; nIndex < 1000 ; nIndex ++ )
{
DWORD nPath = MAX_PATH*2;
TCHAR szPath[MAX_PATH*2];
if ( ERROR_SUCCESS != RegEnumValue( hKey, nIndex, szPath, &nPath, NULL,
NULL, NULL, NULL ) ) break;
if ( GetFileAttributes( szPath ) == 0xFFFFFFFF || DeleteFile( szPath ) )
{
pRemove.AddTail( szPath );
}
}
while ( ! pRemove.IsEmpty() )
{
RegDeleteValue( hKey, pRemove.RemoveHead() );
}
RegCloseKey( hKey );
}
示例4: IsPick
BOOL IsPick(CString itemName){
if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_QJ)){
return TRUE;
}
if ( pickItemNameList.IsEmpty()){
return false;
}else if(pickItemNameList.Find(itemName)){
return true;
}
return false;
}
示例5: load_menub
void CWizDlg::load_menub(POSITION ps)
{
CStringList bList;
bookm.DestroyMenu();
bookm.CreatePopupMenu();
Recents.GetHead()->load_menu_bm(bList);
UINT itm=150;
POSITION p=bList.GetHeadPosition();
while (p)
bookm.AppendMenu(MF_STRING,itm++,bList.GetNext(p));
bookm.AppendMenu(MF_SEPARATOR,itm++);
bookm.AppendMenu(MF_STRING,itm++,"Store bookmarks list in memo");
bookm.EnableMenuItem(itm-1, ( bList.IsEmpty() )? MF_GRAYED:0);
}
示例6: ListToString
// takes a list of strings and converts it to a string like "apples,peaches,pears"
void ListToString (const CStringList & thelist, const char delim, CString & str)
{
int iCount = 0;
str.Empty ();
if (thelist.IsEmpty ())
return;
for (POSITION pos = thelist.GetHeadPosition (); pos; )
{
str += thelist.GetNext (pos);
if (++iCount < thelist.GetCount ())
str += delim;
} // end of getting each one
} // end of ListToString
示例7: ExtractParams
bool ExtractParams(CString data, CStringList ¶ms)
{
CString param;
params.RemoveAll();
for(int i = 0; ; i++)
{
if(ExtractParam(data, param, i))
{
params.AddTail(param);
}
else
{
break;
}
}
return !params.IsEmpty();
}
示例8: getValues
bool CRegistryKey::getValues(CStringList& values)
{
values.RemoveAll();
if (RegOpenKeyEx(m_base, m_path, 0, KEY_EXECUTE|m_sam, &m_hKey)==ERROR_SUCCESS)
{
for (int i = 0, rc = ERROR_SUCCESS; rc == ERROR_SUCCESS; ++i)
{
TCHAR value[255] = { 0 };
DWORD size = _countof(value);
rc = RegEnumValue(m_hKey, i, value, &size, nullptr, nullptr, nullptr, nullptr);
if (rc == ERROR_SUCCESS)
values.AddTail(value);
}
}
return !values.IsEmpty();
}
示例9: getSubKeys
bool CRegistryKey::getSubKeys(CStringList& subkeys)
{
subkeys.RemoveAll();
if (RegOpenKeyEx(m_base, m_path, 0, KEY_EXECUTE|m_sam, &m_hKey)==ERROR_SUCCESS)
{
for (int i = 0, rc = ERROR_SUCCESS; rc == ERROR_SUCCESS; ++i)
{
TCHAR value[1024] = { 0 };
DWORD size = _countof(value);
FILETIME last_write_time;
rc = RegEnumKeyEx(m_hKey, i, value, &size, nullptr, nullptr, nullptr, &last_write_time);
if (rc == ERROR_SUCCESS)
subkeys.AddTail(value);
}
}
return !subkeys.IsEmpty();
}
示例10: OnSetActive
BOOL CPackagePage::OnSetActive()
{
SetWizardButtons( PSWIZB_BACK | PSWIZB_NEXT );
if ( ! theApp.m_sCommandLineSourceFile.IsEmpty() )
{
CStringList oDirs;
oDirs.AddTail( theApp.m_sCommandLineSourceFile );
theApp.m_sCommandLineSourceFile.Empty();
while ( ! oDirs.IsEmpty() )
{
CString strFolder = oDirs.RemoveHead() + _T("\\");
CFileFind finder;
BOOL bWorking = finder.FindFile( strFolder + _T("*.*") );
while ( bWorking )
{
bWorking = finder.FindNextFile();
if ( ! finder.IsDots() && ! finder.IsHidden() )
{
CString sFilename = strFolder + finder.GetFileName();
if ( finder.IsDirectory() )
oDirs.AddTail( sFilename );
else
AddFile( sFilename );
}
}
}
if ( m_wndList.GetItemCount() > 0 )
Next();
}
m_wndRemove.EnableWindow( m_wndList.GetSelectedCount() > 0 );
UpdateData( FALSE );
return CWizardPage::OnSetActive();
}
示例11: PreProcess
void CCmd_ListOpStat::PreProcess(BOOL& done)
{
int i;
POSITION pos;
CCmd_ListOp cmd1(m_pClient);
// Set up and run ListOp synchronously
cmd1.Init(NULL, RUN_SYNC);
cmd1.SetChkForSyncs(m_ChkForSyncs);
cmd1.SetWarnIfLocked(m_WarnIfLocked);
if(cmd1.Run(m_pFileSpecs, m_Command, m_ChangeNumber, m_NewType))
{
m_FatalError= cmd1.GetError();
done=TRUE;
if (m_ChkForSyncs)
{
CStringList * pSyncList = cmd1.GetSyncList();
if (!pSyncList->IsEmpty())
{
for( pos= pSyncList->GetHeadPosition(); pos!= NULL; )
m_Unsynced.AddHead( pSyncList->GetNext(pos) );
CStringList * pEditList = cmd1.GetList();
for( pos= pEditList->GetHeadPosition(); pos!= NULL; )
{
CString txt = pEditList->GetNext(pos);
if ((i = txt.Find(_T('#'))) != -1)
txt = txt.Left(i);
m_RevertIfCancel.AddHead( txt );
}
}
else m_ChkForSyncs = FALSE;
}
}
else
{
m_ErrorTxt= _T("Unable to Run ListOp");
m_FatalError=TRUE;
}
// Extract the CStringList from ListOp, which has filtered
// results for the command. Note that Errors, warnings and
// gee-whiz info have been thrown to the status window and
// are not in the list
CStringList *strList= cmd1.GetList();
// Check for huge file sets, where incremental screen update can take
// a very looong time to complete. We are more tolerant for repoens,
// because they involve updates in only one pane
if(!m_FatalError && m_Command== P4REOPEN && strList->GetCount() > (3 * MAX_FILESEEKS))
{
m_HitMaxFileSeeks= TRUE;
TheApp()->StatusAdd(_T("CCmd_ListOpStat/P4REOPEN hit MAX_FILESEEKS - blowing off incremental update"), SV_DEBUG);
}
else if(!m_FatalError && m_Command!= P4REOPEN && strList->GetCount() > MAX_FILESEEKS)
{
m_HitMaxFileSeeks= TRUE;
TheApp()->StatusAdd(_T("CCmd_ListOpStat hit MAX_FILESEEKS - blowing off incremental update"), SV_DEBUG);
}
// In the usual case of zero to a few hundred files, gather ostat-like info
// for each file so that screen updates can be completed
else if(!m_FatalError && strList->GetCount() > 0)
{
// Save a copy of the stringlist.
for( pos= strList->GetHeadPosition(); pos!= NULL; )
m_StrListOut.AddHead( strList->GetNext(pos) );
// See if we need to run Ostat
if(m_Command==P4EDIT || m_Command==P4DELETE)
{
// Set up and run ostat synchronously
CCmd_Ostat cmd2(m_pClient);
cmd2.Init(NULL, RUN_SYNC);
if(cmd2.Run(FALSE, m_ChangeNumber))
m_FatalError= cmd2.GetError();
else
{
m_ErrorTxt= _T("Unable to Run Ostat");
m_FatalError=TRUE;
}
CObArray const *array= cmd2.GetArray();
if(!m_FatalError && array->GetSize() > 0)
{
// Save a copy of the oblist.
for( int i=0; i < array->GetSize(); i++ )
m_StatList.AddHead( array->GetAt(i) );
}
}
else
PrepareStatInfo();
}
// Post the completion message
if(!m_FatalError)
{
CString message;
int already = 0;
int reopened = 0;
//.........这里部分代码省略.........
示例12: MXP_OpenAtomicTag
// do the action required to open a single atomic tag (iAction)
void CMUSHclientDoc::MXP_OpenAtomicTag (const CString strTag,
int iAction,
CStyle * pStyle,
CString & strAction, // new action
CString & strHint, // new hint
CString & strVariable, // new variable
CArgumentList & ArgumentList)
{
CString strArgument;
CString strArgumentName;
bool bIgnoreUnusedArgs = false; // cut down on some spam by setting this
COLORREF colour1,
colour2;
unsigned short iFlags = pStyle->iFlags;
COLORREF iForeColour = pStyle->iForeColour;
COLORREF iBackColour = pStyle->iBackColour;
// call script if required
if (m_dispidOnMXP_OpenTag != DISPID_UNKNOWN || m_bPluginProcessesOpenTag)
{
// dummy-up an argument list
CString strArgument;
CArgument * pArgument;
POSITION pos;
// put the arguments into the array
for (pos = ArgumentList.GetHeadPosition (); pos; )
{
pArgument = ArgumentList.GetNext (pos);
// empty ones we will put there by position
if (pArgument->strName.IsEmpty ())
strArgument += CFormat ("'%s'",
(LPCTSTR) pArgument->strValue);
else
strArgument += CFormat ("%s='%s'",
(LPCTSTR) pArgument->strName,
(LPCTSTR) pArgument->strValue);
if (pos)
strArgument += " ";
} // end of looping through each argument
bool bNotWanted = MXP_StartTagScript (strTag, strArgument, ArgumentList);
// re-get current style in case the script did a world.note
pStyle = m_pCurrentLine->styleList.GetTail ();
// put things backt to how they were
pStyle->iFlags = iFlags;
pStyle->iForeColour = iForeColour;
pStyle->iBackColour = iBackColour;
if (bNotWanted)
return; // they didn't want to go ahead with this tag
}
// find current foreground and background RGB values
GetStyleRGB (pStyle, colour1, colour2);
// special processing for Pueblo
// a tag like this: <A XCH_CMD="examine #1">
// will convert to a SEND tag
if (iAction == MXP_ACTION_HYPERLINK &&
PUEBLO_ACTIVE)
{
strArgument = GetArgument (ArgumentList, "xch_cmd", 0, true);
if (!strArgument.IsEmpty ())
{
m_bPuebloActive = true; // for correct newline processing
iAction = MXP_ACTION_SEND;
}
}
// now take the action
switch (iAction)
{
// temporarily make headlines the same as bold
case MXP_ACTION_H1:
case MXP_ACTION_H2:
case MXP_ACTION_H3:
case MXP_ACTION_H4:
case MXP_ACTION_H5:
case MXP_ACTION_H6:
case MXP_ACTION_BOLD: pStyle->iFlags |= HILITE; break;
case MXP_ACTION_UNDERLINE: pStyle->iFlags |= UNDERLINE; break;
case MXP_ACTION_ITALIC: pStyle->iFlags |= BLINK; break;
case MXP_ACTION_COLOR:
{
//.........这里部分代码省略.........
示例13: Get_XML_date
bool Get_XML_date (CXMLelement & node,
const char * sName,
CTime & tValue,
const bool bUseDefault)
{
CString strValue;
if (!Get_XML_string (node, sName, strValue, true, true))
if (bUseDefault)
return false;
else
{
tValue = 0; // default is no time
return false;
}
if (strValue.IsEmpty ())
ThrowErrorException ("No time supplied for attribute named '%s'" ,
sName);
// break up date into date portion / time portion
CStringList strDateTime;
StringToList (strValue, " ", strDateTime);
if (strDateTime.GetCount () < 1 || strDateTime.GetCount () > 2)
ThrowErrorException ("Date/time must consist of YYYY-MM-DD [ HH:MM:SS ]");
CString strDate = strDateTime.RemoveHead ();
CString strTime;
if (!strDateTime.IsEmpty ())
strTime = strDateTime.RemoveHead ();
CString strYear, strMonth, strDay;
CStringList strDateList;
StringToList (strDate, "-", strDateList);
if (strDateList.GetCount () != 3)
ThrowErrorException ("Date must consist of YYYY-MM-DD");
strYear = strDateList.RemoveHead ();
strMonth = strDateList.RemoveHead ();
strDay = strDateList.RemoveHead ();
if (!IsNumber (strYear))
ThrowErrorException ("Year is not numeric");
if (!IsNumber (strMonth))
ThrowErrorException ("Month is not numeric");
if (!IsNumber (strDay))
ThrowErrorException ("Day is not numeric");
int iYear, iMonth, iDay;
iYear = atoi (strYear);
iMonth = atoi (strMonth);
iDay = atoi (strDay);
if (iYear < 1900 || iYear > 2100)
ThrowErrorException ("Year must be in range 1900 to 2100");
if (iMonth < 1 || iMonth > 12)
ThrowErrorException ("Month must be in range 1 to 12");
if (iDay < 1 || iDay > 31)
ThrowErrorException ("Month must be in range 1 to 31");
int iHour = 0, iMinute = 0, iSecond = 0;
if (!strTime.IsEmpty ())
{
CString strHour, strMinute, strSecond;
CStringList strTimeList;
StringToList (strTime, ":", strTimeList);
if (strTimeList.GetCount () > 3)
ThrowErrorException ("Time must consist of HH, HH:MM, or HH:MM:SS");
strHour = strTimeList.RemoveHead ();
strMinute = "0";
strSecond = "0";
if (!strTimeList.IsEmpty ())
{
strMinute = strTimeList.RemoveHead ();
if (!strTimeList.IsEmpty ())
strSecond = strTimeList.RemoveHead ();
}
if (!IsNumber (strHour))
ThrowErrorException ("Hour is not numeric");
if (!IsNumber (strMinute))
ThrowErrorException ("Minute is not numeric");
if (!IsNumber (strSecond))
ThrowErrorException ("Second is not numeric");
iHour = atoi (strHour);
iMinute = atoi (strMinute);
//.........这里部分代码省略.........
示例14: OnInitDialog
BOOL CFileSharingPage::OnInitDialog()
{
CFilePropertiesPage::OnInitDialog();
m_wndTags.AddString( _T("") );
if ( UploadQueues.m_pSection.Lock() )
{
CStringList pAdded;
for ( POSITION pos = UploadQueues.GetIterator() ; pos ; )
{
CUploadQueue* pQueue = UploadQueues.GetNext( pos );
if ( pQueue->m_sShareTag.GetLength() )
{
if ( pAdded.Find( pQueue->m_sShareTag ) == NULL )
{
pAdded.AddTail( pQueue->m_sShareTag );
m_wndTags.AddString( pQueue->m_sShareTag );
}
}
}
UploadQueues.m_pSection.Unlock();
if ( pAdded.IsEmpty() )
{
m_wndTags.AddString( _T("Release") );
m_wndTags.AddString( _T("Popular") );
}
}
{
CQuickLock oLock( Library.m_pSection );
if ( CLibraryFile* pFile = GetFile() )
{
m_bOverride = pFile->m_bShared != TS_UNKNOWN;
m_bShare = pFile->IsShared();
m_sTags = pFile->m_sShareTags;
}
else if ( CLibraryList* pList = GetList() )
{
for ( POSITION pos = pList->GetIterator() ; pos ; )
{
if ( CLibraryFile* pFile = pList->GetNextFile( pos ) )
{
m_bOverride = pFile->m_bShared != TS_UNKNOWN;
m_bShare = pFile->IsShared();
m_sTags = pFile->m_sShareTags;
}
}
}
}
UpdateData( FALSE );
m_wndShare.EnableWindow( m_bOverride );
return TRUE;
}
示例15: strncmp
DLL_DECL void
DesertFinit_Apply(const char *applyConstraints)
{
CManager::theInstance->AnalyseConstraints();
CManager::theInstance->GenerateNextHierarchy();
if (CManager::theInstance->HasConstraints())
{
if (applyConstraints)
{
CStringList cNames;
bool applyAll = strncmp(applyConstraints, "applyAll", 8) == 0;
if (!applyAll)
{
char *cons = strdup(applyConstraints);
char *cName = strtok( cons, ":" );
while(cName)
{
cNames.AddTail( cName );
cName = strtok( NULL, ":" );
}
if(cNames.IsEmpty()) return;
}
CDynConstraintSet *set = new CDynConstraintSet(0);
set->RemoveAll();
CDynConstraintSetList & setlist = CManager::theInstance->GetConstraintSets();
POSITION sl_pos = setlist.GetHeadPosition();
while (sl_pos)
{
CDynConstraintSet * setlist_i = setlist.GetNext(sl_pos);
CDynConstraintList& list = setlist_i->GetConstraints();
POSITION pos1 = list.GetHeadPosition();
while(pos1)
{
CDynConstraint *cur = list.GetNext(pos1);
const CString& nm = cur->GetName();
if (applyAll || cNames.Find(nm))
{
Info("DesertFinit", "Applying Constraint: %s", nm);
cur->SetApplied();
set->InsertConstraint(cur);
}
}
}
// prune & generate next hierarchy
double dspSize;
long repSize;
long clockTime;
try{
CManager::theInstance->GetSizeInfo(dspSize, repSize, clockTime, set);
}catch(CDesertException *e)
{
CManager::theInstance->GenerateNextHierarchy();
set->RemoveAll();
delete set;
throw e;
}
// Info("DesertFinit", "Design Space Size Info: %f %d %d", dspSize, repSize, clockTime);
CManager::theInstance->GenerateNextHierarchy();
set->RemoveAll();
delete set;
}
}
}