本文整理汇总了C++中CStringArray::RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringArray::RemoveAt方法的具体用法?C++ CStringArray::RemoveAt怎么用?C++ CStringArray::RemoveAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringArray
的用法示例。
在下文中一共展示了CStringArray::RemoveAt方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetActiveDict
void CDictSetupDlg::SetActiveDict(int cur) {
int cd;
CStringArray list;
GetDictList(list, cd);
list.RemoveAt(0, RESERVED_DICTS);
PutDictList(list, cur);
}
示例2: whu_AddAutoForArr
void Cwhu_FaxSettingDlg::whu_AddAutoForArr(CStringArray &m_SorArr,CStringArray &m_AddArr)
{
int size = m_SorArr.GetSize();
CString m_FaxNum = m_AddArr.GetAt(0);
int NumCount = 0;
for (int i=0;i<size;i++)
{
CString m_str = m_SorArr.GetAt(i);
if ((m_str == m_FaxNum)&&(i < size-1))
{
CString m_str2 = m_SorArr.GetAt(i+1);
int CharCount = m_str2.GetLength(); //字符串数组长度如果低于四,说明是来描述转发号码个数的标志位。////
if(CharCount<4)
{
int NumCount = _ttoi(m_str2);
m_SorArr.RemoveAt(i,NumCount+2);
break;
}
}
}
int m_AddSize = m_AddArr.GetSize();
if (m_AddSize>2)
{
m_SorArr.Append(m_AddArr);
}
}
示例3: ReadData
bool CCSVFile::ReadData(CStringArray &arr)
{
// Verify correct mode in debug build
ASSERT(m_nMode == modeRead);
// Read next line
CString sLine;
int nValue = 0;
int nColumn = 0; //统计数据列
bool bCheakCol = true;
while (ReadString(sLine))
{
if( !(sLine[0]>='0' && sLine.GetAt(0)<='9') ) //不读每行的首个字符不为数字的数据
continue;
LPCTSTR p = sLine;
while (*p != '\0')
{
CString s; // String to hold this value
// Parse unquoted value
while (*p != '\0' && *p != ',')
{
s.AppendChar(*p++);
}
// Advance to next character (if not already end of string)
if (*p != '\0')
p++;
if (bCheakCol)
{
nColumn++; // 计算数据列数
}
// Add this string to value array
if (nValue < arr.GetCount())
arr[nValue] = s;
else
arr.Add(s);
nValue++;
}
bCheakCol =false;
}
// Trim off any unused array values
if (arr.GetCount() > nValue)
arr.RemoveAt(nValue, arr.GetCount() - nValue);
// We return true if ReadString() succeeded--even if no values
return true;
// Parse values in this line 需要给数据分列在此
}
示例4: ScanDirectory
bool CFileUtil::ScanDirectory( const CString &path,const CString &fileSpec,
CStringArray &files, bool recursive/*=true*/, ScanDirectoryUpdateCallBack updateCB /*= NULL */ )
{
CStringArray dirs;
CString searchname;
CFileFind find;
files.RemoveAll();
dirs.Add(path);
BOOL bRet;
while(dirs.GetSize()>0)
{
if (dirs[0][dirs[0].GetLength()-1] == '\\')
{
searchname = dirs[0] + fileSpec;
}
else
{
searchname = dirs[0] + "\\" + fileSpec;
}
dirs.RemoveAt(0);
bRet = find.FindFile (searchname,0);
if(!bRet)
{
continue;
}
do
{
bRet = find.FindNextFile ();
if(find.IsDots())
{
//忽略.和..文件
continue;
}
if(find.IsDirectory ())
{
//目录
files.Add(find.GetFilePath());
if (updateCB)
{
updateCB(find.GetFilePath());
}
continue;
}
else
{
//文件,此处不处理
}
}while(bRet) ;
}
return true;
}
示例5: Minimum
//Ham tim co so toi thieu roi nhau
//Vao: aszX
//Ra : aszY
void Minimum(CStringArray& aszX, CStringArray& aszY )
{
aszY.RemoveAll();
CStringArray aszTemp;
int i;
aszTemp.Append(aszX);
while(aszTemp.GetSize())
{
CString tempS1,tempS2,S1,S2,S3;
tempS1 = aszTemp[0];
aszTemp.RemoveAt(0);
for(i=0; i<aszTemp.GetSize(); i++)
{
S1 = Common(tempS1,aszTemp[i]);
if(!S1.IsEmpty())
break;
}
if(i==aszTemp.GetSize())//Neu X,Y khong co thuoc tinh chung
{
if(!tempS1.IsEmpty())
aszY.Add(tempS1);
}
else
{
tempS2 = aszTemp[i];
aszTemp.RemoveAt(i);
if(!S1.IsEmpty())
aszTemp.Add(S1);
S2 = Sub(tempS1,tempS2);
if((!S2.IsEmpty())&&(S2 != S1))
aszTemp.Add(S2);
S3 = Sub(tempS2,tempS1);
if((!S3.IsEmpty())&&(S3 != S1)&&(S3 != S2))
aszTemp.Add(S3);
}
}
}
示例6: Alpha
void Alpha(CStringArray& aszS)
{
int i=0;
while(i<aszS.GetSize())
{
CString tempS;
Alpha(aszS[i],tempS);
if(tempS.IsEmpty())
aszS.RemoveAt(i);
else
{
aszS.SetAt(i,tempS);
i++;
}
}
}
示例7: OnBnClickedCbtnDissociate
/******************************************************************************
Function Name : OnBnClickedCbtnDissociate
Input(s) :
Output :
Functionality : Call the functions to remove the selected Databases
Member of : CDatabaseDissociateDlg
Friend of : -
Author(s) : Anish Kumar
Date Created : 06.12.2006
Modifications :
******************************************************************************/
void CDatabaseDissociateDlg::OnBnClickedCbtnDissociate()
{
//TO store the path of files dissociated
CStringArray aomStrFilesDissociated;
CMainFrame* pMainFrame = (CMainFrame*)theApp.m_pMainWnd;
// Get the indexes of all the selected items.
int nCount = m_omDissociateDbLst.GetSelCount();
if(nCount > 0)
{
// Array of selected item's position
CArray<int,int> aomListBoxSel;
aomListBoxSel.SetSize(nCount);
//Pass the array pointer to get the selected item's positions
m_omDissociateDbLst.GetSelItems(nCount, aomListBoxSel.GetData());
aomStrFilesDissociated.RemoveAll();
for(int nTempCnt = 0 ; nTempCnt < nCount ; nTempCnt++)
{
BOOL bDBDeleted = FALSE;
CString omstrDBPath ;
//Selected file's index
int nSelectedPos = aomListBoxSel.GetAt(nTempCnt);
//Find the length of string to pass the buffer to have the selected File path
int nBufferSize = m_omDissociateDbLst.GetTextLen(nSelectedPos);
m_omDissociateDbLst.GetText(nSelectedPos,omstrDBPath.GetBuffer(nBufferSize));
bDBDeleted = (*(CMsgSignal**)(m_sDbParams.m_ppvImportedDBs))->bDeAllocateMemory(omstrDBPath.GetBuffer(0));
if(TRUE == bDBDeleted)
{
aomStrFilesDissociated.Add(omstrDBPath.GetBuffer(0));
}
}
//To remove from theApp class
CStringArray aomstrDBFiles;
(*(CMsgSignal**)(m_sDbParams.m_ppvImportedDBs))->vGetDataBaseNames(&aomstrDBFiles);
//Delete the file path from the List box
int nTotalCount = aomStrFilesDissociated.GetSize();
CString omStrTempFile;
for(int nCount=0 ; nCount<nTotalCount ; nCount++)
{
omStrTempFile = aomStrFilesDissociated.GetAt(nCount);
int nIndex = 0;
if( (nIndex = m_omDissociateDbLst.FindString(0,
omStrTempFile)) != LB_ERR )
{
//Delete the file path from the list box
m_omDissociateDbLst.DeleteString(nIndex);
int nStoredFile = aomstrDBFiles.GetSize();
CString omStrTemp;
BOOL bRemoved = FALSE;
for(int nTemp = 0 ; nTemp < nStoredFile && bRemoved != TRUE; nTemp++)
{
omStrTemp = aomstrDBFiles.GetAt(nTemp);
if(!(omStrTemp.Compare(omStrTempFile)))
{
aomstrDBFiles.RemoveAt(nTemp);
bRemoved = TRUE;
}
}
}
}
//Set the new file name array
(*(CMsgSignal**)(m_sDbParams.m_ppvImportedDBs))->vSetDataBaseNames(&aomstrDBFiles);
// Send a message to Tx Window about database change
if( pMainFrame != NULL)
{
eUSERSELCTION eUserSel = eDATABASEIMPORTCMD;
pMainFrame->m_objTxHandler.vPostMessageToTxWnd(WM_USER_CMD, (WPARAM)eUserSel,0);
}
////Delete Signal watch list and Graph window list
//// Check for Signal Watch & DLL load Condition
//
BOOL bUserOption = FALSE;
if(pMainFrame->m_psSignalWatchList != NULL)
{
if(theApp.m_bFromAutomation == FALSE)
bUserOption = AfxMessageBox(defIMPORT_WARNING,
MB_YESNO | MB_DEFBUTTON1 | MB_ICONQUESTION) ==
IDYES;
// If user wants to clear
if(bUserOption == TRUE )
{
// Clear Signal Watch List
pMainFrame->vUpdateSWList();
}
}
//Added by Arun to update Data Handler Main entry list.
//pMainFrame->vUpdateMainEntryListInWaveDataHandler();
//pMainFrame->vClearSignalInfoList();
//.........这里部分代码省略.........
示例8: RemoveDot
bool CPathUtilEx::RemoveDot(CString& strPathOrFile)
{
if (strPathOrFile.IsEmpty())
{
return true;
}
else
{
strPathOrFile.Replace(_T('/'), _T('\\'));
}
//按照斜杠解析出每个文件夹名称
CStringArray strTempArray;
int nStart = 0;
for (int i=0; i<strPathOrFile.GetLength(); ++i)
{
if (strPathOrFile[i] == _T('\\')) //找到斜杠
{
CString strTemp = strPathOrFile.Mid(nStart, i-nStart);
if (!strTemp.IsEmpty())
{
strTempArray.Add(strTemp);
}
nStart = i+1;
}
}
if (strPathOrFile[strPathOrFile.GetLength()-1] != _T('\\'))
{
strTempArray.Add(strPathOrFile.Mid(nStart));
}
//如果是点号直接去除,如果是两个点号去除上一个目录
for (int i=0; i<strTempArray.GetSize(); ++i)
{
if (strTempArray[i] == _T('.'))
{
strTempArray.RemoveAt(i);
i--;
}
else if (strTempArray[i] == _T(".."))
{
if (i == 0) //第一个就..,认为是错误路径
{
return false;
}
else
{
int nIndex = strTempArray[i-1].Find(_T(':'));
if (nIndex != -1) //前一个是根盘符, 认为是错误路径
{
return false;
}
else //去除两个点及前一个文件夹
{
strTempArray.RemoveAt(i-1, 2);
i -= 2;
}
}
}
else
{
continue;
}
}
//将各部分按照斜杠连接起来
strPathOrFile = _T("");
for (int i=0; i<strTempArray.GetSize(); ++i)
{
strPathOrFile += strTempArray[i];
if (i < strTempArray.GetSize()-1) //最后一个不加斜杠
{
strPathOrFile += _T('\\');
}
}
return true;
}
示例9: GetColumnStrings
void CWHTable::GetColumnStrings(CStringArray& csStrings, BOOL fKillUnsupportedTypes)
{
// Retrieve the strings in the current column.
// Keep finding strings until an 'end choice' token is found.
int nIndex = m_nIndex;
int nTableItems = m_csaLine.GetUpperBound();
int nFound = 0;
while (nIndex < nTableItems)
{
// Find the next non empty string in the column
while (m_csaLine[nIndex].IsEmpty())
{
IncrementRow(nIndex);
if (nIndex > nTableItems)
break;
}
// Add the non empty string to the array
if (nIndex <= nTableItems)
{
// Add string
BOOL f = AddFoundString(csStrings, nIndex);
nFound++;
// Check for an unsupported type
if (fKillUnsupportedTypes && nFound > m_nTitleStrings)
{
int nLastIndex = csStrings.GetUpperBound();
CString cs = csStrings[nLastIndex];
// Search for a token
int nBang = cs.Find(m_cListEnd);
if (nBang != -1)
{
CString csProjType = cs.Right(cs.GetLength() - (nBang+1));
int nProjType = atoi((const char*)csProjType);
// Take off the project type info
cs = cs.Left(nBang);
csStrings[nLastIndex] = cs;
// See if the project type is supported
CPmwApp* pApp = GET_PMWAPP();
CPmwDocTemplate* pTemplate = NULL;
POSITION pos = pApp->GetFirstDocTemplatePosition();
while (pos != NULL)
{
CPmwDocTemplate* pThisTemplate = (CPmwDocTemplate*)pApp->GetNextDocTemplate(pos);
if (pThisTemplate->ProjectType() == nProjType)
{
pTemplate = pThisTemplate;
break;
}
}
if (pTemplate == NULL)
{
// Take it off the list, and empty it
csStrings.RemoveAt(nLastIndex);
m_csaLine[nIndex].Empty();
// In theory, if this string was the last in the column,
// we should put a m_cListEnd char in front of the next to
// last string in the column because this one is now gone.
// We don't really need to do this, however, because we're
// tossing out project types which are in the first row.
}
}
}
IncrementRow(nIndex);
if (f)
break;
}
}
}
示例10: bInitialiseConfiguration
/**
* \brief initialises user selection
* \return TRUE or FALSE
*
* This method will initialise user selection from
* a configuration module to respective module.
*/
BOOL CCANMonitorApp::bInitialiseConfiguration(BOOL bFromCom)
{
BOOL bReturn = TRUE;
CMainFrame* pMainFrame = static_cast<CMainFrame*> (m_pMainWnd);
if(pMainFrame != nullptr )
{
BOOL bIsDatabaseFoundInConfigFile = FALSE;
if(m_pouMsgSignal != nullptr)
{
m_pouMsgSignal->bDeAllocateMemory("");
}
else
{
m_pouMsgSignal = new CMsgSignal(sg_asDbParams[CAN], m_bFromAutomation);
}
if ( m_pouMsgSignal != nullptr )
{
//Get the Database names
CStringArray aomOldDatabases;
//To keep all the files which are successfully imported
CStringArray aomNewDatabases;
aomNewDatabases.RemoveAll();
m_pouMsgSignal->vGetDataBaseNames(&aomOldDatabases);
int nFileCount = aomOldDatabases.GetSize();
if(nFileCount == 0)
{
bIsDatabaseFoundInConfigFile = FALSE;
// Reset corresponding flag
m_pouFlags->vSetFlagStatus( SELECTDATABASEFILE, FALSE );
}
else
{
CString omStrDatabase;
int nDatabaseNotFound = 0;
for(int nCount = 0; nCount < nFileCount; nCount++)
{
omStrDatabase = aomOldDatabases.GetAt(nCount);
if (omStrDatabase.IsEmpty())
{
nDatabaseNotFound++;
aomOldDatabases.RemoveAt(nCount);
--nCount;
--nFileCount;
}
else
{
bIsDatabaseFoundInConfigFile = TRUE;
// Check if the file really exists
struct _finddata_t fileinfo;
if (_findfirst(omStrDatabase.GetBuffer(MAX_PATH) ,&fileinfo) == -1L)
{
CString omStrMsg = _("Database File: ");
omStrMsg += omStrDatabase;
omStrMsg += _(" not found!");
if(bFromCom==FALSE)
{
MessageBox(nullptr,omStrMsg,"BUSMASTER",MB_OK|MB_ICONERROR);
}
// Remove the file name from configuration file.
nDatabaseNotFound++;
aomOldDatabases.RemoveAt(nCount);
--nCount;
--nFileCount;
}
else
{
// Reset corresponding flag
m_pouFlags->vSetFlagStatus( SELECTDATABASEFILE, TRUE );
m_pouMsgSignal->
bFillDataStructureFromDatabaseFile(omStrDatabase, PROTOCOL_UNKNOWN);
pMainFrame->vPopulateJ1939PGNList();
aomNewDatabases.Add(omStrDatabase);
}
}
}
if(nDatabaseNotFound > 0)
{
BYTE* pbyConfigData = nullptr;
UINT unSize = 0;
unSize += (sizeof (UINT) + ((sizeof(char) *MAX_PATH) * aomNewDatabases.GetSize()));
pbyConfigData = new BYTE[unSize];
BYTE* pbyTemp = pbyConfigData;
UINT nCount = 0;
//.........这里部分代码省略.........
示例11: DeleteApplicationLog
BOOL COXEventLog::DeleteApplicationLog(LPCTSTR pszApplicationName)
{
ASSERT_VALID(this);
ASSERT(pszApplicationName != NULL);
if (pszApplicationName == NULL ||
lstrlen(pszApplicationName) <= 0)
{
m_ErrorCode = ERROR_INVALID_PARAMETER;
return(FALSE);
}
COXRegistryItem regItem;
CString log_key_name(_T("\\LocalMachine\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\"));
log_key_name += pszApplicationName;
log_key_name += _T("\\");
regItem.SetFullRegistryItem(log_key_name);
if (regItem.Delete() == FALSE)
{
m_ErrorCode = regItem.GetLastError();
return FALSE;
}
/*
** Microsoft has a bug in this area. Even though we deleted the application from the
** HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\
** registry area, they don't provide a way to delete the application from the
** HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Sources
** value. The application name is one of the strings in this REG_MULTI_SZ value. We
** still need to delete it from there. The names listed in this value appear in the
** "Source" combobox of the Event Viewer application View->Filter Events... menu selection.
*/
log_key_name = _T("\\LocalMachine\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\");
regItem.SetFullRegistryItem(log_key_name);
CStringArray sources;
if (regItem.Open(FALSE) == FALSE ||
regItem.GetMultiStringValue(sources, _T("Sources")) == FALSE)
{
m_ErrorCode = regItem.GetLastError();
return FALSE;
}
int index = 0;
int number_of_sources = PtrToInt(sources.GetSize());
BOOL application_was_found = FALSE;
while(index < number_of_sources)
{
if (sources[index] == pszApplicationName)
{
application_was_found = TRUE;
sources.RemoveAt(index);
index = number_of_sources;
}
index++;
}
if (application_was_found != FALSE)
{
regItem.SetMultiStringValue(sources, _T("Sources"));
}
return TRUE;
}
示例12: CompareFunctions
//.........这里部分代码省略.........
// are identical except for the labels:
if (pFile1->GetPrimaryLabel(pFunction1->GetMainAddress()).CompareNoCase(
pFile2->GetPrimaryLabel(pFunction2->GetMainAddress())) != 0) Tp = __max(0, Tp - mat);
// Normalize it:
nRetVal = Tp/(__max(M,N)*mat);
// Build Edit Script:
if (bBuildEditScript) {
int last_i, last_j;
int cur_i, cur_j;
int k_rest;
if (dbest > 0) {
m_EditScript.SetSize(dbest);
k = kbest;
last_i = M+1;
last_j = N+1;
/*
printf("\n%s with %s:\n", LPCTSTR(pFunction1->GetMainName()), LPCTSTR(pFunction2->GetMainName()));
*/
for (d=dbest-1; d>=0; d--) {
i = __max((R(d, k-1) + 1), __max((R(d, k) + 1), (R(d, k+1))));
/*
printf("(%3ld, %3ld) : %3ld(%5ld), %3ld(%5ld), %3ld(%5ld) :", d, k,
(R(d, k-1) + 1), (int)Sp((R(d, k-1))*2-k+1, d),
(R(d, k) + 1), (int)Sp((R(d, k))*2-k, d),
(R(d, k+1)), (int)Sp((R(d, k+1))*2-k-1, d));
for (j=Rvisitmin[dbest-1]; j<=Rvisitmax[dbest-1]; j++) {
if (j == k-1) printf("("); else printf(" ");
if (R(d,j)<0) printf(" "); else printf("%3ld", R(d, j));
if (j == k+1) printf(")"); else printf(" ");
}
printf("\n");
*/
j = i-k;
if (i == (R(d, k-1) + 1)) {
strTemp.Format("%ld>%ld", i-1, j);
cur_i = i-1;
cur_j = j;
k--;
k_rest = 1;
} else {
if (i == (R(d, k+1))) {
strTemp.Format("%ld<%ld", i, j-1);
cur_i = i;
cur_j = j-1;
k++;
k_rest = -1;
} else {
// if (i == (R(d, k) + 1))
strTemp.Format("%ld-%ld", i-1, j-1);
cur_i = i-1;
cur_j = j-1;
// k=k;
k_rest = 0;
}
}
m_EditScript.SetAt(d, strTemp);
// The following test is needed since our insertion/deletion indexes are
// one greater than the stored i and/or j values from the R matrix.
// It is possible that the previous comparison added some extra
// entries to the R matrix than what was really needed. This will
// cause extra erroneous entries to appear in the edit script.
// However, since the indexes should be always increasing, we simply
// filter out extra entries added to the end that don't satisfy
// this condition:
if ((k_rest == 0) &&
((cur_i == last_i) && (cur_j == last_j))) {
m_EditScript.RemoveAt(d);
}
last_i = cur_i;
last_j = cur_j;
}
}
// Note: if the two are identical, array stays empty:
m_bEditScriptValid = TRUE;
}
// Deallocate Memory:
delete[] T;
delete[] Rvisitmin;
delete[] Rvisitmax;
for (i=0; i<dmax; i++) delete[] (Rm[i]);
delete[] Rm;
}
break;
}
return nRetVal;
}