]>
git.saurik.com Git - wxWidgets.git/blob - docs/doxygen/scripts/sip_tools.py
   6     def __init__(self
, doxyparse
, outputdir
): 
   7         self
.doxyparser 
= doxyparse
 
   8         self
.output_dir 
= outputdir
 
  10     def make_bindings(self
): 
  11         output_dir 
= os
.path
.abspath(os
.path
.join(self
.output_dir
, "sip")) 
  12         if not os
.path
.exists(output_dir
): 
  13             os
.makedirs(output_dir
) 
  15         for aclass 
in self
.doxyparser
.classes
: 
  16             if aclass
.name 
in excluded_classes
: 
  17                 print "Skipping %s" % aclass
.name
 
  20             header_name 
= aclass
.name
[2:].lower() 
  21             filename 
= os
.path
.join(output_dir
, "_" + header_name 
+ ".sip") 
  22             enums_text 
= make_enums(aclass
) 
  23             method_text 
= self
.make_sip_methods(aclass
) 
  24             base_class 
= get_first_value(aclass
.bases
) 
  26                 base_class 
= ": %s" % base_class
 
  39 """ % (enums_text
, aclass
.name
, base_class
, get_first_value(aclass
.includes
), method_text
) 
  41             afile 
= open(filename
, "wb") 
  46     def make_sip_methods(self
, aclass
): 
  49         for amethod 
in aclass
.constructors 
+ aclass
.methods
: 
  52             # FIXME: we need to come up with a way of filtering the methods out by various criteria 
  53             # including parameters and method name, and how to deal with overloads  
  54             if aclass
.name 
in ignored_methods
: 
  56                 for method 
in ignored_methods
[aclass
.name
]: 
  57                     print "method = %s" % method
 
  58                     if method 
== amethod
.name
: 
  59                         params 
= ignored_methods
[aclass
.name
][method
] 
  61                         for i 
in xrange(len(params
)): 
  62                             if i 
>= len(amethod
.params
): 
  65                             elif amethod
.params
[i
]["type"] != params
[i
]: 
  66                                 print "param type = %s, amethod.param type = %s" % (params
[i
], amethod
.params
[i
]["type"]) 
  73             # We need to let SIP know when wx is responsible for deleting the object. 
  74             # We do this if the class is derived from wxWindow, since wxTLW manages child windows 
  75             # and wxApp deletes all wxTLWs on shutdown 
  76             if amethod 
in aclass
.constructors 
and self
.doxyparser
.is_derived_from_base(aclass
, "wxWindow"): 
  77                 transfer 
= "/Transfer/" 
  79             if amethod
.name
.startswith("operator"): 
  82             retval 
+= "    %s %s%s%s;\n\n" % (amethod
.return_type
.replace("virtual ", ""), amethod
.name
, amethod
.argsstring
, transfer
)