Bumped copyright dates for 2013
[barry.git] / desktop / src / ostypes.cc
blobb730094c2bee15c13e56d1388e456cf503d07358
1 ///
2 /// \file ostypes.cc
3 /// Low level type helper functions for os wrapper library
4 ///
6 /*
7 Copyright (C) 2011-2013, 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 #include "ostypes.h"
23 #include <iostream>
25 using namespace std;
27 namespace OpenSync { namespace Config {
29 pst_type PSTString2Type(const std::string &pst_string)
31 pst_type types = PST_NONE;
33 if( pst_string.find("contact") != string::npos )
34 types |= PST_CONTACTS;
35 if( pst_string.find("event") != string::npos )
36 types |= PST_EVENTS;
37 if( pst_string.find("note") != string::npos )
38 types |= PST_NOTES;
39 if( pst_string.find("todo") != string::npos )
40 types |= PST_TODOS;
41 if( pst_string.find("default_only") != string::npos )
42 types |= PST_DO_NOT_SET;
44 cout << "pst_string '" << pst_string << "' to " << types << endl;
45 return types;
48 std::string PSTType2String(pst_type types)
50 string pst_string;
52 if( types & PST_CONTACTS ) pst_string += "contact ";
53 if( types & PST_EVENTS ) pst_string += "event ";
54 if( types & PST_NOTES ) pst_string += "note ";
55 if( types & PST_TODOS ) pst_string += "todo ";
56 if( types & PST_DO_NOT_SET ) pst_string += "default_only ";
58 cout << "type " << types << " to '" << pst_string << "'" << endl;
59 return pst_string;
62 }} // namespace OpenSync::Config