3 /// Class to easily manage the wxString / std::string boundary
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 #ifndef __BARRYDESKTOP_STRING_SYNC_H__
23 #define __BARRYDESKTOP_STRING_SYNC_H__
31 /// Provides a wxString or std::string while maintaining a link to
32 /// a corresponding external string of the opposite kind. When
33 /// Sync() is called, the external linked string is updated with the
34 /// current contents of the returned string.
39 typedef std::pair
<wxString
, std::string
*> WxIsCopyType
;
40 typedef std::pair
<std::string
, wxString
*> StdIsCopyType
;
41 typedef std::list
<WxIsCopyType
> WxIsCopyList
;
42 typedef std::list
<StdIsCopyType
> StdIsCopyList
;
49 /// On destruction, calls Sync()
52 /// Creates an internal wxString, copies the contents of source
53 /// into it, and returns its reference.
54 wxString
* Add(std::string
&source
);
57 std::string
* Add(wxString
&source
);
59 /// Copies all internal wxString contents into the corresponding
60 /// external std::strings.
63 /// Copies all internal std::string contents into the corresponding
64 /// external wxStrings.
67 /// Calls SyncToStd() and then SyncToWx()