# License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import autogenutils as au infilename, outbasename = au.parseJSONCommandLine() json_def = au.parseJSONFile(infilename) ################################################################################ # generate header file hf = open(outbasename + ".h", "w") au.autogenWarning(hf, infilename) au.beginIncludeGuard(hf, outbasename + ".h") # includes, forward declarations hf.write("#include <QtCore/QMetaType>\n") hf.write("class QDBusArgument;\n") hf.write("#include <QtDBus/QDBusObjectPath>\n") # begin namespace hf.write("namespace QsdPrivate {\n")
# modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import autogenutils as au infilename, outbasename = au.parseJSONCommandLine() json_def = au.parseJSONFile(infilename)["objects"] def readEnumDef(enum): # mandatory values: namespace, typename, values ns, tn, vals = enum["namespace"], enum["enumeration"], enum["values"] # optional values strs = enum.get("strings", []) inv = enum.get("hasInvalidValue", False) # only use strings if their number matches the values if len(strs) != len(vals): strs = None return ns, tn, vals, strs, inv ################################################################################ # write header file