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); } } }
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); }
void calculateSchema( const Configuration * cfg, const StringVector & namesList, const StringVector & recipeUserTypes, const StringVector & wildcardedNamesAndTypes, const StringVector & recipeIgnoreRules, StringVector & schema) throw(ConfigurationException) { int i; int len; StringBuffer rule; StringBuffer buf; const char * name; const char * uName; StringVector uidNames; schema.empty(); schema.add(recipeIgnoreRules); schema.add(recipeUserTypes); len = namesList.length(); for (i = 0; i < len; i++) { name = namesList[i]; if (strstr(name, "uid-") == 0) { calculateRuleForName(cfg, name, name, wildcardedNamesAndTypes,rule); schema.add(rule); } else { uName = cfg->unexpandUid(name, buf); if (!doesVectorcontainString(uidNames, uName)) { uidNames.add(uName); calculateRuleForName(cfg, name, uName, wildcardedNamesAndTypes, rule); schema.add(rule); } } } }
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; } } }