Make the use of the class name requested by the -c

command line option consistent.

This resolves issue #14.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/16/head
Slávek Banko 6 years ago
parent 20daa8eecb
commit 3dee246575
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -143,8 +143,8 @@ int main(int argc, char** argv)
if (checkForOption(options, "classname")) if (checkForOption(options, "classname"))
{ {
// class name only useful for single interfaces or just node // class name only useful for single interfaces or node
if (interfaces.count() > 1 && (generateAll || generateInterfaces || generateProxies)) if (interfaces.count() > 1 && !(generateNode || generateAll))
{ {
std::cerr << "dbusxml2qt3: class name option specified but " std::cerr << "dbusxml2qt3: class name option specified but "
<< "introspection data file '" << "introspection data file '"
@ -155,7 +155,7 @@ int main(int argc, char** argv)
} }
// class name for node is handled differently later on // class name for node is handled differently later on
if (!generateNode) if (!(generateNode || generateAll))
{ {
TQStringList nameParts = TQStringList::split("::", options["classname"]); TQStringList nameParts = TQStringList::split("::", options["classname"]);
@ -215,7 +215,10 @@ int main(int argc, char** argv)
} }
Class interfaceData = *it; Class interfaceData = *it;
interfaceData.name += "Interface"; if(!checkForOption(options, "classname") || generateNode || generateAll)
{
interfaceData.name += "Interface";
}
ClassGenerator::generateInterface(interfaceData, headerStream, sourceStream); ClassGenerator::generateInterface(interfaceData, headerStream, sourceStream);
if (baseName.isEmpty()) if (baseName.isEmpty())
@ -264,7 +267,10 @@ int main(int argc, char** argv)
} }
Class proxyData = *it; Class proxyData = *it;
proxyData.name += "Proxy"; if(!checkForOption(options, "classname") || generateNode || generateAll)
{
proxyData.name += "Proxy";
}
ClassGenerator::generateProxy(proxyData, headerStream, sourceStream); ClassGenerator::generateProxy(proxyData, headerStream, sourceStream);
if (baseName.isEmpty()) if (baseName.isEmpty())
@ -287,10 +293,9 @@ int main(int argc, char** argv)
{ {
tqDebug("Generating org.freedesktop.DBus.Introspectable on demand"); tqDebug("Generating org.freedesktop.DBus.Introspectable on demand");
TQString baseClassName = "Introspectable";
TQString streamName = baseClassName.lower() + "Interface";
Class classData; Class classData;
classData.name = baseClassName + "Interface"; TQString streamName = "introspectableInterface";
classData.name = "IntrospectableInterface";
classData.dbusName = "org.freedesktop.DBus.Introspectable"; classData.dbusName = "org.freedesktop.DBus.Introspectable";
classData.namespaces << "org" << "freedesktop" << "DBus"; classData.namespaces << "org" << "freedesktop" << "DBus";
@ -368,6 +373,9 @@ int main(int argc, char** argv)
TQString baseName = options["node"]; TQString baseName = options["node"];
if (baseName.isEmpty()) { if (baseName.isEmpty()) {
baseName = classData.name.lower() + "Node"; baseName = classData.name.lower() + "Node";
}
if (!checkForOption(options, "classname"))
{
classData.name += "Node"; classData.name += "Node";
} }

Loading…
Cancel
Save