debian: added libxml++2.6-dev as build dependency
[barry.git] / tools / mimedump.h
blob15a193036d744bab788b287846031da5d6a4cfd9
1 ///
2 /// \file mimedump.h
3 /// Overloaded templates for handling Mime output
4 ///
6 /*
7 Copyright (C) 2010, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRY_TOOLS_MIMEDUMP_H__
23 #define __BARRY_TOOLS_MIMEDUMP_H__
25 template <class Record>
26 class MimeDump
28 public:
29 static void Dump(std::ostream &os, const Record &rec)
31 os << rec << std::endl;
34 static bool Supported() { return false; }
37 template <>
38 class MimeDump<Barry::Contact>
40 public:
41 static void Dump(std::ostream &os, const Barry::Contact &rec)
43 Barry::Sync::vCard vcard;
44 os << vcard.ToVCard(rec) << std::endl;
47 static bool Supported() { return true; }
50 template <>
51 class MimeDump<Barry::Calendar>
53 public:
54 static void Dump(std::ostream &os, const Barry::Calendar &rec)
56 Barry::Sync::vTimeConverter vtc;
57 Barry::Sync::vCalendar vcal(vtc);
58 os << vcal.ToVCal(rec) << std::endl;
61 static bool Supported() { return true; }
64 template <>
65 class MimeDump<Barry::Memo>
67 public:
68 static void Dump(std::ostream &os, const Barry::Memo &rec)
70 Barry::Sync::vJournal vjournal;
71 os << vjournal.ToMemo(rec) << std::endl;
74 static bool Supported() { return true; }
77 template <>
78 class MimeDump<Barry::Task>
80 public:
81 static void Dump(std::ostream &os, const Barry::Task &rec)
83 Barry::Sync::vTimeConverter vtc;
84 Barry::Sync::vTodo vtodo(vtc);
85 os << vtodo.ToTask(rec) << std::endl;
88 static bool Supported() { return true; }
91 #endif