1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/pending/property.hpp Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,132 @@
1.4 +// (C) Copyright Jeremy Siek 2004
1.5 +// Distributed under the Boost Software License, Version 1.0. (See
1.6 +// accompanying file LICENSE_1_0.txt or copy at
1.7 +// http://www.boost.org/LICENSE_1_0.txt)
1.8 +
1.9 +#ifndef BOOST_PROPERTY_HPP
1.10 +#define BOOST_PROPERTY_HPP
1.11 +
1.12 +#include <boost/pending/ct_if.hpp>
1.13 +
1.14 +namespace boost {
1.15 +
1.16 + struct no_property {
1.17 + typedef no_property tag_type;
1.18 + typedef no_property next_type;
1.19 + typedef no_property value_type;
1.20 + enum { num = 0 };
1.21 + typedef void kind;
1.22 + };
1.23 +
1.24 + template <class Tag, class T, class Base = no_property>
1.25 + struct property : public Base {
1.26 + typedef Base next_type;
1.27 + typedef Tag tag_type;
1.28 + typedef T value_type;
1.29 +#if BOOST_WORKAROUND (__GNUC__, < 3)
1.30 + property() { }
1.31 +#else
1.32 + property() : m_value() { }
1.33 +#endif
1.34 + property(const T& v) : m_value(v) { }
1.35 + property(const T& v, const Base& b) : Base(b), m_value(v) { }
1.36 + // copy constructor and assignment operator will be generated by compiler
1.37 +
1.38 + T m_value;
1.39 + };
1.40 +
1.41 + // The BGL properties specialize property_kind and
1.42 + // property_num, and use enum's for the Property type (see
1.43 + // graph/properties.hpp), but the user may want to use a class
1.44 + // instead with a nested kind type and num. Also, we may want to
1.45 + // switch BGL back to using class types for properties at some point.
1.46 +
1.47 + template <class PropertyTag>
1.48 + struct property_kind {
1.49 + typedef typename PropertyTag::kind type;
1.50 + };
1.51 +
1.52 + template <class P>
1.53 + struct has_property {
1.54 + BOOST_STATIC_CONSTANT(bool, value = true);
1.55 + typedef true_type type;
1.56 + };
1.57 + template <>
1.58 + struct has_property<no_property> {
1.59 + BOOST_STATIC_CONSTANT(bool, value = false);
1.60 + typedef false_type type;
1.61 + };
1.62 +
1.63 +} // namespace boost
1.64 +
1.65 +#include <boost/pending/detail/property.hpp>
1.66 +
1.67 +namespace boost {
1.68 +
1.69 + template <class PropertyList, class Tag>
1.70 + struct property_value {
1.71 +#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.72 + typedef typename detail::build_property_tag_value_alist<PropertyList>::type AList;
1.73 + typedef typename detail::extract_value<AList,Tag>::type type;
1.74 +#else
1.75 + typedef typename detail::build_property_tag_value_alist<PropertyList>::type AList;
1.76 + typedef typename detail::ev_selector<AList>::type Extractor;
1.77 + typedef typename Extractor::template bind_<AList,Tag>::type type;
1.78 +#endif
1.79 + };
1.80 +
1.81 + template <class Tag1, class Tag2, class T1, class Base>
1.82 + inline typename property_value<property<Tag1,T1,Base>, Tag2>::type&
1.83 + get_property_value(property<Tag1,T1,Base>& p, Tag2 tag2) {
1.84 + BOOST_STATIC_CONSTANT(bool,
1.85 + match = (detail::same_property<Tag1,Tag2>::value));
1.86 + typedef property<Tag1,T1,Base> Prop;
1.87 + typedef typename property_value<Prop, Tag2>::type T2;
1.88 + T2* t2 = 0;
1.89 + typedef detail::property_value_dispatch<match> Dispatcher;
1.90 + return Dispatcher::get_value(p, t2, tag2);
1.91 + }
1.92 + template <class Tag1, class Tag2, class T1, class Base>
1.93 + inline
1.94 + const typename property_value<property<Tag1,T1,Base>, Tag2>::type&
1.95 + get_property_value(const property<Tag1,T1,Base>& p, Tag2 tag2) {
1.96 + BOOST_STATIC_CONSTANT(bool,
1.97 + match = (detail::same_property<Tag1,Tag2>::value));
1.98 + typedef property<Tag1,T1,Base> Prop;
1.99 + typedef typename property_value<Prop, Tag2>::type T2;
1.100 + T2* t2 = 0;
1.101 + typedef detail::property_value_dispatch<match> Dispatcher;
1.102 + return Dispatcher::const_get_value(p, t2, tag2);
1.103 + }
1.104 +
1.105 + namespace detail {
1.106 +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
1.107 + template<typename FinalTag, typename FinalType>
1.108 + struct retag_property_list
1.109 + {
1.110 + typedef property<FinalTag, FinalType> type;
1.111 + typedef FinalType retagged;
1.112 + };
1.113 +
1.114 + template<typename FinalTag, typename Tag, typename T, typename Base>
1.115 + struct retag_property_list<FinalTag, property<Tag, T, Base> >
1.116 + {
1.117 + private:
1.118 + typedef retag_property_list<FinalTag, Base> next;
1.119 +
1.120 + public:
1.121 + typedef property<Tag, T, typename next::type> type;
1.122 + typedef typename next::retagged retagged;
1.123 + };
1.124 +
1.125 + template<typename FinalTag>
1.126 + struct retag_property_list<FinalTag, no_property>
1.127 + {
1.128 + typedef no_property type;
1.129 + typedef no_property retagged;
1.130 + };
1.131 +#endif
1.132 + }
1.133 +} // namesapce boost
1.134 +
1.135 +#endif /* BOOST_PROPERTY_HPP */