Logo Search packages:      
Sourcecode: inkscape version File versions

bool buildtool::MakeBase::regexMatch ( const String &  str,
const String &  pattern 
) [protected, inherited]

Check if a given string matches a given regex pattern

Definition at line 3195 of file buildtool.cpp.

References buildtool::MakeBase::error().

Referenced by buildtool::MakeBase::listFiles().

{
    const TRexChar *terror = NULL;
    const TRexChar *cpat = pattern.c_str();
    TRex *expr = trex_compile(cpat, &terror);
    if (!expr)
        {
        if (!terror)
            terror = "undefined";
        error("compilation error [%s]!\n", terror);
        return false;
        } 

    bool ret = true;

    const TRexChar *cstr = str.c_str();
    if (trex_match(expr, cstr))
        {
        ret = true;
        }
    else
        {
        ret = false;
        }

    trex_free(expr);

    return ret;
}


Generated by  Doxygen 1.6.0   Back to index