]> git.saurik.com Git - wxWidgets.git/blame - docs/doxygen/scripts/c_tools.py
Resolve ambiguity between GetClientXXX() methods in wxOSX wxComboBox.
[wxWidgets.git] / docs / doxygen / scripts / c_tools.py
CommitLineData
1013a789
KO
1"""\r
2C bindings generator\r
3Author: Luke A. Guest\r
4"""\r
5\r
6import os\r
7\r
8from common import *\r
9\r
10class CBuilder:\r
11 def __init__(self, doxyparse, outputdir):\r
12 self.doxyparser = doxyparse\r
13 self.output_dir = outputdir\r
14\r
15 def make_bindings(self):\r
16 output_dir = os.path.abspath(os.path.join(self.output_dir, "c"))\r
17 if not os.path.exists(output_dir):\r
18 os.makedirs(output_dir)\r
19 \r
20 for aclass in self.doxyparser.classes:\r
21 # This bit doesn't work, because the aclass.name is not the same as\r
22 # those listed in common\r
23 if aclass.name in excluded_classes:\r
24 #print "Skipping %s" % aclass.name\r
25 continue\r
26 \r
27 self.make_c_header(output_dir, aclass)\r
28\r
29\r
30 def make_c_header(self, output_dir, aclass):\r
31 filename = os.path.join(output_dir, aclass.name[2:].lower() + ".hh")\r
32 enums_text = make_enums(aclass)\r
33 method_text = self.make_c_methods(aclass)\r
34 class_name = aclass.name[2:].capitalize()\r
35 text = """\r
36// Enums\r
37%s\r
38\r
39%s\r
40""" % (enums_text, method_text)\r
41\r
42 afile = open(filename, "wb")\r
43 afile.write(text)\r
44 afile.close()\r
45\r
46\r
47 def make_c_methods(self, aclass):\r
48 retval = ""\r
49 \r
50 wxc_classname = 'wxC' + aclass.name[2:].capitalize()\r
51\r
52 for amethod in aclass.constructors:\r
1013a789
KO
53 retval += """\r
54// %s\r
55%s%s;\n\n\r
56""" % (amethod.brief_description, wxc_classname + '* ' + wxc_classname + '_' + amethod.name, amethod.argsstring)\r
57\r
58 for amethod in aclass.methods:\r
6a1df262
KO
59 if amethod.name.startswith('m_'):\r
60 # for some reason, public members are listed as methods\r
61 continue\r
62 \r
1013a789
KO
63 args = '(' + wxc_classname + '* obj'\r
64 if amethod.argsstring.find('()') != -1:\r
65 args += ')'\r
66 else: \r
67 args += ', ' + amethod.argsstring[1:].strip()\r
68 \r
69 retval += """\r
70// %s\r
71%s %s%s;\n\r
72""" % (amethod.detailed_description, amethod.return_type, wxc_classname + '_' + amethod.name, args)\r
73\r
74 return retval\r