本文整理汇总了C++中CStringArray::RemoveAll方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringArray::RemoveAll方法的具体用法?C++ CStringArray::RemoveAll怎么用?C++ CStringArray::RemoveAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringArray
的用法示例。
在下文中一共展示了CStringArray::RemoveAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: detectBinFile
/*
* 函数介绍: 检测BIN文件是否存在
* 输入参数:
* 输出参数:
* 返 回 值: BIN文件的个数
*/
BYTE CPageSmartUpdate::detectBinFile(void)
{
CStringArray strArrayFileNames;
LPCTSTR file;
BYTE ID;
CString name;
BYTE count = 0;
//========= AIO-DSP DETECT ==============
file = AIO_DSP_APP_BIN_NAME;
CFileIO::GetFileNamesInDir(strArrayFileNames, file);
if (strArrayFileNames.GetSize() > 0)
{
ID = SF_AIO_DSP_UPDATE;
name = strArrayFileNames.GetAt(0); // 只获取第一个
strArrayFileNames.RemoveAll();
m_Target.insert(std::map<BYTE, CString>::value_type(ID, name));
count++;
}
//========= AIO-STM DETECT ==============
file = AIO_STM_APP_BIN_NAME;
CFileIO::GetFileNamesInDir(strArrayFileNames, file);
if (strArrayFileNames.GetSize() > 0)
{
ID = SF_AIO_STM_UPDATE;
name = strArrayFileNames.GetAt(0); // 只获取第一个
strArrayFileNames.RemoveAll();
m_Target.insert(std::map<BYTE, CString>::value_type(ID, name));
count++;
}
return count;
}
示例2: GetLine
//--------------------------------------------------------------------------------
bool CSettingsFile::GetLine(int nIndex, CStringArray& sInfo)
{
sInfo.RemoveAll();
if(m_nCurLine == -1 || nIndex < m_nCurLine)
{
SeekToBegin();
m_nCurLine = 0;
}
while(ReadLine(sInfo))
{
if(sInfo.GetSize() < GetMinSize())
{
sInfo.RemoveAll();
continue;
}
if(m_nCurLine == nIndex)
{
m_nCurLine++;
return true;
}
sInfo.RemoveAll();
m_nCurLine++;
}
return false;
}
示例3: ReadFile
//读取设置,一般不用调用,在本ARX初化时会调用
bool INISetting::ReadFile()
{
int i;
CString sFilePath;
CStringArray aKey;
CStringArray aValue;
PtrStruct *pWillAdd;
sFilePath=m_sINIFilePath;
m_aAppNameArray.RemoveAll();
// DPrintf("\n ***当前的设置文件是 %s\n",sFilePath);
//2003.3.6
//-------------->>>>何永平 加入求文件长度
CFileStatus fs;
if (CFile::GetStatus(sFilePath,fs) == FALSE)
return false;
if (m_pBuffer != NULL)
delete [] m_pBuffer;
m_pBuffer=new char[int(fs.m_size*1.5)];
if (m_pBuffer == NULL)
{
CString sPrompt;
sPrompt.Format("ini文件分配内存错!\n[%d]字节",int(fs.m_size*1.2));
AfxMessageBox(sPrompt);
}
//清空全局变量
//读取所有字段
if (GetPrivateProfileSectionNames(m_pBuffer,INIBUFFERLENGTH-3,sFilePath) &&
Get00Strings(m_pBuffer,m_aAppNameArray))
{
//清空过去的映射
ClearMap();
//下面读取所有字段
for (i=0;i<m_aAppNameArray.GetSize();i++)
{
aKey.RemoveAll();
aValue.RemoveAll();
pWillAdd=new PtrStruct;
//读入字段,并把KEY 转为大写
if (ReadIni(m_aAppNameArray[i],pWillAdd->Data,sFilePath))
{
CString sKey=m_aAppNameArray[i];
sKey.MakeUpper();
pWillAdd->sAppName=sKey;
//加入到映射
m_mapStringToMap.SetAt(sKey,pWillAdd);
// DPrintf("\n ***读取 %s %d个",pWillAdd->sAppName,pWillAdd->Data.GetCount());
}
else
{
delete pWillAdd;
// DPrintf("\n ***读取 %s 的 [%s]失败!\n",sFilePath,m_aAppNameArray[i]);
;//这个是空句,至于用处嘛 ……
}
}
}
return !m_mapStringToMap.IsEmpty();
}
示例4: GetChildrenAliasName
// 根据指定的父节点获取其对应的子节点数组
BOOL CLayerTreeDef::GetChildrenAliasName(CStringArray& ChildrenAliasNames, CStringArray& saNeed, const CString FatherAliasName)
{
ChildrenAliasNames.RemoveAll(); saNeed.RemoveAll();
CString sFatherId;
if (GetIdByAliasName(sFatherId, FatherAliasName)==FALSE) return FALSE;
CStringArray saOrder;//辅助数组(排序)
int nCount = m_LayerTreeArray.GetSize();
for (int i = 0; i <nCount; i++)
{
if (m_LayerTreeArray.GetAt(i).FatherId.CollateNoCase(sFatherId) == 0) //判断ID是否相等
{
//根据排序确定插入位置
int nOrder1 = atoi(m_LayerTreeArray.GetAt(i).OrderNum);
int nNum = saOrder.GetSize();
int nPos = 0;
for (int j =nNum-1; j >= 0; j--){
int nOrder2 = atoi(saOrder.GetAt(j));
if (nOrder1 >= nOrder2)
{
nPos = j; break; //记录插入位置
}
}
//插入数据
ChildrenAliasNames.InsertAt(nPos, m_LayerTreeArray.GetAt(i).AliasName);
saNeed.InsertAt(nPos, m_LayerTreeArray.GetAt(i).NeedInf);
saOrder.InsertAt(nPos, m_LayerTreeArray.GetAt(i).OrderNum);
}
}
return (ChildrenAliasNames.GetSize() > 0);
}
示例5: OnExcelOut
void CItemCommerceSearchView::OnExcelOut(CString filepath, CString filename)
{
CSpreadSheet sOutFile(filepath, "ListSheet");
CStringArray readArray;
CGridCellCheck *pCell;
BOOL bCheck;
sOutFile.BeginTransaction();
// 加入标题
int iCol = m_cDisplay.GetColumnCount();
int iRow = m_cDisplay.GetRowCount();
readArray.RemoveAll();
int i,j;
CString str;
for(i =0; i< iCol;i++)
{
str = m_cDisplay.GetItemText(0,i);
if(str =="")
str= "0";
readArray.Add(str);
}
sOutFile.AddHeaders(readArray);
// 加入数据
for(i = 1; i < iRow; i++)
{
readArray.RemoveAll();
for(j=0;j<iCol;j++)
{
if(j>=1 && m_iName[j-1].tType == 4)
{
pCell = (CGridCellCheck*)m_cDisplay.GetCell(i,j);
bCheck = pCell->GetCheck();
if(bCheck)
str = "TRUE";
else
str = "FALSE";
}
else
{
str = m_cDisplay.GetItemText(i,j);
if(str=="")
str = "/";
}
readArray.Add(str);
}
sOutFile.AddRow(readArray,i+1);
}
sOutFile.Commit();
AfxMessageBox("查询结果已经保存为文件:\n "+filename);
}
示例6: FindDupes
int WINAPI FindDupes(const char* szList, HWND hParent)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
hStopEvent=CreateEvent(0,0,0,0);
sListOfImages.RemoveAll();
sListOfImagesToDelete.RemoveAll();
sListOfImageDibs.RemoveAll();
CString sFiles=szList;
sFiles.Replace("\r","");
sFiles+="\n";
while(sFiles.GetLength()>0){
CString sWPTitle=sFiles.SpanExcluding("\n");
if(strlen(sWPTitle)!=strlen(sFiles)){
sFiles=sFiles.Mid(strlen(sWPTitle)+1);
}else{
sFiles="";
}
if(sWPTitle!="" && FindMini(sFiles,sWPTitle+"\n")==-1){
sListOfImages.Add(sWPTitle);
}
}
if(hCheckThread){
TerminateThread(hCheckThread,0);
hCheckThread=0;
}
DWORD dwID=0;
hCheckThread=CreateThread(0,0,CheckImages,0,0,&dwID);
DialogBox(theApp.m_hInstance,MAKEINTRESOURCE(IDD_DIALOG),hParent,OptionsDialogProc);
bStopCheck=1;
csCheck.Lock();
csCheck.Unlock();
WaitForSingleObject(hStopEvent,1000);
CloseHandle(hStopEvent);
if(hCheckThread){
TerminateThread(hCheckThread,0);
}
CloseHandle(hCheckThread);
hCheckThread=0;
hStopEvent=0;
for(int i=0;i<sListOfImageDibs.GetSize();i++){
if(sListOfImageDibs[i]){
delete sListOfImageDibs[i];
}
}
sPathInLeft="";
sPathInRight="";
if(btLeft){
_bmpX()->ReleaseBmp(btLeft);
btLeft=0;
}
if(btRight){
_bmpX()->ReleaseBmp(btRight);
btRight=0;
}
return lDeletedFiles;
}
示例7: CStringArray
int CDbfFile::AddDBF4(char* psDBFAttList,CString sDelimiter, int nSize)
//used when strings separated by '\0'
{
DBFHandle hDBF;
int kk;
CFileFind ShapeFile;
CString sTmp;
CStringArray *psDBFAtt;
psDBFAtt = new CStringArray();
if (_bInit)
{
_bInit = false;
ValidateDBF();
DBFSetColumn(&_psDBFAttList);
}
// Open/Create the database.
hDBF = DBFOpen("r+b" );
if( hDBF == NULL )
{
printf("DBFOpen failed: %s\n", _szDBFName);
return 1;
}
int nStrStart = 0;
for (kk = 0; kk < nSize; kk++)
{
psDBFAtt->RemoveAll();
sTmp = "";
while(psDBFAttList[nStrStart]!='\0')
{
sTmp = sTmp + psDBFAttList[nStrStart++];
}
nStrStart++;
while (sTmp.Find(sDelimiter) != -1)
{
psDBFAtt->Add(sTmp.Left(sTmp.Find(sDelimiter)));
sTmp.Delete(0, (sTmp.Find(sDelimiter) + 1));
}
if (!sTmp.IsEmpty())
psDBFAtt->Add(sTmp);
DBFAddRecord(hDBF, psDBFAtt);
}
psDBFAtt->RemoveAll();
/* -------------------------------------------------------------------- */
/* Close and cleanup. */
/* -------------------------------------------------------------------- */
DBFClose( hDBF );
delete(psDBFAtt);
return 0;
}
示例8: SubstituteDimNames
//----------------------------------------
void CExternalFilesAvisoGrid::SubstituteDimNames(CStringArray& dimNames)
{
CStringArray replaced;
dimNames.Replace(CExternalFilesAvisoGrid::m_INTERNAL_LAT_DIM_NAME, m_latDim->GetName(), replaced, true, false);
CStringArray replacedDims = replaced;
replaced.RemoveAll();
replacedDims.Replace(CExternalFilesAvisoGrid::m_INTERNAL_LON_DIM_NAME, m_lonDim->GetName(), replaced, true, false);
dimNames.RemoveAll();
dimNames = replaced;
}
示例9: OnInitDialog
BOOL CDialogInvProcess::OnInitDialog()
{
CDialog::OnInitDialog();
CArray<int,int> arIds;
CStringArray arTickers;
// Raw Materials
CSQLInvProcess::Get(1, arIds, arTickers);
for(int i=0; i<arIds.GetSize(); i++)
{
int nInd = m_listRaw.AddString(arTickers[i]);
m_listRaw.SetItemData(nInd, arIds[i]);
}
// WIP
arIds.RemoveAll();
arTickers.RemoveAll();
CSQLInvProcess::Get(2, arIds, arTickers);
for(int i=0; i<arIds.GetSize(); i++)
{
int nInd = m_listWIP.AddString(arTickers[i]);
m_listWIP.SetItemData(nInd, arIds[i]);
}
// QC
arIds.RemoveAll();
arTickers.RemoveAll();
CSQLInvProcess::Get(3, arIds, arTickers);
for(int i=0; i<arIds.GetSize(); i++)
{
int nInd = m_listQC.AddString(arTickers[i]);
m_listQC.SetItemData(nInd, arIds[i]);
}
// Portfolio
arIds.RemoveAll();
arTickers.RemoveAll();
CSQLInvProcess::Get(4, arIds, arTickers);
for(int i=0; i<arIds.GetSize(); i++)
{
int nInd = m_listPort.AddString(arTickers[i]);
m_listPort.SetItemData(nInd, arIds[i]);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例10: GetFixedDrives
bool CBrowserHelper::GetFixedDrives(CStringArray& saDrives)
{
saDrives.RemoveAll();
TCHAR szDriveStrings[256] = _T("");
DWORD dwDriveStringLength = ::GetLogicalDriveStrings(_countof(szDriveStrings), szDriveStrings);
if (dwDriveStringLength == 0 || dwDriveStringLength > _countof(szDriveStrings))
{
return false;
}
const TCHAR* pszDrive = szDriveStrings;
while (dwDriveStringLength > 0)
{
DWORD dwDriveLength = (DWORD) _tcslen(pszDrive) + 1;
UINT nDriveType = ::GetDriveType(pszDrive);
if (nDriveType == DRIVE_FIXED)
{
saDrives.Add(pszDrive);
}
pszDrive += dwDriveLength;
dwDriveStringLength -= dwDriveLength;
}
return true;
}
示例11:
int CRegKey2::GetNames(CStringArray& aNames, BOOL bSubKey) const
{
ASSERT(m_hKey);
aNames.RemoveAll();
DWORD nKey = 0;
TCHAR szName[1024];
LONG lResult = ERROR_SUCCESS;
while (lResult == ERROR_SUCCESS)
{
// Inside the loop because RegEnumValue will change it
DWORD nNameLen = 1024;
if (bSubKey)
lResult = ::RegEnumKey(m_hKey, nKey, szName, nNameLen);
else
lResult = ::RegEnumValue(m_hKey, nKey, szName, &nNameLen, NULL, NULL, NULL, NULL);
// we have a valid key name
if (lResult == ERROR_SUCCESS)
aNames.Add(szName);
nKey++; // next
}
return aNames.GetSize();
}
示例12: SortList
void CACListWnd::SortList(CStringArray& m_List)
{
int m_Count = (int)m_List.GetSize();
int i;
if (m_Count > 1)
{
CStringArray m_Liste1;
m_Liste1.Copy(m_List);
LPCTSTR* ppSortArray = new LPCTSTR[m_Count+1];
for(i=0; i < m_Count; i++)
{
ppSortArray[i] = (LPCTSTR)m_Liste1.GetAt(i);
}
m_List.RemoveAll();
qsort(ppSortArray, m_Count, sizeof(LPCTSTR), CompareString);
for(i=0; i < m_Count; i++)
{
m_List.Add((LPCTSTR) ppSortArray[i]);
}
m_Liste1.RemoveAll();
delete [] ppSortArray;
}
}
示例13: GetDictList
void CDictSetupDlg::GetDictList(CStringArray& list, int& cur) {
list.RemoveAll();
cur = 0;
for (int k = 0; k < RESERVED_DICTS; ++k)
list.Add(g_res_dicts[k]);
// fetch dictionaries list
CString dlist = CTVApp::GetStr(_T("Dictionary"));
int i = 0;
int cc = 0;
while (i < dlist.GetLength() && dlist[i] >= '0' && dlist[i] <= '9') {
cc = cc * 10 + dlist[i] - '0';
++i;
}
if (i < dlist.GetLength() && dlist[i] == _T('?'))
++i;
for (; i < dlist.GetLength();) {
int end = dlist.Find(_T('?'), i);
if (end < 0)
end = dlist.GetLength();
if (dlist[i] == _T('*')) {
++i;
if (i >= end)
continue;
}
list.Add(dlist.Mid(i, end - i));
i = end + 1;
}
if (cc >= 0 && cc < list.GetSize())
cur = cc;
}
示例14:
int
ODBCStringsMatrix::CutToSmallStrings(char* szString, CStringArray& arrSmallStrings)
{
int nLoop = 0;
int nStart = 0;
arrSmallStrings.RemoveAll();
while( szString[nLoop] != '\0' )
{
if( szString[nLoop] == ' ' )
{
char cOld = szString[nLoop];
szString[nLoop] = '\0';
CString sValue = (LPCTSTR)&szString[nStart];
szString[nLoop] = cOld;
if( sValue.GetLength() )
arrSmallStrings.Add(sValue);
nStart = nLoop + 1;
}
nLoop ++;
}
CString sValue = (LPCTSTR)&szString[nStart];
sValue.Remove(' ');
if( sValue.GetLength() )
arrSmallStrings.Add(sValue);
return (long)arrSmallStrings.GetCount();
}
示例15: parseMacs
/* Parse MAC concatened into String Array */
UINT CDeviceid::parseMacs( CString &csMac, CStringArray &csMacArray)
{
UINT uNumber = 0,
uIndex = 0;
CString csOneMac;
try
{
csMacArray.RemoveAll();
while (csMac.Mid( uIndex, MAC_STRING_LENGTH).GetLength() > 0)
{
csOneMac = csMac.Mid( uIndex, MAC_STRING_LENGTH);
if (csOneMac.GetLength() == MAC_STRING_LENGTH)
{
// This a MAC address
csMacArray.Add( csOneMac);
uNumber ++;
}
uIndex += MAC_STRING_LENGTH;
}
return uNumber;
}
catch (CException *pEx)
{
pEx->Delete();
return 0;
}
}