Crazy Eddie's GUI System  ${CEGUI_VERSION}
container_traits.hpp
1 // This file has been generated by Py++.
2 
3 // Copyright (c) 2003 Raoul M. Gough
4 //
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
7 // at http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // Header file container_traits.hpp
10 //
11 // Traits information about entire containers for use in determining
12 // what Python methods to provide.
13 //
14 // History
15 // =======
16 // 2003/ 8/23 rmg File creation as container_suite.hpp
17 // 2003/ 9/ 8 rmg Renamed container_traits.hpp
18 // 2003/10/28 rmg Split container-specific versions into separate headers
19 // 2004/ 1/28 rmg Convert to bitset-based feature selection
20 // 2008/12/08 Roman Change indexing suite layout
21 //
22 // $Id: container_traits.hpp,v 1.1.2.15 2004/02/08 18:57:42 raoulgough Exp $
23 //
24 
25 #ifndef BOOST_PYTHON_INDEXING_CONTAINER_TRAITS_HPP
26 #define BOOST_PYTHON_INDEXING_CONTAINER_TRAITS_HPP
27 
28 #include <indexing_suite/suite_utils.hpp>
29 #include <indexing_suite/methods.hpp>
30 #include <indexing_suite/value_traits.hpp>
31 
32 #include <boost/type_traits.hpp>
33 #include <boost/call_traits.hpp>
34 #include <boost/mpl/if.hpp>
35 #include <boost/type_traits/ice.hpp>
36 #include <boost/iterator/iterator_traits.hpp>
37 
38 namespace boost { namespace python { namespace indexing {
39 #if BOOST_WORKAROUND (BOOST_MSVC, <= 1200)
40  // MSVC6 has problems with get_signature if parameter types have
41  // top-level const qualification (e.g. int const). Unfortunately,
42  // this is exactly what happens with boost::call_traits, so we
43  // substitute a really dumb version of it instead.
44 
45  template<typename T> struct broken_call_traits {
46  typedef T const & param_type;
47  };
48 # define BOOST_PYTHON_INDEXING_CALL_TRAITS broken_call_traits
49 #else
50 # define BOOST_PYTHON_INDEXING_CALL_TRAITS ::boost::call_traits
51 #endif
52 
54  // Lowest common denominator traits - applicable to real containers
55  // and iterator pairs
57 
58  template<typename Container, typename ValueTraits = detail::no_override>
60  {
62 
63  protected:
64  BOOST_STATIC_CONSTANT(
65  bool, is_mutable = ! boost::is_const<Container>::value);
66 
67  public:
68  typedef Container container;
69 
70  typedef BOOST_DEDUCED_TYPENAME container::value_type value_type;
71 
72  typedef BOOST_DEDUCED_TYPENAME mpl::if_<
73  is_const<container>,
74  BOOST_DEDUCED_TYPENAME container::const_iterator,
75  BOOST_DEDUCED_TYPENAME container::iterator
76  >::type iterator;
77 
78  typedef typename ::boost::iterator_reference<iterator>::type reference;
79 
80  typedef value_type key_type; // Used for find, etc.
81  typedef typename container::size_type size_type;
82  typedef typename make_signed<size_type>::type index_type;
83  // at(), operator[]. Signed to support Python -ve indexes
84 
85  typedef typename BOOST_PYTHON_INDEXING_CALL_TRAITS<value_type>::param_type
86  value_param;
87  typedef typename BOOST_PYTHON_INDEXING_CALL_TRAITS<key_type>::param_type
88  key_param;
89  typedef typename BOOST_PYTHON_INDEXING_CALL_TRAITS<index_type>::param_type
90  index_param;
91 
92  // Allow client code to replace the default value traits via our
93  // second (optional) template parameter
95  typedef typename detail::maybe_override<
96  default_value_traits, ValueTraits>::type value_traits_type;
97 
98  // Forward visit_container_class to value_traits_type
99  template<typename PythonClass, typename Policy>
100  static void visit_container_class(
101  PythonClass &pyClass, Policy const &policy)
102  {
103  value_traits_type::visit_container_class (pyClass, policy);
104  }
105  };
106 
108  // ContainerTraits for sequences with random access - std::vector,
109  // std::deque and the like
111 
112  template<typename Container, typename ValueTraits = detail::no_override>
114  : public base_container_traits<Container, ValueTraits>
115  {
117 
118  public:
119  typedef typename base_class::value_traits_type value_traits_type;
120 
121  BOOST_STATIC_CONSTANT(
122  method_set_type,
123  supported_methods = (
124  method_len
125  | method_getitem
126  | method_getitem_slice
127 
129  value_traits_type::equality_comparable,
130  method_index
131  | method_contains
132  | method_count
133  >::value
134 
136  base_class::is_mutable,
137  method_setitem
138  | method_setitem_slice
139  | method_delitem
140  | method_delitem_slice
141  | method_reverse
142  | method_append
143  | method_insert
144  | method_extend
145  >::value
146 
148  type_traits::ice_and<
149  base_class::is_mutable,
150  value_traits_type::less_than_comparable
151  >::value,
152  method_sort
153  >::value
154 
155  ));
156 
157  // Not supported: method_iter, method_has_key
158  };
159 
160 } } }
161 
162 #endif // BOOST_PYTHON_INDEXING_CONTAINER_SUITE_HPP
163 
164 
165 
Definition: value_traits.hpp:34
Definition: container_traits.hpp:113
Definition: python_CEGUI.h:11
Definition: container_traits.hpp:59