Back to index

courier  0.68.2
rematchmsg.h
Go to the documentation of this file.
00001 #ifndef       rematchmsg_h
00002 #define       rematchmsg_h
00003 
00004 
00005 class Message;
00006 
00007 #include      "config.h"
00008 #include      <sys/types.h>
00009 // #include   <unistd.h>
00010 #include      "rematch.h"
00011 
00013 //
00014 // ReMatchMsg - match regular expression against the message directly.
00015 //
00016 // This class is derived from ReMatch, and is used when a regular expression
00017 // should be matched against the message directly.
00018 // It defines the virtual functions from ReMatch to go against the Message
00019 // class itself.
00020 //
00021 // The constructor takes two flags:  headeronly, and mergelines.
00022 // "headeronly" forces and end-of-file condition when a blank line is found
00023 // in the message.  "mergelines" causes a newline character to be silently
00024 // eaten, when it is immediately followed by a space.  The flags must be
00025 // set as follows, in the following situations:
00026 //
00027 // A)  Match header and body:  mergelines is true, headeronly is false
00028 // B)  Match header only:      mergelines is true, headeronly is true
00029 // C)  Match body only:        mergelines is false, headeronly is false,
00030 //                             also the message must be seeked to the
00031 //                             start of the message contents.
00032 //
00034 
00035 class ReMatchMsg : public ReMatch {
00036        Message *msg;
00037 
00038        int header_only, mergelines;
00039        int eof;
00040        int lastc;
00041 
00042        off_t end_headers;
00043        off_t start;
00044 public:
00045        ReMatchMsg(Message *m, int flag, int flag2);
00046        virtual ~ReMatchMsg();
00047 
00048        int NextChar();
00049        int CurrentChar();
00050        off_t GetCurrentPos();
00051        void SetCurrentPos(off_t);
00052 } ;
00053 #endif