/** * @file imapparser.h * @brief Declaration of the common items for parsing IMAP input * @author Andreas Aardal Hanssen * @date 2002-2005 */ #ifndef imapparser_h_included #define imapparser_h_included #include #include #include namespace Binc { class SequenceSet { public: void addRange(unsigned int a_in, unsigned int b_in); bool isInSet(unsigned int n) const; void addNumber(unsigned int a_in); inline bool isLimited() const { return limited; } static SequenceSet &all(); static SequenceSet &null(); SequenceSet &operator=(const SequenceSet ©); SequenceSet(); SequenceSet(const SequenceSet ©); ~SequenceSet(); protected: bool isNull() const; private: bool limited; bool nullSet; class Range { public: unsigned int from; unsigned int to; Range(unsigned int from, unsigned int to); }; std::vector internal; }; class BincImapParserFetchAtt { public: std::string type; std::string section; std::string sectiontext; std::vector headerlist; unsigned int offsetstart; unsigned int offsetlength; bool hassection; BincImapParserFetchAtt(const std::string &typeName = ""); std::string toString(); }; class BincImapParserSearchKey { public: std::string name; std::string date; std::string astring; std::string bstring; int type; unsigned int number; SequenceSet bset; enum { KEY_AND, KEY_OR, KEY_NOT, KEY_OTHER, KEY_SET }; std::vector children; const SequenceSet &getSet() const; BincImapParserSearchKey(); }; class BincImapParserData { public: virtual ~BincImapParserData() {} }; class Request { private: std::string tag; std::string name; std::string mode; std::string date; std::string userid; std::string password; std::string mailbox; std::string newmailbox; std::string authtype; std::string listmailbox; std::string charset; std::string literal; std::string contextInfo; bool uidmode; public: BincImapParserData *extra; std::vector flags; std::vector statuses; SequenceSet bset; BincImapParserSearchKey searchkey; std::vector fatt; void setUidMode(); bool getUidMode() const; void setTag(std::string &t_in); const std::string &getTag() const; void setMode(const std::string &m_in); const std::string &getMode() const; void setName(const std::string &s_in); const std::string &getName() const; void setLiteral(const std::string &s_in); const std::string &getLiteral() const; void setDate(const std::string &s_in); const std::string &getDate() const; void setCharSet(const std::string &s_in); const std::string &getCharSet() const; void setUserID(const std::string &s_in); const std::string &getUserID() const; void setPassword(const std::string &s_in); const std::string &getPassword() const; void setMailbox(const std::string &s_in); const std::string &getMailbox() const; void setAuthType(const std::string &s_in); const std::string &getAuthType() const; void setNewMailbox(const std::string &s_in); const std::string &getNewMailbox() const; void setListMailbox(const std::string &s_in); const std::string &getListMailbox() const; void setContextInfo(const std::string &s_in); const std::string &getContextInfo() const; SequenceSet &getSet(); std::vector &getFlags(); std::vector &getStatuses(); Request(); ~Request(); }; } #endif