lib: added FifoArgs API, for use in passing command line args without command line
[barry.git] / tools / mimedump.h
blobad551f78f7947b1b219da68794e2af5715c2df5b
1 ///
2 /// \file mimedump.h
3 /// Overloaded templates for handling Mime output
4 ///
6 /*
7 Copyright (C) 2010-2012, 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::vTimeConverter vtc;
71 Barry::Sync::vJournal vjournal(vtc);
72 os << vjournal.ToMemo(rec) << std::endl;
75 static bool Supported() { return true; }
78 template <>
79 class MimeDump<Barry::Task>
81 public:
82 static void Dump(std::ostream &os, const Barry::Task &rec)
84 Barry::Sync::vTimeConverter vtc;
85 Barry::Sync::vTodo vtodo(vtc);
86 os << vtodo.ToTask(rec) << std::endl;
89 static bool Supported() { return true; }
92 #endif