Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

cNewsgroupFilter.cc File Reference

#include <iostream>
#include "NewsgroupFilter.h"

Go to the source code of this file.

Classes

class  CheckAND
class  CheckOR

Defines

#define V(x)   if(verbose) { x; }
#define MAX(X, Y)   (((X)>(Y))?(X):(Y))
#define MIN(X, Y)   (((X)<(Y))?(X):(Y))

Functions

template<class Check> void combine_filters (Check check)
int main (int argc, char *argv[])

Variables

NewsgroupFilter filters []
int filters_n = sizeof(filters) / sizeof(filters[0])
const char * newsgroups []
int newsgroups_n = sizeof(newsgroups) / sizeof(newsgroups[0])
int ef = 0
int verbose = 0


Define Documentation

#define MAX X,
 )     (((X)>(Y))?(X):(Y))
 

Definition at line 34 of file cNewsgroupFilter.cc.

Referenced by clean().

#define MIN X,
 )     (((X)<(Y))?(X):(Y))
 

Definition at line 35 of file cNewsgroupFilter.cc.

#define V  )     if(verbose) { x; }
 

Definition at line 5 of file cNewsgroupFilter.cc.

Referenced by CheckOR::operator()(), and CheckAND::operator()().


Function Documentation

template<class Check>
void combine_filters Check  check  ) 
 

Definition at line 97 of file cNewsgroupFilter.cc.

References filters, and filters_n.

Referenced by main().

00098 {
00099         for (int i = 0; i < filters_n; i++) {
00100                 NewsgroupFilter fi(filters[i]);
00101                 cout << i << ": " << flush;
00102                 for (int j = 0; j < filters_n; j++) {
00103                         NewsgroupFilter fj(filters[j]);
00104                         check(fi, fj);
00105                 }
00106                 cout << endl;
00107         }
00108 }

int main int  argc,
char *  argv[]
 

Definition at line 110 of file cNewsgroupFilter.cc.

References combine_filters(), ef, and verbose.

00111 {
00112         if (argc > 1 && strcmp(argv[1], "-v") == 0)
00113                 verbose = 1;
00114         cout << "cNewsgroupFilter:\n";
00115 
00116         cout << "operator&=:\n";
00117         combine_filters(CheckAND());
00118 
00119         cout << "operator|=:\n";
00120         combine_filters(CheckOR());
00121 
00122         if (ef == 0) {
00123                 cout << "cNewsgroupFilter: all tests succeeded\n";
00124                 exit(0);
00125         } else {
00126                 cout << "cNewsgroupFilter: " << ef << " failures\n";
00127                 exit(-1);
00128         }
00129 }


Variable Documentation

int ef = 0
 

Definition at line 31 of file cNewsgroupFilter.cc.

Referenced by main(), CheckOR::operator()(), and CheckAND::operator()().

NewsgroupFilter filters[]
 

Initial value:

 {
        NewsgroupFilter("at.*"),
        NewsgroupFilter("comp.*"),
        NewsgroupFilter("comp.*,!comp.os.windows.*"),
        NewsgroupFilter("at.*,!at.secret.*,!at.top.secret.*"),
        NewsgroupFilter("at.*,!at.top.secret.*,comp.os.linux.*"),
        NewsgroupFilter("at.*,!at.top.*"),
        NewsgroupFilter("at.*,!at.top.top.top.*"),
        NewsgroupFilter("at.top.top.*,!at.top.top.top.*")
}

Definition at line 7 of file cNewsgroupFilter.cc.

Referenced by combine_filters().

int filters_n = sizeof(filters) / sizeof(filters[0])
 

Definition at line 17 of file cNewsgroupFilter.cc.

Referenced by combine_filters().

const char* newsgroups[]
 

Initial value:

 {
        "at.tuwien.general",
        "comp.os.linux",
        "at.top.secret.aaa",
        "at.top.top.secret.xxx",
        "at.top.top.top.secret.yyy",
        "at.top.top.top.top.secret.zzz",
        "at.secret.bbb",
        "foo.bar"
}

Definition at line 19 of file cNewsgroupFilter.cc.

Referenced by ns_post(), CheckOR::operator()(), CheckAND::operator()(), and RServer::post().

int newsgroups_n = sizeof(newsgroups) / sizeof(newsgroups[0])
 

Definition at line 29 of file cNewsgroupFilter.cc.

Referenced by CheckOR::operator()(), and CheckAND::operator()().

int verbose = 0
 

Definition at line 32 of file cNewsgroupFilter.cc.

Referenced by main().


Generated on Fri Aug 20 10:58:08 2004 for NewsCache by doxygen 1.3.6-20040222