fix doc example typo
[boost.git] / boost / serialization / extended_type_info.hpp
blob74c4b567769a692e408784f984d8a8ca22a1f78b
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) && (_MSC_VER >= 1020)
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 <cassert>
23 #include <cstddef> // NULL
24 #include <boost/config.hpp>
25 #include <boost/noncopyable.hpp>
26 #include <boost/serialization/config.hpp>
28 #include <boost/config/abi_prefix.hpp> // must be the last header
29 #ifdef BOOST_MSVC
30 # pragma warning(push)
31 # pragma warning(disable : 4251 4231 4660 4275)
32 #endif
34 #define BOOST_SERIALIZATION_MAX_KEY_SIZE 128
36 namespace boost {
37 namespace serialization {
38 class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info :
39 private boost::noncopyable
41 private:
42 // used to uniquely identify the type of class derived from this one
43 // so that different derivations of this class can be simultaneously
44 // included in implementation of sets and maps.
45 const unsigned int m_type_info_key;
46 virtual bool
47 is_less_than(const extended_type_info & /*rhs*/) const {
48 assert(false);
49 return false;
51 virtual bool
52 is_equal(const extended_type_info & /*rhs*/) const {
53 assert(false);
54 return false;
56 void key_unregister();
57 protected:
58 const char * m_key;
59 // this class can't be used as is. It's just the
60 // common functionality for all type_info replacement
61 // systems. Hence, make these protected
62 extended_type_info(const unsigned int type_info_key = 0);
63 // account for bogus gcc warning
64 #if defined(__GNUC__)
65 virtual
66 #endif
67 ~extended_type_info();
68 public:
69 const char * get_key() const {
70 return m_key;
72 void key_register(const char *key);
73 bool operator<(const extended_type_info &rhs) const;
74 bool operator==(const extended_type_info &rhs) const;
75 bool operator!=(const extended_type_info &rhs) const {
76 return !(operator==(rhs));
78 static const extended_type_info * find(const char *key);
79 // for plugins
80 virtual void * construct(unsigned int /*count*/ = 0, ...) const {
81 assert(false); // must be implemented if used
82 return NULL;
84 virtual void destroy(void const * const /*p*/) const {
85 assert(false); // must be implemented if used
89 } // namespace serialization
90 } // namespace boost
92 #ifdef BOOST_MSVC
93 #pragma warning(pop)
94 #endif
96 #include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
98 #endif // BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP