]> git.wh0rd.org - ICEs.git/blobdiff - 321197/pyside.ii.7
more
[ICEs.git] / 321197 / pyside.ii.7
diff --git a/321197/pyside.ii.7 b/321197/pyside.ii.7
new file mode 100644 (file)
index 0000000..51c7385
--- /dev/null
@@ -0,0 +1,58 @@
+class QString { public: inline QString(const int i);};
+class QGenericArgument {};
+class ExtensionOption {};
+       template< typename T2 > struct if_ {
+               typedef T2 type;
+       };
+       template <typename T> struct c_imp {
+               typedef const T& param_type;
+       };
+       template <typename T> struct call_traits {
+               typedef typename c_imp< T >::param_type param_type;
+       };
+       class object;
+               template <class T> struct rvalue_from_python_storage {};
+               template <class T> struct rvalue_from_python_data : rvalue_from_python_storage<T> {
+                       ~rvalue_from_python_data();
+               };
+               template <class T> struct extract_rvalue {
+                       typedef typename if_<typename call_traits<T>::param_type >::type result_type;
+                       mutable rvalue_from_python_data<T> m_data;
+               };
+               template <class T> struct select_extract {
+                       typedef typename if_< extract_rvalue<T> >::type type;
+               };
+
+               template <class T> struct extract : select_extract<T>::type {
+                       private: typedef typename select_extract<T>::type base;
+                       public: typedef typename base::result_type result_type;
+                       operator result_type() const {}
+                       extract(object const&);
+               };
+
+template <class Key, class T> class QHash {
+       public: inline QHash() {}
+       T &operator[](const Key &key);
+};
+class type_details {
+       typedef QGenericArgument(*func_python_to_cpp_type)(const object&);
+       public: 
+       template<typename T> static type_details* create_value_type_details() {
+               type_details* self = new type_details();
+               self->m_func_python_to_cpp = &python_to_value_type<T>;
+       }
+       func_python_to_cpp_type m_func_python_to_cpp;
+       template <class T> static QGenericArgument python_to_value_type(const object& obj) {
+               T* val = new T(extract<T>(obj));
+       }
+};
+class type_manager {
+       public: static type_manager& instance();
+       template<typename T> void register_value_type() {
+               m_type_map[0] = type_details::create_value_type_details<T>();
+       }
+       QHash<QString, type_details* > m_type_map;
+};
+void foo() {
+       type_manager::instance().register_value_type<ExtensionOption >();
+}