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


C++ StringVector::add方法代码示例

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


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

示例1: throw

void
checkForUnmatchedPatterns(
	const Configuration *		cfg,
	const StringVector &		namesList,
	const StringVector &		wildcardedNamesAndTypes,
	StringVector &				unmatchedPatterns) throw(ConfigurationException)
{
	int							i;
	int							len;
	const char *				wildcardedName;

	unmatchedPatterns.empty();
	//--------
	// Check if there is a wildcarded name that does not match anything
	//--------
	len = wildcardedNamesAndTypes.length();
	for (i = 0; i < len; i += 3) {
		wildcardedName = wildcardedNamesAndTypes[i+1];
		if (!doesPatternMatchAnyUnexpandedNameInList(cfg, wildcardedName,
		                                             namesList))
		{
			unmatchedPatterns.add(wildcardedName);
		}
	}
}
开发者ID:2mia,项目名称:config4cpp,代码行数:25,代码来源:config2cpp-main.cpp

示例2:

void
ConfigScope::listLocalNames(
	Configuration::Type		typeMask,
	StringVector &			vec) const
{
	int						i;
	int						countWanted;
	int						countUnwanted;
	ConfigScopeEntry *		entry;

	//--------
	// Iterate over all the entries in the hash table and copy
	// their names into the StringVector
	//--------
	vec.empty();
	vec.ensureCapacity(m_numEntries);
	countWanted = 0;
	countUnwanted = 0;
	for (i = 0; i < m_tableSize; i++) {
		entry = m_table[i].m_next;
		while (entry) {
			if (entry->type() & typeMask) {
				vec.add(entry->name());
				countWanted++;
			} else {
				countUnwanted++;
			}
			entry = entry->m_next;
		}
	}
	assert(countWanted + countUnwanted == m_numEntries);
}
开发者ID:offa,项目名称:config4cpp,代码行数:32,代码来源:ConfigScope.cpp

示例3: listFilter

void
ConfigScope::listScopedNamesHelper(
	const char *				prefix,
	Configuration::Type			typeMask,
	bool						recursive,
	const StringVector &		filterPatterns,
	StringVector &				vec) const
{
	int							i;
	ConfigScopeEntry *			entry;
	StringBuffer				scopedName;

	//--------
	// Iterate over all the entries in the hash table and copy
	// their locally-scoped names into the StringVector
	//--------
	vec.ensureCapacity(vec.length() + m_numEntries);
	for (i = 0; i < m_tableSize; i++) {
		entry = m_table[i].m_next;
		while (entry) {
			scopedName = prefix;
			if (prefix[0] != '\0') {
				scopedName.append(".");
			}
			scopedName.append(entry->name());
			if ((entry->type() & typeMask)
			    && listFilter(scopedName.c_str(), filterPatterns))
			{
				vec.add(scopedName);
			}
			if (recursive && entry->type() == Configuration::CFG_SCOPE) {
				entry->item()->scopeVal()->listScopedNamesHelper(
												scopedName.c_str(), typeMask,
												true, filterPatterns, vec);
			}
			entry = entry->m_next;
		}
	}
}
开发者ID:offa,项目名称:config4cpp,代码行数:39,代码来源:ConfigScope.cpp


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