persistence/persistent_string.hpp
1: #ifndef STLPLUS_PERSISTENT_STRING
2: #define STLPLUS_PERSISTENT_STRING
3: ////////////////////////////////////////////////////////////////////////////////
4:
5: // Author: Andy Rushton
6: // Copyright: (c) Andy Rushton, 2007
7: // License: BSD License, see ../docs/license.html
8:
9: // Persistence for STL strings
10:
11: ////////////////////////////////////////////////////////////////////////////////
12: #include "persistence_fixes.hpp"
13: #include "persistent_contexts.hpp"
14: #include <string>
15:
16: ////////////////////////////////////////////////////////////////////////////////
17:
18: namespace stlplus
19: {
20:
21: // basic_string
22:
23: template<typename charT, typename traits, typename allocator, typename D>
24: void dump_basic_string(dump_context&, const std::basic_string<charT,traits,allocator>& data, D dump_fn)
25: throw(persistent_dump_failed);
26:
27: template<typename charT, typename traits, typename allocator, typename R>
28: void restore_basic_string(restore_context&, std::basic_string<charT,traits,allocator>& data, R restore_fn)
29: throw(persistent_restore_failed);
30:
31: // string
32:
33: void dump_string(dump_context&, const std::string& data)
34: throw(persistent_dump_failed);
35:
36: void restore_string(restore_context&, std::string& data)
37: throw(persistent_restore_failed);
38:
39:
40: // Note: persistence of wstring not supported because it is too weakly defined and messy
41: // decide on a byte-wide encoding of wide strings (e.g. UTF8) and use the string persistence on that
42:
43: } // end namespace stlplus
44:
45: ////////////////////////////////////////////////////////////////////////////////
46: #include "persistent_string.tpp"
47: #endif