]>
Commit | Line | Data |
---|---|---|
bd3239d2 MF |
1 | class QString { |
2 | public:inline QString(const int i); | |
3 | }; | |
4 | class QGenericArgument { | |
5 | }; | |
6 | class ExtensionOption { | |
7 | }; | |
8 | template < typename T2 > struct if_ { | |
9 | typedef T2 type; | |
10 | }; | |
11 | template < typename T > struct c_imp { | |
12 | typedef const T & param_type; | |
13 | }; | |
14 | template < typename T > struct call_traits { | |
15 | typedef typename c_imp < T >::param_type param_type; | |
16 | }; | |
17 | class object; | |
18 | template < class T > struct rvalue_from_python_data { | |
19 | ~rvalue_from_python_data(); | |
20 | }; | |
21 | template < class T > struct extract_rvalue { | |
22 | typedef typename if_ < typename call_traits < | |
23 | T >::param_type >::type result_type; | |
24 | mutable rvalue_from_python_data < T > m_data; | |
25 | }; | |
26 | template < class T > struct select_extract { | |
27 | typedef typename if_ < extract_rvalue < T > >::type type; | |
28 | }; | |
29 | template < class T > struct extract:select_extract < T >::type { | |
30 | private:typedef typename select_extract < T >::type base; | |
31 | public:typedef typename base::result_type result_type; | |
32 | operator result_type() const { | |
33 | } extract(object const &); | |
34 | }; | |
35 | template < class Key, class T > class QHash { | |
36 | public:inline QHash() { | |
37 | } | |
38 | T & operator[](const Key & key); | |
39 | }; | |
40 | ||
41 | class type_details { | |
42 | typedef QGenericArgument(*func_python_to_cpp_type) (const object &); | |
43 | public: template < typename T > | |
44 | static type_details *create_value_type_details() { | |
45 | type_details *self = new type_details(); | |
46 | self->m_func_python_to_cpp = &python_to_value_type < T >; | |
47 | } func_python_to_cpp_type m_func_python_to_cpp; | |
48 | template < class T > | |
49 | static QGenericArgument python_to_value_type(const object & obj) { | |
50 | T *val = new T(extract < T > (obj)); | |
51 | } | |
52 | }; | |
53 | ||
54 | class type_manager { | |
55 | public:static type_manager & instance(); | |
56 | template < typename T > void register_value_type() { | |
57 | m_type_map[0] = | |
58 | type_details::create_value_type_details < T > (); | |
59 | } QHash < QString, type_details * >m_type_map; | |
60 | }; | |
61 | ||
62 | void foo() | |
63 | { | |
64 | type_manager::instance().register_value_type < ExtensionOption > (); | |
65 | } |