当前位置: 首页>>代码示例>>C++>>正文


C++ CVectorSString::begin方法代码示例

本文整理汇总了C++中CVectorSString::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ CVectorSString::begin方法的具体用法?C++ CVectorSString::begin怎么用?C++ CVectorSString::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CVectorSString的用法示例。


在下文中一共展示了CVectorSString::begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lookUp

void CWords_dicDlg::lookUp( const CString& inputStr )
{
	// Look up
	CVectorSString resultVec;
	Dico.lookup( CSString(inputStr), resultVec );

	// Display results
	clear();
	if ( resultVec.empty() )
	{
		m_Results.AddString( "<no result>" );
		return;
	}
	else
	{
		bool showAll = (((CButton*)(GetDlgItem( IDC_ShowAll )))->GetCheck() == 1);
		bool lvlRemoved = false;
		m_Results.SetRedraw( false );
		for ( CVectorSString::const_iterator ivs=resultVec.begin(); ivs!=resultVec.end(); ++ivs )
		{
			const CSString& res = (*ivs);
			if ( showAll || (res.find( "lvl" ) == string::npos) )
			{
				m_Results.AddString( res.c_str() );
			}
			else
				lvlRemoved = true;
		}
		m_Results.SetRedraw( true );
		CString s;
		s.Format( "%u results found for \"%s\".%s", resultVec.size(), inputStr, lvlRemoved?" Results containing \"lvl\" not shown":"" );
		GetDlgItem( IDC_Status )->SetWindowText( s );
	}
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:34,代码来源:words_dicDlg.cpp

示例2: updateItemField

// update an item field with a new value
void updateItemField(CVectorSString &lines, uint itemIndex, uint fieldIndex, uint &a, uint &b)
{
	string field = fields[fieldIndex];
	string val = items[itemIndex][fieldIndex];
	string s = "_Items#";
	s += toString(itemIndex);
	s += ".";
	s += field;

	// remove jump
	val = CSString(val).strtok("\n");

	uint craftLine = 0;
	bool found = false;
	uint i = a-1;

	// first pass to check if param have changed
	for (i=a ; i<b ; i++)
	{
		string line = s + "= " + val;
		string::size_type pos = lines[i].find(line.c_str());
		if (pos != string::npos)
		{
			found = true;
			break;
		}
	}

	// second pass if new value
	i = a-1;
	while (++i<b && !found)
	{
		string::size_type pos;

		// store the line "_CraftParameters" : reference line
		if (craftLine == 0)
		{
			pos = lines[i].find("_CraftParameters");
			if (pos != string::npos)
				craftLine = i;
		}

		// search string
		pos = lines[i].find(s.c_str());
		if (pos == string::npos)
			continue;

		if (val != "")
		{
			// check if the attribute is the right one and not included in another one
			// for example: Protection is in ProtectionFactor
			if (!CSString::isValidFileNameChar(lines[i][s.size()]))
			{
				found = true;

				if (val != "nul")
				{
					// udpdate value
					lines[i] = s;
					lines[i] += "= ";
					lines[i] += val;
				}
				else
				{
					// remove value
					CVectorSString::iterator it = lines.begin() + i;
					lines.erase(it);
					i--;
					b--;
				}
			}
		}		
	}

	// param not found
	if (!found && !val.empty() && val != "nul")
	{
		// add it
		if (field.find("_CraftParameters") == string::npos)
		{
			// before craftLine
			CVectorSString::iterator it = lines.begin() + craftLine;
			lines.insert(it, s + "= " + val);
		}
		else
		{
			// after craftLine
			CVectorSString::iterator it = lines.begin() + craftLine + 1;
			lines.insert(it, s + "= " + val);
		}
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:93,代码来源:named_items_2_csv.cpp


注:本文中的CVectorSString::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。