1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // extended_type_info_no_rtti.cpp: specific implementation of type info
3 // that is NOT based on typeid
5 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
6 // Use, modification and distribution is subject to the Boost Software
7 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
10 // See http://www.boost.org for updates, documentation, and revision history.
13 #include <cstddef> // NULL
14 #include <boost/assert.hpp>
16 #include <boost/config.hpp>
17 #if defined(BOOST_NO_STDC_NAMESPACE)
18 namespace std
{ using ::strcmp
; }
21 // it marks our code with proper attributes as being exported when
22 // we're compiling it while marking it import when just the headers
24 #define BOOST_SERIALIZATION_SOURCE
25 #include <boost/serialization/config.hpp>
26 #include <boost/serialization/extended_type_info_no_rtti.hpp>
28 #define EXTENDED_TYPE_INFO_NO_RTTI_KEY 2
31 namespace serialization
{
32 namespace no_rtti_system
{
34 BOOST_SERIALIZATION_DECL
35 extended_type_info_no_rtti_0::extended_type_info_no_rtti_0(
38 extended_type_info(EXTENDED_TYPE_INFO_NO_RTTI_KEY
, key
)
41 BOOST_SERIALIZATION_DECL
bool
42 extended_type_info_no_rtti_0::is_less_than(
43 const boost::serialization::extended_type_info
&rhs
) const
45 // shortcut for common case
48 const char * l
= get_key();
49 const char * r
= rhs
.get_key();
50 // if this assertion is triggered, it could mean one of the following
51 // a) This class was never exported - make sure all calls which use
52 // this method of type id are in fact exported.
53 // b) This class was used (e.g. serialized through a pointer) before
54 // it was exported. Make sure that classes which use this method
55 // of type id are NOT "automatically" registered by serializating
56 // through a pointer to the to most derived class. OR make sure
57 // that the BOOST_CLASS_EXPORT is included in every file
59 BOOST_ASSERT(NULL
!= l
);
60 BOOST_ASSERT(NULL
!= r
);
61 return std::strcmp(l
, r
) < 0;
64 BOOST_SERIALIZATION_DECL
bool
65 extended_type_info_no_rtti_0::is_equal(
66 const boost::serialization::extended_type_info
&rhs
) const
68 // shortcut for common case
71 // null keys don't match with anything
72 const char * l
= get_key();
73 BOOST_ASSERT(NULL
!= l
);
76 const char * r
= rhs
.get_key();
77 BOOST_ASSERT(NULL
!= r
);
80 return 0 == std::strcmp(l
, r
);
83 BOOST_SERIALIZATION_DECL
84 extended_type_info_no_rtti_0::~extended_type_info_no_rtti_0()
88 } // namespace serialization