src/base/match.cc
/**
 * @todo this should probably be changed to just use regular
 * expression code
 */
@todo this should probably be changed to just use regular
expression code
@todo this should probably be changed to just use regular expression code
bool
ObjectMatch::domatch(const std::string &name) const
{
    std::vector<std::string> name_tokens;
    tokenize(name_tokens, name, '.');
    int ntsize = name_tokens.size();
    int num_expr = tokens.size();
    for (int i = 0; i < num_expr; ++i) {
        const std::vector<std::string> &token = tokens[i];
        int jstop = token.size();
        bool match = true;
        for (int j = 0; j < jstop; ++j) {
            if (j >= ntsize)
                break;
            const std::string &var = token[j];
            if (var != "*" && var != name_tokens[j]) {
                match = false;
                break;
            }
        }
        if (match)
            return true;
    }
    return false;
}
bool ObjectMatch :: domatch ( const std :: string & name ) const { std :: vector < std :: string > name_tokens ; tokenize ( name_tokens , name , ' ' ) ; int ntsize = name_tokens . size ( ) ; int num_expr = tokens . size ( ) ; for ( int i = 0 ; i < num_expr ; ++ i ) { const std :: vector < std :: string > & token = tokens [ i ] ; int jstop = token . size ( ) ; bool match = true ; for ( int j = 0 ; j < jstop ; ++ j ) { if ( j >= ntsize ) break ; const std :: string & var = token [ j ] ; if ( var != " " && var != name_tokens [ j ] ) { match = false ; break ; } } if ( match ) return true ; } return false ; }
@todo this should probably be changed to just use regular
 expression code
@todo this should probably be changed to just use regular expression code