Boost-Graph

 view release on metacpan or  search on metacpan

include/boost/archive/impl/basic_binary_iprimitive.ipp  view on Meta::CPAN

BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_binary_iprimitive<Archive, IStream>::load(wchar_t * ws)
{
    std::size_t l;
    this->This()->load(l);
    load_binary(ws, l);
    ws[l / sizeof(wchar_t)] = L'\0';
}

template<class Archive, class IStream>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_binary_iprimitive<Archive, IStream>::load(std::string & s)
{
    std::size_t l;
    this->This()->load(l);
    // borland de-allocator fixup
    #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
    if(NULL != s.data())
    #endif
        s.resize(l);
    // note breaking a rule here - could be a problem on some platform
    load_binary(const_cast<char *>(s.data()), l);
}

#ifndef BOOST_NO_CWCHAR
template<class Archive, class IStream>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_binary_iprimitive<Archive, IStream>::load(char * s)
{
    std::size_t l;
    this->This()->load(l);
    load_binary(s, l);
    s[l] = '\0';
}
#endif

#ifndef BOOST_NO_STD_WSTRING
template<class Archive, class IStream>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_binary_iprimitive<Archive, IStream>::load(std::wstring & ws)
{
    std::size_t l;
    this->This()->load(l);
    // borland de-allocator fixup
    #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
    if(NULL != ws.data())
    #endif
        ws.resize(l);
    // note breaking a rule here - is could be a problem on some platform
    load_binary(const_cast<wchar_t *>(ws.data()), l * sizeof(wchar_t) / sizeof(char));
}
#endif

template<class Archive, class IStream>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
basic_binary_iprimitive<Archive, IStream>::basic_binary_iprimitive(
    IStream &is_, 
    bool no_codecvt
) :
    is(is_),
    archive_locale(NULL),
    locale_saver(is)
{
    if(! no_codecvt){
        archive_locale.reset(
            boost::archive::add_facet(
                std::locale::classic(),
                new codecvt_null<BOOST_DEDUCED_TYPENAME IStream::char_type>
            )
        );
        is.imbue(* archive_locale);
    }
}

// scoped_ptr requires that archive_locale be a complete type at time of
// destruction so define destructor here rather than in the header
template<class Archive, class IStream>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
basic_binary_iprimitive<Archive, IStream>::~basic_binary_iprimitive(){
}

} // namespace archive
} // namespace boost



( run in 1.422 second using v1.01-cache-2.11-cpan-ceb78f64989 )