|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|