Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/serialization/src/xml_woarchive.cpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 1.8 KB
Line 
1/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2// xml_woarchive.cpp:
3
4// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5// Use, modification and distribution is subject to the Boost Software
6// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8
9//  See http://www.boost.org for updates, documentation, and revision history.
10
11#include <boost/config.hpp>
12#ifdef BOOST_NO_STD_WSTREAMBUF
13#error "wide char i/o not supported on this platform"
14#else
15
16#define BOOST_WARCHIVE_SOURCE
17#include <boost/archive/xml_woarchive.hpp>
18
19/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
20// implemenations of functions specific to wide char archives
21
22#include <boost/archive/impl/basic_xml_oarchive.ipp>
23#include <boost/archive/impl/xml_woarchive_impl.ipp>
24#include <boost/archive/impl/archive_pointer_oserializer.ipp>
25
26namespace boost {
27namespace archive {
28
29BOOST_WARCHIVE_DECL(std::wostream &)
30operator<<(std::wostream &os, const char *t){
31    for(;;){
32        wchar_t wc;
33        int result = std::mbtowc(&wc, t, 10 /* max number */);
34        if(0 < result)
35            os.put(wc);
36        else
37        if(0 == result)
38            break;
39        else
40            boost::throw_exception(
41                iterators::dataflow_exception(
42                    iterators::dataflow_exception::invalid_conversion
43                )
44            );
45    }
46    return os;
47}
48
49BOOST_WARCHIVE_DECL(std::wostream &)
50operator<<(std::wostream &os, const char t){
51    wchar_t wc;
52    std::mbtowc(&wc, &t, 1);
53    os.put(wc);
54    return os;
55}
56
57template class basic_xml_oarchive<xml_woarchive> ;
58template class xml_woarchive_impl<xml_woarchive> ;
59template class detail::archive_pointer_oserializer<xml_woarchive> ;
60
61} // namespace archive
62} // namespace boost
63
64#endif // BOOST_NO_STD_WSTREAMBUF
Note: See TracBrowser for help on using the repository browser.