# mimedump.h

Go to the documentation of this file.

    00001 ///
    00002 /// \file       mimedump.h
    00003 ///             Overloaded templates for handling Mime output
    00004 ///
    00005
    00006 /*
    00007     Copyright (C) 2010-2011, Net Direct Inc. (http://www.netdirect.ca/)
    00008
    00009     This program is free software; you can redistribute it and/or modify
    00010     it under the terms of the GNU General Public License as published by
    00011     the Free Software Foundation; either version 2 of the License, or
    00012     (at your option) any later version.
    00013
    00014     This program is distributed in the hope that it will be useful,
    00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00017
    00018     See the GNU General Public License in the COPYING file at the
    00019     root directory of this project for more details.
    00020 */
    00021
    00022 #ifndef __BARRY_TOOLS_MIMEDUMP_H__
    00023 #define __BARRY_TOOLS_MIMEDUMP_H__
    00024
    00025 template <class Record>
    00026 class MimeDump
    00027 {
    00028 public:
    00029         static void Dump(std::ostream &os, const Record &rec)
    00030         {
    00031                 os << rec << std::endl;
    00032         }
    00033
    00034         static bool Supported() { return false; }
    00035 };
    00036
    00037 template <>
    00038 class MimeDump<Barry::Contact>
    00039 {
    00040 public:
    00041         static void Dump(std::ostream &os, const Barry::Contact &rec)
    00042         {
    00043                 Barry::Sync::vCard vcard;
    00044                 os << vcard.ToVCard(rec) << std::endl;
    00045         }
    00046
    00047         static bool Supported() { return true; }
    00048 };
    00049
    00050 template <>
    00051 class MimeDump<Barry::Calendar>
    00052 {
    00053 public:
    00054         static void Dump(std::ostream &os, const Barry::Calendar &rec)
    00055         {
    00056                 Barry::Sync::vTimeConverter vtc;
    00057                 Barry::Sync::vCalendar vcal(vtc);
    00058                 os << vcal.ToVCal(rec) << std::endl;
    00059         }
    00060
    00061         static bool Supported() { return true; }
    00062 };
    00063
    00064 template <>
    00065 class MimeDump<Barry::Memo>
    00066 {
    00067 public:
    00068         static void Dump(std::ostream &os, const Barry::Memo &rec)
    00069         {
    00070                 Barry::Sync::vJournal vjournal;
    00071                 os << vjournal.ToMemo(rec) << std::endl;
    00072         }
    00073
    00074         static bool Supported() { return true; }
    00075 };
    00076
    00077 template <>
    00078 class MimeDump<Barry::Task>
    00079 {
    00080 public:
    00081         static void Dump(std::ostream &os, const Barry::Task &rec)
    00082         {
    00083                 Barry::Sync::vTimeConverter vtc;
    00084                 Barry::Sync::vTodo vtodo(vtc);
    00085                 os << vtodo.ToTask(rec) << std::endl;
    00086         }
    00087
    00088         static bool Supported() { return true; }
    00089 };
    00090
    00091 #endif
    00092