本文整理汇总了C++中CStringList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringList::begin方法的具体用法?C++ CStringList::begin怎么用?C++ CStringList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringList
的用法示例。
在下文中一共展示了CStringList::begin方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetParameterList
BOOL Monitor::SetParameterList(CStringList &lstParameter)
{
CStringList::iterator it;
if(!m_ParamList.empty())
{
/* for(it=m_ParamList.begin();it!=m_ParamList.end();it++)
{
free((*it));
}
*/
m_ParamList.clear();
}
if(lstParameter.empty())
return TRUE;
for(it=lstParameter.begin();it!=lstParameter.end();it++)
{
m_ParamList.push_back((*it));
}
lstParameter.clear();
return TRUE;
}
示例2: Create
bool CInPlaceCombo::Create (int iItem, int iSubItem, CStringList &rlstItems, int nSel)
{
if (NULL == GetControl())
return false;
m_iItem = iItem;
m_iSubItem = iSubItem;
bool fVisible = (m_dwStyle & WS_VISIBLE) ? true : false;
SetStyle (m_dwStyle & ~WS_VISIBLE);
if (!FInit())
return false;
// Set the proper font
HFONT hF = (HFONT)GetParent()->ForwardEvent(WM_GETFONT);
ForwardEvent (WM_SETFONT, (WPARAM)hF);
// alle Elemente zur Box hinzufügen
for (CStringList::iterator it = rlstItems.begin();
it != rlstItems.end();
++it)
{
GetComboBox() -> AddString ((*it).c_str());
}
if (-1 != nSel)
GetComboBox() -> ChangeCurrentIndex (nSel);
if (fVisible) {
Show();
SetFocus();
}
return true;
}
示例3: WebGetOptionsList
void WebGetOptionsList(CString strInput, CStringList& strList)
{
POSITION pos;
int iPos;
CString strName, strItem;
iPos = strInput.Find(' ');
strItem = strInput.Mid(iPos + 6);
iPos = strItem.Find(' ');
if (iPos != -1)
{
strName = strItem.Left(iPos);
}
else
{
strName = strItem;
}
#ifndef __GNUC__
for (pos = strList.GetHeadPosition(); pos != NULL;)
#else
for (pos = strList.begin(); pos != strList.end(); ++pos)
#endif
{
strItem = strList.GetNext(pos);
if (!strItem.Compare(strName))
{
return;
}
}
strList.AddTail(strName);
}
示例4: CStringListToWxArray
//----------------------------------------
void wxBratTools::CStringListToWxArray(CStringList& from, wxArrayString& to)
{
CStringList::iterator it;
for (it = from.begin() ; it != from.end() ; it++)
{
to.Add((*it).c_str());
}
}
示例5: WebUpdateOption
CString WebUpdateOption(CString strInput)
{
CString strOutput, strItem, strTemp;
CStringList strList;
POSITION pos1, pos2;
WebGetStringList(strInput, 7, strList);
strOutput = _T("<OPTION");
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
pos2 = pos1;
strItem = strList.GetNext(pos1);
strTemp = strItem.Left(6);
if (!strTemp.CompareNoCase(_T("value=")))
{
strItem = strItem.Right(strItem.GetLength()-6);
strItem = RemoveQuote(strItem);
strOutput += _T(" value=");
strOutput += strItem;
strList.RemoveAt(pos2);
}
else if (!strItem.CompareNoCase(_T("selected")))
{
strList.RemoveAt(pos2);
}
}
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
strOutput += _T(' ');
strItem = strList.GetNext(pos1);
strOutput += strItem;
}
strOutput += _T('>');
return strOutput;
}
示例6:
static
bool
isNameInList(const CStringList& names, const CString& name)
{
for (CStringList::const_iterator index = names.begin();
index != names.end(); ++index) {
if (CStringUtil::CaselessCmp::equal(name, *index)) {
return true;
}
}
return false;
}
示例7: main
void main()
{
CStringList list;
/*list.push_back("first_elem");
if (list.size() == 1)
{
list.push_back("second_elem");
if (list.size() == 2)
{
size_t i = list.size();
list.insert(list.begin() + (list.size() - 1), "asd");
}
}
*/
list.Push_back("1");
list.Push_back("2");
list.Push_back("3");
std::vector<std::string> values = { "1", "2", "3" };
{
CStringList list2;
list2.Push_back("1");
//CStringList::CIterator it2 = list2.begin();
}
size_t index = 0;
auto iter = list.begin();
for (; iter != list.end(); iter++)
{
*iter == values[index];
++index;
}
std::vector<std::string>::iterator iterBad = values.begin() + 3;
CStringList::CConstIterator it = list.Cbegin();
}
示例8: LoadSettings
void CMuleListCtrl::LoadSettings()
{
wxCHECK_RET(!m_name.IsEmpty(), wxT("Cannot load settings for unnamed list"));
wxConfigBase* cfg = wxConfigBase::Get();
// Load sort order (including sort-column)
m_sort_orders.clear();
wxString sortOrders = cfg->Read(wxT("/eMule/TableOrdering") + m_name, wxEmptyString);
wxString columnWidths = cfg->Read(wxT("/eMule/TableWidths") + m_name, wxEmptyString);
// Prevent sorting from occuring when calling SetSorting
MuleListCtrlCompare sortFunc = m_sort_func;
m_sort_func = NULL;
if (columnWidths.Find(wxT(':')) == wxNOT_FOUND) {
// Old-style config entries...
ParseOldConfigEntries(sortOrders, columnWidths);
} else {
// Sort orders
wxStringTokenizer tokens(sortOrders, wxT(","));
// Sort orders are stored in order primary, secondary, ...
// We want to apply them with SetSorting(), so we have to apply them in reverse order,
// so that the primary order is applied last and wins.
// Read them with tokenizer and store them in a list in reverse order.
CStringList tokenList;
while (tokens.HasMoreTokens()) {
tokenList.push_front(tokens.GetNextToken());
}
for (CStringList::iterator it = tokenList.begin(); it != tokenList.end(); it++) {
wxString token = *it;
wxString name = token.BeforeFirst(wxT(':'));
long order = StrToLong(token.AfterFirst(wxT(':')).BeforeLast(wxT(':')));
long alt = StrToLong(token.AfterLast(wxT(':')));
int col = GetColumnIndex(name);
if (col >= 0) {
SetSorting(col, (order ? SORT_DES : 0) | (alt ? SORT_ALT : 0));
}
}
// Column widths
wxStringTokenizer tkz(columnWidths, wxT(","));
while (tkz.HasMoreTokens()) {
wxString token = tkz.GetNextToken();
wxString name = token.BeforeFirst(wxT(':'));
long width = StrToLong(token.AfterFirst(wxT(':')));
int col = GetColumnIndex(name);
if (col >= 0) {
if (col >= (int) m_column_sizes.size()) {
m_column_sizes.resize(col + 1, 0);
}
m_column_sizes[col] = abs(width);
SetColumnWidth(col, (width > 0) ? width : 0);
}
}
}
// Must have at least one sort-order specified
if (m_sort_orders.empty()) {
m_sort_orders.push_back(CColPair(0, 0));
}
// Re-enable sorting and resort the contents (if any).
m_sort_func = sortFunc;
SortList();
}
示例9: OnDsp2H
void OnDsp2H(CStringList& strFileList, CString strSrcDir, CString strDstDir, BOOL bForce)
{
CString strSrcFile, strDstFile, strTemp, strVal, strOut;;
CStdioFile out;
CFileStatus status;
POSITION pos;
int iDot, iOffset, iPage, iLength;
strDstFile = strDstDir + strFileList.RemoveTail();
if (!PromptOverwriteFile(strDstFile, bForce)) return;
#ifndef __GNUC__
CFile::GetStatus(strDstFile, status);
#else
stat(strDstFile.c_str(),&status);
#endif
iOffset = 0;
iPage = 0;
strOut = _T("");
#ifndef __GNUC__
for (pos = strFileList.GetHeadPosition(); pos != NULL; )
#else
for (pos = strFileList.begin(); pos != strFileList.end(); ++pos)
#endif
{
strTemp = strFileList.GetNext(pos);
strSrcFile = strSrcDir + strTemp;
#ifndef __GNUC__
if (!CFile::GetStatus(strSrcFile, status))
{
wprintf(_T("Source file %s doesn't exist"), strSrcFile);
#else
if (stat(strSrcFile.c_str(),&status))
{
printf("Source file %s doesn't exist", strSrcFile.c_str());
#endif
return;
}
iLength = (int)status.m_size;
iDot = strTemp.Find(_T('.'));
strTemp = strTemp.Left(iDot);
strTemp.MakeUpper();
#ifndef __GNUC__
strVal.Format(_T("#define SYSTEM_%s_PAGE\t\t(SYSTEM_DSP_PAGE + %d)\n"), strTemp, iPage);
#else
{
char buff[511];
sprintf(buff, _T("#define SYSTEM_%s_PAGE\t\t(SYSTEM_DSP_PAGE + %d)\n"), strTemp.c_str(), iPage);
strVal = buff;
}
#endif
strOut += strVal;
#ifndef __GNUC__
strVal.Format(_T("#define SYSTEM_%s_OFFSET\t\t0x%x\n"), strTemp, iOffset);
#else
{
char buff[511];
sprintf(buff, _T("#define SYSTEM_%s_OFFSET\t\t0x%x\n"), strTemp.c_str(), iOffset);
strVal = buff;
}
#endif
strOut += strVal;
iOffset += iLength;
while (iOffset >= FILE_FLAG_PAGE_SIZE)
{
iOffset -= FILE_FLAG_PAGE_SIZE;
iPage ++;
if (iPage >= SYSTEM_DSP_PAGE_NUM)
{
printf("DSP dat files too large!");
return;
}
}
}
if (!out.Open(strDstFile, CFile::modeCreate|CFile::modeWrite|CFile::typeText))
{
#ifndef __GNUC__
wprintf(_T("Can not create destination file %s"), strDstFile);
#else
printf("Can not create destination file %s", strDstFile.c_str());
#endif
return;
}
out.WriteString(strOut);
out.Close();
}
示例10: getString
static
BOOL CALLBACK
addDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// only one add dialog at a time!
static CScreenInfo* info = NULL;
switch (message) {
case WM_INITDIALOG: {
info = (CScreenInfo*)lParam;
// set title
CString title;
if (info->m_screen.empty()) {
title = getString(IDS_ADD_SCREEN);
}
else {
title = CStringUtil::format(
getString(IDS_EDIT_SCREEN).c_str(),
info->m_screen.c_str());
}
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)title.c_str());
// fill in screen name
HWND child = getItem(hwnd, IDC_ADD_SCREEN_NAME_EDIT);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)info->m_screen.c_str());
// fill in aliases
CString aliases;
for (CStringList::const_iterator index = info->m_aliases.begin();
index != info->m_aliases.end(); ++index) {
if (!aliases.empty()) {
aliases += "\r\n";
}
aliases += *index;
}
child = getItem(hwnd, IDC_ADD_ALIASES_EDIT);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)aliases.c_str());
// set options
CConfig::CScreenOptions::const_iterator index;
child = getItem(hwnd, IDC_ADD_HD_CAPS_CHECK);
index = info->m_options.find(kOptionHalfDuplexCapsLock);
setItemChecked(child, (index != info->m_options.end() &&
index->second != 0));
child = getItem(hwnd, IDC_ADD_HD_NUM_CHECK);
index = info->m_options.find(kOptionHalfDuplexNumLock);
setItemChecked(child, (index != info->m_options.end() &&
index->second != 0));
child = getItem(hwnd, IDC_ADD_HD_SCROLL_CHECK);
index = info->m_options.find(kOptionHalfDuplexScrollLock);
setItemChecked(child, (index != info->m_options.end() &&
index->second != 0));
// modifier options
for (UInt32 i = 0; i < sizeof(s_modifiers) /
sizeof(s_modifiers[0]); ++i) {
child = getItem(hwnd, s_modifiers[i].m_ctrlID);
// fill in options
for (UInt32 j = 0; j < sizeof(s_modifiers) /
sizeof(s_modifiers[0]); ++j) {
SendMessage(child, CB_ADDSTRING, 0,
(LPARAM)s_modifiers[j].m_name);
}
// choose current value
index = info->m_options.find(s_modifiers[i].m_optionID);
KeyModifierID id = s_modifiers[i].m_modifierID;
if (index != info->m_options.end()) {
id = index->second;
}
SendMessage(child, CB_SETCURSEL, id - baseModifier, 0);
}
// dead corners
UInt32 corners = 0;
index = info->m_options.find(kOptionScreenSwitchCorners);
if (index != info->m_options.end()) {
corners = index->second;
}
child = getItem(hwnd, IDC_ADD_DC_TOP_LEFT);
setItemChecked(child, (corners & kTopLeftMask) != 0);
child = getItem(hwnd, IDC_ADD_DC_TOP_RIGHT);
setItemChecked(child, (corners & kTopRightMask) != 0);
child = getItem(hwnd, IDC_ADD_DC_BOTTOM_LEFT);
setItemChecked(child, (corners & kBottomLeftMask) != 0);
child = getItem(hwnd, IDC_ADD_DC_BOTTOM_RIGHT);
setItemChecked(child, (corners & kBottomRightMask) != 0);
index = info->m_options.find(kOptionScreenSwitchCornerSize);
SInt32 size = 0;
if (index != info->m_options.end()) {
size = index->second;
}
char buffer[20];
sprintf(buffer, "%d", size);
child = getItem(hwnd, IDC_ADD_DC_SIZE);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)buffer);
return TRUE;
//.........这里部分代码省略.........
示例11: OnWeb2Web
//.........这里部分代码省略.........
if (iEndPos - iBeginPos < 6)
{
iStartIndex = iEndPos + 1;
continue;
}
strItem = strInput.Mid(iBeginPos, 7);
strItem.MakeUpper();
if (!memcmp((LPCTSTR)strItem, "<INPUT", 6))
{
strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
strNew = WebUpdateInput(strItem);
WebGetOptionsList(strNew, listOptions);
}
else if (!strItem.Compare(_T("<SELECT")))
{
strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
strNew = WebUpdateSelect(strItem);
WebGetOptionsList(strNew, listOptions);
}
else
{
iStartIndex = iEndPos + 1;
continue;
}
strInput = strInput.Right(strInput.GetLength() - iEndPos - 1);
iStartIndex = 0;
}
iStartIndex = 0;
#ifndef __GNUC__
for (pos = listOptions.GetHeadPosition(); pos != NULL;)
#else
for (pos = listOptions.begin(); pos != listOptions.end(); ++pos)
#endif
{
strItem = listOptions.GetNext(pos);
strItem += _T("=");
if (strItem == _cIPtype)
{
strNew = "OPT_IP_TYPE";
}
else if (strItem == _cIPAddress)
{
strNew = "OPT_IP_ADDRESS";
}
else if (strItem == _cSubMask)
{
strNew = "OPT_SUBNET_MASK";
}
else if (strItem == _cRouterIP)
{
strNew = "OPT_ROUTER_IP";
}
else if (strItem == _cDnsType)
{
strNew = "OPT_DNS_TYPE";
}
else if (strItem == _cDnsIP)
{
strNew = "OPT_DNS_IP";
}
else if (strItem == _cDnsIP2)
{
strNew = "OPT_DNS_IP2";
}
示例12: WebUpdateInput
CString WebUpdateInput(CString strInput)
{
CString strOutput, strItem, strTemp;
CStringList strList;
POSITION pos1, pos2;
int iType;
WebGetStringList(strInput, 6, strList);
strOutput = _T("<INPUT");
iType = ITEM_TYPE_TEXT;
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
pos2 = pos1;
strItem = strList.GetNext(pos1);
strTemp = strItem.Left(5);
if (!strTemp.CompareNoCase(_T("name=")))
{
strItem = strItem.Right(strItem.GetLength()-5);
strItem = RemoveQuote(strItem);
strOutput += _T(" name=");
strOutput += strItem;
strList.RemoveAt(pos2);
}
else if (!strTemp.CompareNoCase(_T("type=")))
{
strTemp = strItem.Right(strItem.GetLength()-5);
strTemp = RemoveQuote(strTemp);
if (!strTemp.CompareNoCase(_T("checkbox")))
{
iType = ITEM_TYPE_CHECKBOX;
}
else if (!strTemp.CompareNoCase(_T("text")))
{
iType = ITEM_TYPE_TEXT;
}
else if (!strTemp.CompareNoCase(_T("password")))
{
iType = ITEM_TYPE_PASSWORD;
}
else if (!strTemp.CompareNoCase(_T("radio")))
{
iType = ITEM_TYPE_RADIO;
}
else
{
iType = ITEM_TYPE_UNKNOWN;
}
}
else if (!strItem.CompareNoCase(_T("checked")))
{
strList.RemoveAt(pos2);
}
}
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
pos2 = pos1;
strItem = strList.GetNext(pos1);
strTemp = strItem.Left(6);
if (!strTemp.CompareNoCase(_T("value=")))
{
if (iType == ITEM_TYPE_CHECKBOX || iType == ITEM_TYPE_TEXT || iType == ITEM_TYPE_PASSWORD)
{
strList.RemoveAt(pos2);
}
else if (iType == ITEM_TYPE_RADIO)
{
strItem = strItem.Right(strItem.GetLength()-6);
strItem = RemoveQuote(strItem);
strOutput += _T(" value=");
strOutput += strItem;
strList.RemoveAt(pos2);
}
}
}
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
strOutput += _T(' ');
strItem = strList.GetNext(pos1);
strOutput += strItem;
}
strOutput += _T('>');
return strOutput;
}