本文整理汇总了C++中CStringArray::InsertAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringArray::InsertAt方法的具体用法?C++ CStringArray::InsertAt怎么用?C++ CStringArray::InsertAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringArray
的用法示例。
在下文中一共展示了CStringArray::InsertAt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: getFavUrl
void CFavorite::getFavUrl(CStringArray &arrayUrl)
{
int size = arrayUrl.GetSize();
for (int i=0; i<m_favString.GetSize(); ++i)
{
arrayUrl.InsertAt(size+i, m_favString.GetAt(i));
}
}
示例3: GetFileNameArray
void CTaiKlineDlgHistorySelect::GetFileNameArray(CStringArray &sArry)
{
CString sPath = "data\\historysh\\";
CFileFind finder;
int n = 0;
BOOL bWorking = finder.FindFile(sPath+"*.hst");
while(bWorking)
{
bWorking = finder.FindNextFile();
CString filename = finder.GetFileTitle();
int nSize = sArry.GetSize ();
for(int j=0;j<nSize;j++)
{
if(filename <sArry[j])
{
sArry.InsertAt (j,filename);
break;
}
if(j==nSize-1)
sArry.Add (filename);
}
if(nSize == 0)
sArry.Add (filename);
n++;
}
sPath = "data\\historysz\\";
n = 0;
bWorking = finder.FindFile(sPath+"*.hst");
while(bWorking)
{
bWorking = finder.FindNextFile();
CString filename = finder.GetFileTitle();
int nSize = sArry.GetSize ();
BOOL bf;
bf=false;
for(int j=0;j<nSize;j++)
{
if(filename ==sArry[j])
{
bf=true;
break;
}
else
{
bf=false;
continue;
}
if(j==nSize-1)
sArry.Add (filename);
}
if((nSize == 0)||(!bf))
sArry.Add (filename);
n++;
}
}
示例4: nFillMessageList
/******************************************************************************
Function Name : nFillMessageList
Input(s) : CStringArray& omstrEntryList
BOOL bEmptyString
Output : INT
Functionality : Fills The Message List Into String Array
Member of : CDataBaseMsgList
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
INT CDataBaseMsgList::nFillMessageList(CStringArray& omstrEntryList, BOOL bEmptyString)
{
if ( nullptr == mCurrentCluster )
{
return ERR_INVALID_DATABASE;
}
std::map<UID_ELEMENT, IElement*> frameList;
mCurrentCluster->GetElementList( eFrameElement, frameList );
std::string frameName;
for ( auto frame : frameList )
{
frame.second->GetName( frameName );
omstrEntryList.Add( frameName.c_str() );
}
if ( bEmptyString == TRUE )
{
omstrEntryList.InsertAt( 0, _( defDELETE_MSG_SYMBOL ) );
}
return frameList.size();
}
示例5: time
//.........这里部分代码省略.........
pt->huiche = m_sum_max-sum_yk;
if( pt->huiche > HuicheMax )
{
HuicheMax = pt->huiche;
HuicheTime.Format("%s %s",pt->day,pt->time1);
}
}
//分年统计
if(yearbegin==0 )
{
pStaYear = new CTradeStaYear;
arYear.Add(pStaYear);
yearbegin = year;
pStaYear->year = yearbegin;
beginQuanyi = m_beginquanyi;
}
else if (pStaYear && year != pStaYear->year)
{
//对前一年进行统计
pStaYear->shouyi = m_beginquanyi-beginQuanyi;
pStaYear->maxhuiche = HuicheMax;
strcpy_s(pStaYear->szMaxHuicheTime,HuicheTime);
sum_yk = 0;
m_sum_max = 0;
HuicheMax = 0;
pStaYear = new CTradeStaYear;
arYear.Add(pStaYear);
yearbegin = year;
pStaYear->year = yearbegin;
beginQuanyi = m_beginquanyi;
}
}
//对前一年进行统计
if( pStaYear)
{
pStaYear->shouyi = m_beginquanyi-beginQuanyi;
pStaYear->maxhuiche = HuicheMax;
strcpy_s(pStaYear->szMaxHuicheTime,HuicheTime);
}
double avgYingli = allyingli /countyingli;
double avgKuisun = allkuisun/countkuisun;
double shenglv = 1.0* countyingli /(countyingli+countkuisun);
double avgYingli2 = (allyingli+allkuisun)/(countyingli+countkuisun);
CString row;
row = ",,,,,,";
list.Add(row);
row = "测试统计,,,,,,";
list.Add(row);
row.Format("最大回撤,%.2f,",HuicheMaxAll);
list.Add(row);
row.Format("最大回撤时间,%s,",HuicheTimeAll);
list.Add(row);
row.Format("平均盈利,%.2f,",avgYingli);
list.Add(row);
row.Format("平均亏损,%.2f,",avgKuisun);
list.Add(row);
row.Format("胜率,%.2f,",shenglv);
list.Add(row);
row.Format("每手平均盈利,%.2f,",avgYingli2);
list.Add(row);
m_shenglv = shenglv;
m_HuicheMax = HuicheMaxAll;
m_avgYingli2 = avgYingli2;
m_avgYingli = avgYingli;
m_avgKuisun = avgKuisun;
list.Add(",,,,,,,,");
list.Add("分年统计,");
list.Add("年份,收益,最大回撤,回撤时间,交易次数,平均盈利,平均亏损,每手盈利,胜率,");
for(int i=0;i<arYear.GetSize();i++)
{
CTradeStaYear * pYear = (CTradeStaYear *)arYear[i];
CString row;
row.Format("%d,%.2f,%.2f,%s,",pYear->year,pYear->shouyi,pYear->maxhuiche,pYear->szMaxHuicheTime);
list.Add(row);
}
row.Format("耗时,%s", CalculateElapseTime());
list.Add(row);
list.InsertAt(0,day);
if( show )
{
::SendMessage(m_hMsgWnd,WM_MODEL_RESULT_MSG,0,(long)&list);
StatisticEquity();
}
return 0;
}
示例6: BuildFavoritesMenu
int CMainFrame::BuildFavoritesMenu(LPCTSTR pszPath, int nStartPos, CMenu* pMenu)
{
CString strPath(pszPath);
CString strPath2;
CString str;
WIN32_FIND_DATA wfd;
HANDLE h;
int nPos = 0;
int nEndPos = 0;
int nNewEndPos = 0;
int nLastDir = 0;
TCHAR buf[INTERNET_MAX_PATH_LENGTH];
CStringArray astrFavorites;
CStringArray astrDirs;
CMenu* pSubMenu;
// make sure there's a trailing backslash
if(strPath[strPath.GetLength() - 1] != _T('\\'))
strPath += _T('\\');
strPath2 = strPath;
strPath += "*.*";
// now scan the directory, first for .URL files and then for subdirectories
// that may also contain .URL files
h = FindFirstFile(strPath, &wfd);
if(h != INVALID_HANDLE_VALUE)
{
nEndPos = nStartPos;
do
{
if((wfd.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM))==0)
{
str = wfd.cFileName;
if(str.Right(4) == _T(".url"))
{
// an .URL file is formatted just like an .INI file, so we can
// use GetPrivateProfileString() to get the information we want
::GetPrivateProfileString(_T("InternetShortcut"), _T("URL"),
_T(""), buf, INTERNET_MAX_PATH_LENGTH,
strPath2 + str);
str = str.Left(str.GetLength() - 4);
// scan through the array and perform an insertion sort
// to make sure the menu ends up in alphabetic order
for(nPos = nStartPos ; nPos < nEndPos ; ++nPos)
{
if(str.CompareNoCase(astrFavorites[nPos]) < 0)
break;
}
astrFavorites.InsertAt(nPos, str);
m_astrFavoriteURLs.InsertAt(nPos, buf);
++nEndPos;
}
}
} while(FindNextFile(h, &wfd));
FindClose(h);
// Now add these items to the menu
for(nPos = nStartPos ; nPos < nEndPos ; ++nPos)
{
pMenu->AppendMenu(MF_STRING | MF_ENABLED, 0xe00 + nPos, astrFavorites[nPos]);
}
// now that we've got all the .URL files, check the subdirectories for more
nLastDir = 0;
h = FindFirstFile(strPath, &wfd);
ASSERT(h != INVALID_HANDLE_VALUE);
do
{
if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
// ignore the current and parent directory entries
if(lstrcmp(wfd.cFileName, _T(".")) == 0 || lstrcmp(wfd.cFileName, _T("..")) == 0)
continue;
for(nPos = 0 ; nPos < nLastDir ; ++nPos)
{
if(astrDirs[nPos].CompareNoCase(wfd.cFileName) > 0)
break;
}
pSubMenu = new CMenu;
pSubMenu->CreatePopupMenu();
// call this function recursively.
nNewEndPos = BuildFavoritesMenu(strPath2 + wfd.cFileName, nEndPos, pSubMenu);
if(nNewEndPos != nEndPos)
{
// only intert a submenu if there are in fact .URL files in the subdirectory
nEndPos = nNewEndPos;
pMenu->InsertMenu(nPos, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)pSubMenu->m_hMenu, wfd.cFileName);
pSubMenu->Detach();
astrDirs.InsertAt(nPos, wfd.cFileName);
++nLastDir;
}
delete pSubMenu;
}
} while(FindNextFile(h, &wfd));
FindClose(h);
}
return nEndPos;
//.........这里部分代码省略.........