# mimeio.h

Go to the documentation of this file.

    00001 ///
    00002 /// \file       mimeio.h
    00003 ///             Storage, parser, builder classes for MIME objects
    00004 ///             (vcard, vevent, vtodo, vjournal)
    00005 ///
    00006
    00007 /*
    00008     Copyright (C) 2010-2011, Net Direct Inc. (http://www.netdirect.ca/)
    00009
    00010     This program is free software; you can redistribute it and/or modify
    00011     it under the terms of the GNU General Public License as published by
    00012     the Free Software Foundation; either version 2 of the License, or
    00013     (at your option) any later version.
    00014
    00015     This program is distributed in the hope that it will be useful,
    00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00018
    00019     See the GNU General Public License in the COPYING file at the
    00020     root directory of this project for more details.
    00021 */
    00022
    00023 #ifndef __BARRY_MIMEIO_H__
    00024 #define __BARRY_MIMEIO_H__
    00025
    00026 #include "dll.h"
    00027 #include "builder.h"
    00028 #include <string>
    00029 #include <vector>
    00030 #include <memory>
    00031 #include <iosfwd>
    00032
    00033 namespace Barry {
    00034
    00035 class BXEXPORT MimeBuilder : public Barry::Builder
    00036 {
    00037         std::auto_ptr<std::ifstream> m_ifs;
    00038         std::istream &m_is;
    00039
    00040 public:
    00041         explicit MimeBuilder(const std::string &filename);
    00042         explicit MimeBuilder(std::istream &is);
    00043
    00044         bool BuildRecord(DBData &data, size_t &offset, const IConverter *ic);
    00045         bool FetchRecord(DBData &data, const IConverter *ic);
    00046         bool EndOfFile() const;
    00047
    00048         // return false at end of file, true if a record was read
    00049         static bool ReadMimeRecord(std::istream &is, std::string &vrec,
    00050                                 std::vector<std::string> &types);
    00051         // returns true if item is a member of types, doing a
    00052         // case-insensitive compare
    00053         static bool IsMember(const std::string &item,
    00054                                 const std::vector<std::string> &types);
    00055 };
    00056
    00057 }
    00058
    00059 #endif
    00060