summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanoil Kotsev <deloptes@gmail.com>2020-05-28 22:02:23 +0200
committerTDE Gitea <gitea@mirror.git.trinitydesktop.org>2020-05-29 05:14:30 +0000
commitaaca9aafc865dca5c55b086aafad4168b40493d4 (patch)
tree57f5f5bef4554618e3026d54dacb00841f672126
parent593d22f77117aa3952c64e8d0a305d7b250a57c5 (diff)
downloaddbus-1-tqt-aaca9aafc865dca5c55b086aafad4168b40493d4.tar.gz
dbus-1-tqt-aaca9aafc865dca5c55b086aafad4168b40493d4.zip
Fix #25 dbusxml2qt3 root node with no name
Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
-rw-r--r--src/tools/dbusxml2qt3/main.cpp115
1 files changed, 58 insertions, 57 deletions
diff --git a/src/tools/dbusxml2qt3/main.cpp b/src/tools/dbusxml2qt3/main.cpp
index 018bc5d..7aa5b3f 100644
--- a/src/tools/dbusxml2qt3/main.cpp
+++ b/src/tools/dbusxml2qt3/main.cpp
@@ -350,84 +350,85 @@ int main(int argc, char** argv)
if (nodeClassName.isEmpty())
{
nodeClassName = rootElement.attribute("name");
- if (nodeClassName.startsWith("/")) nodeClassName = nodeClassName.mid(1);
- if (nodeClassName.isEmpty())
+ if (nodeClassName.startsWith("/"))
{
- std::cerr << "dbusxml2qt3: cannot generate node without class name."
- << std::endl;
- exit(3);
+ nodeClassName = nodeClassName.mid(1);
}
+ }
+ if (!nodeClassName.isEmpty())
+ {
nodeClassName.replace('/', "::");
- }
- TQStringList nameParts = TQStringList::split("::", nodeClassName);
+ TQStringList nameParts = TQStringList::split("::", nodeClassName);
- Class classData;
- classData.name = nameParts.back();
+ Class classData;
+ classData.name = nameParts.back();
- nameParts.pop_back();
- classData.namespaces = nameParts;
+ nameParts.pop_back();
+ classData.namespaces = nameParts;
- if (checkForOption(options, "namespace"))
- {
- nameParts = TQStringList::split("::", options["namespace"]);
+ if (checkForOption(options, "namespace"))
+ {
+ nameParts = TQStringList::split("::", options["namespace"]);
- classData.namespaces = nameParts;
- }
+ classData.namespaces = nameParts;
+ }
- TQTextStream headerStream;
- TQTextStream sourceStream;
+ TQTextStream headerStream;
+ TQTextStream sourceStream;
- TQString baseName = options["node"];
- if (baseName.isEmpty()) {
- baseName = classData.name.lower() + "Node";
- }
- if (!checkForOption(options, "classname"))
- {
- classData.name += "Node";
- }
+ TQString baseName = options["node"];
+ if (baseName.isEmpty())
+ {
+ baseName = classData.name.lower() + "Node";
+ }
+ if (!checkForOption(options, "classname"))
+ {
+ classData.name += "Node";
+ }
- if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream))
- {
- std::cerr << "dbusxml2qt3: interface files, using base name '"
- << baseName.local8Bit().data()
- << "', could not be opened for writing"
- << std::endl;
- exit(4);
- }
+ if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream))
+ {
+ std::cerr << "dbusxml2qt3: interface files, using base name '"
+ << baseName.local8Bit().data()
+ << "', could not be opened for writing" << std::endl;
+ exit(4);
+ }
- ClassGenerator::generateNode(classData, interfaces, customInterfaceFilename,
+ ClassGenerator::generateNode(classData, interfaces, customInterfaceFilename,
headerStream, sourceStream);
- ClassGenerator::finishStreams(baseName, headerStream, sourceStream);
+ ClassGenerator::finishStreams(baseName, headerStream, sourceStream);
- // create dummy node to handle the path hierarchy
- if ( nameParts.size() > 1 ) {
- TQTextStream headerStreamDBusBaseNode;
- TQTextStream sourceStreamDBusBaseNode;
+ // create dummy node to handle the path hierarchy
+ if (nameParts.size() > 1)
+ {
+ TQTextStream headerStreamDBusBaseNode;
+ TQTextStream sourceStreamDBusBaseNode;
- TQString baseName = "DBusBase";
- Class classDataDBusBaseNode;
- classDataDBusBaseNode.name = baseName + "Node";
- TQValueList<Class> interfacesDBusBase = TQValueList<Class>();
+ TQString baseName = "DBusBase";
+ Class classDataDBusBaseNode;
+ classDataDBusBaseNode.name = baseName + "Node";
+ TQValueList<Class> interfacesDBusBase = TQValueList<Class>();
- TQString baseNameDBusBaseNode = baseName.lower() + "Node";
+ TQString baseNameDBusBaseNode = baseName.lower() + "Node";
- if (!ClassGenerator::initStreams(baseNameDBusBaseNode, headerStreamDBusBaseNode, sourceStreamDBusBaseNode))
- {
- std::cerr << "dbusxml2qt3: interface files, using base name '"
- << baseNameDBusBaseNode.local8Bit().data()
- << "', could not be opened for writing"
- << std::endl;
- exit(4);
- }
+ if (!ClassGenerator::initStreams(baseNameDBusBaseNode, headerStreamDBusBaseNode, sourceStreamDBusBaseNode))
+ {
+ std::cerr << "dbusxml2qt3: interface files, using base name '"
+ << baseNameDBusBaseNode.local8Bit().data()
+ << "', could not be opened for writing"
+ << std::endl;
+ exit(4);
+ }
- ClassGenerator::generateNode(classDataDBusBaseNode,
- interfacesDBusBase, baseNameDBusBaseNode,
- headerStreamDBusBaseNode, sourceStreamDBusBaseNode);
+ ClassGenerator::generateNode(classDataDBusBaseNode,
+ interfacesDBusBase, baseNameDBusBaseNode,
+ headerStreamDBusBaseNode, sourceStreamDBusBaseNode);
- ClassGenerator::finishStreams(baseNameDBusBaseNode, headerStreamDBusBaseNode, sourceStreamDBusBaseNode);
+ ClassGenerator::finishStreams(baseNameDBusBaseNode, headerStreamDBusBaseNode, sourceStreamDBusBaseNode);
+ }
}
}