diff options
Diffstat (limited to 'src/include/mime.h')
-rw-r--r-- | src/include/mime.h | 96 |
1 files changed, 73 insertions, 23 deletions
diff --git a/src/include/mime.h b/src/include/mime.h index 2033442..f35ebb2 100644 --- a/src/include/mime.h +++ b/src/include/mime.h @@ -6,28 +6,36 @@ * ----------------------------------------------------------------- **/ #ifndef mime_h_included #define mime_h_included +#include <map> #include <string> #include <vector> -#include <map> + #include <stdio.h> namespace Binc { - //---------------------------------------------------------------------- + //---------------------------------------------------------------------- class HeaderItem { private: mutable std::string key; mutable std::string value; public: - inline const std::string &getKey(void) const { return key; } - inline const std::string &getValue(void) const { return value; } + inline const std::string &getKey(void) const + { + return key; + } + + inline const std::string &getValue(void) const + { + return value; + } //-- HeaderItem(void); HeaderItem(const std::string &key, const std::string &value); }; - //---------------------------------------------------------------------- + //---------------------------------------------------------------------- class Header { private: mutable std::vector<HeaderItem> content; @@ -46,6 +54,7 @@ namespace Binc { //---------------------------------------------------------------------- class IODevice; class MimeDocument; + class MimePart { protected: public: @@ -64,32 +73,66 @@ namespace Binc { mutable unsigned int size; public: - enum FetchType { - FetchBody, - FetchHeader, - FetchMime - }; + enum FetchType { FetchBody, FetchHeader, FetchMime }; mutable Header h; mutable std::vector<MimePart> members; - inline const std::string &getSubType(void) const { return subtype; } - inline bool isMultipart(void) const { return multipart; } - inline bool isMessageRFC822(void) const { return messagerfc822; } - inline unsigned int getSize(void) const { return bodylength; } - inline unsigned int getNofLines(void) const { return nlines; } - inline unsigned int getNofBodyLines(void) const { return nbodylines; } - inline unsigned int getBodyLength(void) const { return bodylength; } - inline unsigned int getBodyStartOffset(void) const { return bodystartoffsetcrlf; } + inline const std::string &getSubType(void) const + { + return subtype; + } + + inline bool isMultipart(void) const + { + return multipart; + } + + inline bool isMessageRFC822(void) const + { + return messagerfc822; + } + + inline unsigned int getSize(void) const + { + return bodylength; + } + + inline unsigned int getNofLines(void) const + { + return nlines; + } + + inline unsigned int getNofBodyLines(void) const + { + return nbodylines; + } + + inline unsigned int getBodyLength(void) const + { + return bodylength; + } + + inline unsigned int getBodyStartOffset(void) const + { + return bodystartoffsetcrlf; + } void printBody(int fd, Binc::IODevice &output, unsigned int startoffset, unsigned int length) const; - void printHeader(int fd, Binc::IODevice &output, std::vector<std::string> headers, - bool includeheaders, unsigned int startoffset, unsigned int length, std::string &storage) const; + void printHeader(int fd, + Binc::IODevice &output, + std::vector<std::string> headers, + bool includeheaders, + unsigned int startoffset, + unsigned int length, + std::string &storage) const; void printDoc(int fd, Binc::IODevice &output, unsigned int startoffset, unsigned int length) const; virtual void clear(void) const; - const MimePart *getPart(const std::string &findpart, std::string genpart, FetchType fetchType = FetchBody) const; + const MimePart *getPart(const std::string &findpart, + std::string genpart, + FetchType fetchType = FetchBody) const; virtual int parseOnlyHeader(const std::string &toboundary) const; virtual int parseFull(const std::string &toboundary, int &boundarysize) const; @@ -108,8 +151,15 @@ namespace Binc { void parseFull(int fd) const; void clear(void) const; - inline bool isHeaderParsed(void) { return headerIsParsed; } - inline bool isAllParsed(void) { return allIsParsed; } + inline bool isHeaderParsed(void) + { + return headerIsParsed; + } + + inline bool isAllParsed(void) + { + return allIsParsed; + } //-- MimeDocument(void); |