[pygccxml-commit] SF.net SVN: pygccxml: [543] pyplusplus_dev/pyplusplus
                
                Brought to you by:
                
                    mbaas,
                    
                
                    roman_yakovenko
                    
                
            
            
        
        
        
    | 
      
      
      From: <rom...@us...> - 2006-09-14 12:03:04
      
     | 
| Revision: 543
          http://svn.sourceforge.net/pygccxml/?rev=543&view=rev
Author:   roman_yakovenko
Date:     2006-09-14 05:02:53 -0700 (Thu, 14 Sep 2006)
Log Message:
-----------
moving guess_mem_fun_creator_classes from code_creators to module_creator
package
Modified Paths:
--------------
    pyplusplus_dev/pyplusplus/code_creators/__init__.py
    pyplusplus_dev/pyplusplus/module_creator/creator.py
Added Paths:
-----------
    pyplusplus_dev/pyplusplus/module_creator/creators_wizard.py
Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/__init__.py	2006-09-14 06:19:18 UTC (rev 542)
+++ pyplusplus_dev/pyplusplus/code_creators/__init__.py	2006-09-14 12:02:53 UTC (rev 543)
@@ -118,54 +118,3 @@
 
 from exception_translator import exception_translator_t
 from exception_translator import exception_translator_register_t
-
-from pygccxml import declarations
-
-ACCESS_TYPES = declarations.ACCESS_TYPES
-VIRTUALITY_TYPES = declarations.VIRTUALITY_TYPES
-
-
-def guess_mem_fun_creator_classes( decl ):
-    """return tuple of ( registration, declaration ) code creator classes"""
-    maker_cls = None
-    fwrapper_cls = None
-    access_level = decl.parent.find_out_member_access_type( decl )
-    if access_level == ACCESS_TYPES.PUBLIC:
-        if decl.virtuality == VIRTUALITY_TYPES.NOT_VIRTUAL:
-            maker_cls = mem_fun_t
-        elif decl.virtuality == VIRTUALITY_TYPES.PURE_VIRTUAL:
-            fwrapper_cls = mem_fun_pv_wrapper_t
-            maker_cls = mem_fun_pv_t
-        else:
-            if decl.function_transformers:
-                fwrapper_cls = mem_fun_v_transformed_wrapper_t
-                maker_cls = mem_fun_v_transformed_t
-            else:
-                if decl.overridable:
-                    fwrapper_cls = mem_fun_v_wrapper_t
-                maker_cls = mem_fun_v_t
-    elif access_level == ACCESS_TYPES.PROTECTED:
-        if decl.virtuality == VIRTUALITY_TYPES.NOT_VIRTUAL:
-            if decl.has_static:
-                fwrapper_cls = mem_fun_protected_s_wrapper_t
-                maker_cls = mem_fun_protected_s_t
-            else:
-                fwrapper_cls = mem_fun_protected_wrapper_t
-                maker_cls = mem_fun_protected_t
-        elif decl.virtuality == VIRTUALITY_TYPES.VIRTUAL:
-            if decl.overridable:
-                fwrapper_cls = mem_fun_protected_v_wrapper_t
-                maker_cls = mem_fun_protected_v_t
-        else:
-            fwrapper_cls = mem_fun_protected_pv_wrapper_t
-            maker_cls = mem_fun_protected_pv_t
-    else: #private
-        if decl.virtuality == VIRTUALITY_TYPES.NOT_VIRTUAL:
-            pass#in general we should not come here
-        elif decl.virtuality == VIRTUALITY_TYPES.PURE_VIRTUAL:
-            fwrapper_cls = mem_fun_private_pv_wrapper_t
-        else:
-            if decl.overridable:
-                fwrapper_cls = mem_fun_v_wrapper_t
-                maker_cls = mem_fun_v_t
-    return ( maker_cls, fwrapper_cls )
Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creator.py	2006-09-14 06:19:18 UTC (rev 542)
+++ pyplusplus_dev/pyplusplus/module_creator/creator.py	2006-09-14 12:02:53 UTC (rev 543)
@@ -4,6 +4,7 @@
 # http://www.boost.org/LICENSE_1_0.txt)
 
 import types_database
