1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/*
** Copyright 2002, Double Precision Inc.
**
** See COPYING for distribution information.
*/
#ifndef libmail_imapparsefmt_H
#define libmail_imapparsefmt_H
#include "libmail_config.h"
#include "mail.H"
#include "imaphandler.H"
#include <vector>
LIBMAIL_START
class imap;
class imapHandlerStructured;
/////////////////////////////////////////////////////////////////////
//
// A helper class for parsing complicated IMAP replies.
//
// Intended to be used by a imapHandlerStructured subclass.
//
// Have the subclass construct this object, then repeatedly call
// process(), as it receives tokens from imapHandlerStructured.
//
// Navigate the built tree when process() returns true, looking at children
// and value members.
class imapparsefmt {
imapparsefmt *current;
public:
bool nil; // NIL value
std::string value; // string value
std::vector<imapparsefmt *> children; // Children
imapparsefmt *parent;
imapparsefmt();
~imapparsefmt();
void begin()
{
*this=imapparsefmt();
}
imapparsefmt &operator=(const imapparsefmt &);
imapparsefmt(const imapparsefmt &);
bool process(imap &, imapHandlerStructured::Token &,
bool &parse_error);
private:
imapparsefmt(imapparsefmt *parent);
void destroy();
};
LIBMAIL_END
#endif
|