Crazy Eddie's GUI System  ${CEGUI_VERSION}
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
element_proxy_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 element_proxy_traits.hpp
10 //
11 // Note: element_proxy.hpp must be included before this header
12 //
13 // This is a separate header so that element_proxy.hpp is not
14 // dependant on register_ptr_to_python.hpp. This avoids a problem with
15 // two-phase name lookup, where register_ptr_to_python must be
16 // included *after* the element_proxy overload of boost::get_pointer
17 // is declared.
18 //
19 // History
20 // =======
21 // 2003/10/23 rmg File creation
22 // 2008/12/08 Roman Change indexing suite layout
23 //
24 // $Id: element_proxy_traits.hpp,v 1.1.2.5 2003/12/05 17:36:14 raoulgough Exp $
25 //
26 
27 #ifndef BOOST_PYTHON_INDEXING_ELEMENT_PROXY_TRAITS_HPP
28 #define BOOST_PYTHON_INDEXING_ELEMENT_PROXY_TRAITS_HPP
29 
30 #include <indexing_suite/element_proxy.hpp>
31 #include <indexing_suite/value_traits.hpp>
32 #include <boost/python/register_ptr_to_python.hpp>
33 #include <boost/python/implicit.hpp>
34 
35 namespace boost { namespace python { namespace indexing {
36  template<typename ContainerProxy>
38  : public value_traits<
39  BOOST_DEDUCED_TYPENAME ContainerProxy::raw_value_type>
40  {
42  typedef typename ContainerProxy::raw_value_type raw_value_type;
44 
45  // Wrap the base class versions of the comparisons using
46  // indirection
47  struct less
48  : std::binary_function<element_proxy_type, element_proxy_type, bool>
49  {
50  typename base_type::less m_base_compare;
51 
52  bool operator()(
53  element_proxy_type const &p1, element_proxy_type const &p2) const
54  {
55  return m_base_compare (*p1, *p2);
56  }
57  };
58 
59  struct equal_to
60  : std::binary_function<raw_value_type, element_proxy_type, bool>
61  {
62  // First param is raw_value_type to interface smoothly with the
63  // bind1st used in default_algorithms::find
64 
65  typename base_type::equal_to m_base_compare;
66 
67  bool operator()(
68  raw_value_type const &v, element_proxy_type const &p) const
69  {
70  return m_base_compare (v, *p);
71  }
72  };
73 
74  template<typename PythonClass, typename Policy>
75  static void visit_container_class (PythonClass &, Policy const &)
76  {
77  register_ptr_to_python<element_proxy_type>();
78  implicitly_convertible<raw_value_type, element_proxy_type>();
79  }
80  };
81 
82 #if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
83  // value_traits partial specialization for element_proxy instances
84  template<typename ContainerProxy>
85  struct value_traits<element_proxy<ContainerProxy> >
86  : element_proxy_traits<ContainerProxy>
87  {
88  };
89 #endif
90 } } }
91 
92 #endif // BOOST_PYTHON_INDEXING_ELEMENT_PROXY_TRAITS_HPP
93 
94 
95 
Definition: value_traits.hpp:34
Definition: python_CEGUI.h:11
Definition: element_proxy_traits.hpp:59
Definition: element_proxy_traits.hpp:47
Definition: element_proxy_traits.hpp:37
Definition: element_proxy.hpp:33