3 /// Low level type helper functions for os wrapper library
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.
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
)
37 if( pst_string
.find("note") != string::npos
)
39 if( pst_string
.find("todo") != string::npos
)
41 if( pst_string
.find("default_only") != string::npos
)
42 types
|= PST_DO_NOT_SET
;
44 cout
<< "pst_string '" << pst_string
<< "' to " << types
<< endl
;
48 std::string
PSTType2String(pst_type types
)
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
;
62 }} // namespace OpenSync::Config