lib: removed dead code from Bookmark parser
[barry/progweb.git] / desktop / src / StringSync.cc
blobefdb4cd52369d6be46541a7a596d7f783a7d85af
1 ///
2 /// \file StringSync.h
3 /// Class to easily manage the wxString / std::string boundary
4 ///
6 /*
7 Copyright (C) 2011-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 #include "StringSync.h"
24 using namespace std;
27 //////////////////////////////////////////////////////////////////////////////
28 // StringSync
30 StringSync::~StringSync()
32 Sync();
35 wxString* StringSync::Add(std::string &source)
37 m_wx.push_front(WxIsCopyType(wxString(source.c_str(), wxConvUTF8), &source));
38 return &m_wx.begin()->first;
41 std::string* StringSync::Add(wxString &source)
43 m_std.push_front(StdIsCopyType(std::string(source.utf8_str()), &source));
44 return &m_std.begin()->first;
47 void StringSync::SyncToStd()
49 WxIsCopyList::iterator b = m_wx.begin();
50 for( ; b != m_wx.end(); ++b ) {
51 b->second->assign(b->first.utf8_str());
55 void StringSync::SyncToWx()
57 StdIsCopyList::iterator b = m_std.begin();
58 for( ; b != m_std.end(); ++b ) {
59 *b->second = wxString(b->first.c_str(), wxConvUTF8);
63 void StringSync::Sync()
65 SyncToStd();
66 SyncToWx();