Exemplo n.º 1
0
/*
 * File Filter main thread
 */
int main(int argc, char** argv) {

    AbstractFileFilter* copyFF = new CopyFileFilter();
    AbstractFileFilter* upFF = new UppercaseFileFilter();
    AbstractFileFilter* enFF = new EncryptionFile();

    ifstream in("FileFilter.txt");
    ofstream outCopy("CopyFileFilter.txt");
    ofstream outUp("UpperFileFilter.txt");
    ofstream outEn("EncryptionFileFilter.txt");

    copyFF->doFilter(in, outCopy);

    in.open("FileFilter.txt");
    upFF->doFilter(in, outUp);

    in.open("FileFilter.txt");
    enFF->doFilter(in, outEn);

    cout << "Please check the three below files for results:\n"
            "1.CopyFileFilter.txt\n"
            "2.UpperFileFilter.txt\n"
            "3.EncryptionFileFilter.txt\n";
    
    return 0;
}
Exemplo n.º 2
0
void doCopy(const AbstractFileFilter &filter, char* srcFile, char* destFile)
{
	ifstream in(srcFile);
	ofstream out(destFile);
	filter.doFilter(in, out);
	in.close();
	out.close();
}