Project revived from Feb2017
[EroSomnia.git] / deps / boost_1_63_0 / boost / serialization / extended_type_info.hpp
blobbb2a190d46520fae3e2b77a5b943e30316b3893d
1 #ifndef BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP
2 #define BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER)
6 # pragma once
7 #endif
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // extended_type_info.hpp: interface for portable version of type_info
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 // for now, extended type info is part of the serialization libraries
20 // this could change in the future.
21 #include <cstdarg>
22 #include <boost/assert.hpp>
23 #include <cstddef> // NULL
24 #include <boost/config.hpp>
25 #include <boost/noncopyable.hpp>
26 #include <boost/mpl/bool.hpp>
28 #include <boost/serialization/config.hpp>
29 #include <boost/config/abi_prefix.hpp> // must be the last header
30 #ifdef BOOST_MSVC
31 # pragma warning(push)
32 # pragma warning(disable : 4251 4231 4660 4275)
33 #endif
35 #define BOOST_SERIALIZATION_MAX_KEY_SIZE 128
37 namespace boost {
38 namespace serialization {
40 namespace void_cast_detail{
41 class void_caster;
44 class BOOST_SYMBOL_VISIBLE extended_type_info :
45 private boost::noncopyable
47 private:
48 friend class boost::serialization::void_cast_detail::void_caster;
50 // used to uniquely identify the type of class derived from this one
51 // so that different derivations of this class can be simultaneously
52 // included in implementation of sets and maps.
53 const unsigned int m_type_info_key;
54 virtual bool is_less_than(const extended_type_info & /*rhs*/) const = 0;
55 virtual bool is_equal(const extended_type_info & /*rhs*/) const = 0;
56 const char * m_key;
58 protected:
59 BOOST_SERIALIZATION_DECL void key_unregister() const;
60 BOOST_SERIALIZATION_DECL void key_register() const;
61 // this class can't be used as is. It's just the
62 // common functionality for all type_info replacement
63 // systems. Hence, make these protected
64 BOOST_SERIALIZATION_DECL extended_type_info(
65 const unsigned int type_info_key,
66 const char * key
68 virtual BOOST_SERIALIZATION_DECL ~extended_type_info();
69 public:
70 const char * get_key() const {
71 return m_key;
73 virtual const char * get_debug_info() const = 0;
74 BOOST_SERIALIZATION_DECL bool operator<(const extended_type_info &rhs) const;
75 BOOST_SERIALIZATION_DECL bool operator==(const extended_type_info &rhs) const;
76 bool operator!=(const extended_type_info &rhs) const {
77 return !(operator==(rhs));
79 // note explicit "export" of static function to work around
80 // gcc 4.5 mingw error
81 static BOOST_SERIALIZATION_DECL const extended_type_info *
82 find(const char *key);
83 // for plugins
84 virtual void * construct(unsigned int /*count*/ = 0, ...) const = 0;
85 virtual void destroy(void const * const /*p*/) const = 0;
88 template<class T>
89 struct guid_defined : boost::mpl::false_ {};
91 namespace ext {
92 template <typename T>
93 struct guid_impl
95 static inline const char * call()
97 return NULL;
102 template<class T>
103 inline const char * guid(){
104 return ext::guid_impl<T>::call();
107 } // namespace serialization
108 } // namespace boost
110 #ifdef BOOST_MSVC
111 #pragma warning(pop)
112 #endif
114 #include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
116 #endif // BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP