Exemple #1
0
/**
 * Find()
 *
 * Finds the next file descibed by a pattern in the archive, starting
 * the file given by second parameter
 *
 * @param pattern   The file-pattern to search for. May contain '*' and/or '?'
 * @param startfrom The filename which the search should start after
 * @returns         The full pathname of the found file
 */
const wxString wxChmTools::Find(const wxString& pattern,
                                const wxString& startfrom)
{
    int count;
    wxString tmp;
    wxString pattern_tmp(pattern);
    wxString startfrom_tmp(startfrom);
    pattern_tmp.MakeLower();
    startfrom_tmp.MakeLower();

    if ( m_fileNames && (count = m_fileNames->GetCount()) > 0 )
    {
        for (int i = 0; i < count; i++)
        {
            tmp = m_fileNames->Item(i).MakeLower();
            // if we find the string where the search should began
            if ( tmp.Matches(startfrom_tmp) ||
                 tmp.Mid(1).Matches(startfrom_tmp) )
                continue;
            if ( tmp.Matches(pattern_tmp) ||
                 tmp.Mid(1).Matches(pattern_tmp) )
            {
                return tmp;
            }
        }
    }

    return wxEmptyString;
}
Exemple #2
0
bool FileComparer::block_fromComparedToPattern(long compared_x, long compared_y, long pattern_x, long pattern_y){

    string line;
    
    if(!block_createNew_fromComparedToPattern("tmp.txt", compared_x, compared_y, pattern_x, pattern_y))
        return false;

    fs_pattern.close();
    ofstream pattern_tmp(path_pattern);
    ifstream tmp("tmp.txt");

    while(tmp.good()) {
        getline(tmp, line);
        pattern_tmp << line << endl;
    }

    tmp.close();
    pattern_tmp.close();
    setPatternFile(path_pattern);

    remove("tmp.txt");

    return true;
};