the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#ifndef BOOST_SERIALIZATION_NVP_HPP
2#define BOOST_SERIALIZATION_NVP_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER) && (_MSC_VER >= 1020)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// nvp.hpp: interface for serialization system.
11
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)
16
17// See http://www.boost.org for updates, documentation, and revision history.
18
19#include <utility>
20
21#include <boost/config.hpp>
22#include <boost/detail/workaround.hpp>
23// supress noise
24#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
25# pragma warning (disable : 4786) // too long name, harmless warning
26#endif
27
28#include <boost/mpl/integral_c.hpp>
29#include <boost/mpl/integral_c_tag.hpp>
30
31#include <boost/serialization/level.hpp>
32#include <boost/serialization/tracking.hpp>
33#include <boost/serialization/split_member.hpp>
34#include <boost/serialization/base_object.hpp>
35#include <boost/serialization/traits.hpp>
36#include <boost/serialization/wrapper.hpp>
37
38namespace boost {
39namespace serialization {
40
41template<class T>
42struct nvp :
43 public std::pair<const char *, T *>,
44 public wrapper_traits<const nvp< T > >
45{
46 explicit nvp(const char * name_, T & t) :
47 // note: redundant cast works around borland issue
48 // note: added _ to suppress useless gcc warning
49 std::pair<const char *, T *>(name_, (T*)(& t))
50 {}
51 nvp(const nvp & rhs) :
52 // note: redundant cast works around borland issue
53 std::pair<const char *, T *>(rhs.first, (T*)rhs.second)
54 {}
55
56 const char * name() const {
57 return this->first;
58 }
59 T & value() const {
60 return *(this->second);
61 }
62
63 const T & const_value() const {
64 return *(this->second);
65 }
66
67 // True64 compiler complains with a warning about the use of
68 // the name "Archive" hiding some higher level usage. I'm sure this
69 // is an error but I want to accomodated as it generates a long warning
70 // listing and might be related to a lot of test failures.
71 // default treatment for name-value pairs. The name is
72 // just discarded and only the value is serialized.
73 template<class Archivex>
74 void save(
75 Archivex & ar,
76 const unsigned int /* file_version */
77 ) const {
78 // CodeWarrior 8.x can't seem to resolve the << op for a rhs of "const T *"
79 ar.operator<<(const_value());
80 }
81 template<class Archivex>
82 void load(
83 Archivex & ar,
84 const unsigned int /* file_version */
85 ){
86 // CodeWarrior 8.x can't seem to resolve the >> op for a rhs of "const T *"
87 ar.operator>>(value());
88 }
89 BOOST_SERIALIZATION_SPLIT_MEMBER()
90};
91
92template<class T>
93inline
94#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
95const
96#endif
97nvp< T > make_nvp(const char * name, T & t){
98 return nvp< T >(name, t);
99}
100
101// to maintain efficiency and portability, we want to assign
102// specific serialization traits to all instances of this wrappers.
103// we can't strait forward method below as it depends upon
104// Partial Template Specialization and doing so would mean that wrappers
105// wouldn't be treated the same on different platforms. This would
106// break archive portability. Leave this here as reminder not to use it !!!
107#if 0 // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
108
109template <class T>
110struct implementation_level<nvp< T > >
111{
112 typedef mpl::integral_c_tag tag;
113 typedef mpl::int_<object_serializable> type;
114 BOOST_STATIC_CONSTANT(int, value = implementation_level::type::value);
115};
116
117// nvp objects are generally created on the stack and are never tracked
118template<class T>
119struct tracking_level<nvp< T > >
120{
121 typedef mpl::integral_c_tag tag;
122 typedef mpl::int_<track_never> type;
123 BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value);
124};
125
126#endif
127
128} // seralization
129} // boost
130
131#include <boost/preprocessor/stringize.hpp>
132
133#define BOOST_SERIALIZATION_NVP(name) \
134 boost::serialization::make_nvp(BOOST_PP_STRINGIZE(name), name)
135/**/
136
137#define BOOST_SERIALIZATION_BASE_OBJECT_NVP(name) \
138 boost::serialization::make_nvp( \
139 BOOST_PP_STRINGIZE(name), \
140 boost::serialization::base_object<name >(*this) \
141 )
142/**/
143
144#endif // BOOST_SERIALIZATION_NVP_HPP