+import creators_wizard
 import class_organizer
 import call_policies_resolver
 from pygccxml import declarations
@@ -566,7 +567,7 @@
         if None is self.curr_decl.call_policies:
             self.curr_decl.call_policies = self.__call_policies_resolver( self.curr_decl )
 
-        maker_cls, fwrapper_cls = code_creators.guess_mem_fun_creator_classes( self.curr_decl )
+        maker_cls, fwrapper_cls = creators_wizard.find_out_mem_fun_creator_classes( self.curr_decl )
 
         maker = None
         fwrapper = None
Added: pyplusplus_dev/pyplusplus/module_creator/creators_wizard.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creators_wizard.py	                        (rev 0)
+++ pyplusplus_dev/pyplusplus/module_creator/creators_wizard.py	2006-09-14 12:02:53 UTC (rev 543)
@@ -0,0 +1,61 @@
+# Copyright 2004 Roman Yakovenko.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+"""this module defines few function that will guess what creator(s) should be
+created for exposing a declaration
+"""
+
+from pygccxml import declarations
+from pyplusplus import code_creators
+
+
+ACCESS_TYPES = declarations.ACCESS_TYPES
+VIRTUALITY_TYPES = declarations.VIRTUALITY_TYPES
+
+
+def find_out_mem_fun_creator_classes( decl ):
+    """return tuple of ( registration, declaration ) code creator classes"""
+    maker_cls = None
+    fwrapper_cls = None
+    access_level = decl.parent.find_out_member_access_type( decl )
+    if access_level == ACCESS_TYPES.PUBLIC:
+        if decl.virtuality == VIRTUALITY_TYPES.NOT_VIRTUAL:
+            maker_cls = code_creators.mem_fun_t
+        elif decl.virtuality == VIRTUALITY_TYPES.PURE_VIRTUAL:
+            fwrapper_cls = code_creators.mem_fun_pv_wrapper_t
+            maker_cls = code_creators.mem_fun_pv_t
+        else:
+            if decl.function_transformers:
+                fwrapper_cls = code_creators.mem_fun_v_transformed_wrapper_t
+                maker_cls = code_creators.mem_fun_v_transformed_t
+            else:
+                if decl.overridable:
+                    fwrapper_cls = code_creators.mem_fun_v_wrapper_t
+                maker_cls = code_creators.mem_fun_v_t
+    elif access_level == ACCESS_TYPES.PROTECTED:
+        if decl.virtuality == VIRTUALITY_TYPES.NOT_VIRTUAL:
+            if decl.has_static:
+                fwrapper_cls = code_creators.mem_fun_protected_s_wrapper_t
+                maker_cls = code_creators.mem_fun_protected_s_t
+            else:
+                fwrapper_cls = code_creators.mem_fun_protected_wrapper_t
+                maker_cls = code_creators.mem_fun_protected_t
+        elif decl.virtuality == VIRTUALITY_TYPES.VIRTUAL:
+            if decl.overridable:
+                fwrapper_cls = code_creators.mem_fun_protected_v_wrapper_t
+                maker_cls = code_creators.mem_fun_protected_v_t
+        else:
+            fwrapper_cls = code_creators.mem_fun_protected_pv_wrapper_t
+            maker_cls = code_creators.mem_fun_protected_pv_t
+    else: #private
+        if decl.virtuality == VIRTUALITY_TYPES.NOT_VIRTUAL:
+            pass#in general we should not come here
+        elif decl.virtuality == VIRTUALITY_TYPES.PURE_VIRTUAL:
+            fwrapper_cls = code_creators.mem_fun_private_pv_wrapper_t
+        else:
+            if decl.overridable:
+                fwrapper_cls = code_creators.mem_fun_v_wrapper_t
+                maker_cls = code_creators.mem_fun_v_t
+    return ( maker_cls, fwrapper_cls )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |