Crazy Eddie's GUI System  ${CEGUI_VERSION}
value_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 value_traits.hpp:
10 //
11 // Traits information for use in determining which Python methods to
12 // support for a container with elements of a given type.
13 //
14 // History
15 // =======
16 // 2003/ 9/12 rmg File creation
17 // 2008/12/08 Roman Change indexing suite layout
18 //
19 // $Id: value_traits.hpp,v 1.1.2.6 2003/12/05 17:36:12 raoulgough Exp $
20 //
21 
22 #ifndef BOOST_PYTHON_INDEXING_VALUE_TRAITS_HPP
23 #define BOOST_PYTHON_INDEXING_VALUE_TRAITS_HPP
24 
25 #include <boost/config.hpp>
26 #include <boost/shared_ptr.hpp>
27 #include <functional>
28 
29 namespace boost { namespace python { namespace indexing {
30  // The default_value_traits template is used by all ContainerTraits
31  // templates. It can be overridden by specialization or by supplying
32  // the optional ValueTraits parameter to a container traits
33  // template.
34  template<typename T> struct value_traits;
35 
36  // Implementation for default use. Providing this in a separate
37  // template allows specializations of value_traits to make use of
38  // it.
39  template<typename T>
41  BOOST_STATIC_CONSTANT (bool, equality_comparable = true);
42  typedef std::equal_to<T> equal_to;
43 
44  BOOST_STATIC_CONSTANT (bool, less_than_comparable = true);
45  typedef std::less<T> less;
46 
47  // Default, do-nothing, version of visit_container_class
48  template<typename PythonClass, typename Policy>
49  static void visit_container_class (PythonClass &, Policy const &) { }
50  };
51 
52  // Implementation using pointer indirection
53  template <typename Ptr>
55  // Hide the base class versions of the comparisons, using these
56  // indirect versions
57  struct less : std::binary_function<Ptr, Ptr, bool> {
58  bool operator() (Ptr const &p1, Ptr const &p2) const {
59  return *p1 < *p2;
60  }
61  };
62 
63  struct equal_to : std::binary_function<Ptr, Ptr, bool> {
64  bool operator() (Ptr const &p1, Ptr const &p2) const {
65  return *p1 == *p2;
66  }
67  };
68  };
69 
70  // Default implementation selection. It's basically just a typedef
71  // for simple_value_traits
72  template<typename T>
74  {
75  };
76 
77 #if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
78  // Partial specialization for instances of boost::shared_ptr
79  template<typename T>
80  struct value_traits< ::boost::shared_ptr<T> >
81  : indirect_value_traits< ::boost::shared_ptr<T> >
82  {
83  };
84 #endif
85 } } }
86 
87 #endif // BOOST_PYTHON_INDEXING_VALUE_TRAITS_HPP
88 
89 
90 
Definition: value_traits.hpp:34
Definition: value_traits.hpp:40
Definition: python_CEGUI.h:9
Definition: value_traits.hpp:54