Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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;
		}
	}
}