|
|
@ -350,84 +350,85 @@ int main(int argc, char** argv)
|
|
|
|
if (nodeClassName.isEmpty())
|
|
|
|
if (nodeClassName.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nodeClassName = rootElement.attribute("name");
|
|
|
|
nodeClassName = rootElement.attribute("name");
|
|
|
|
if (nodeClassName.startsWith("/")) nodeClassName = nodeClassName.mid(1);
|
|
|
|
if (nodeClassName.startsWith("/"))
|
|
|
|
if (nodeClassName.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::cerr << "dbusxml2qt3: cannot generate node without class name."
|
|
|
|
nodeClassName = nodeClassName.mid(1);
|
|
|
|
<< std::endl;
|
|
|
|
|
|
|
|
exit(3);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!nodeClassName.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
nodeClassName.replace('/', "::");
|
|
|
|
nodeClassName.replace('/', "::");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList nameParts = TQStringList::split("::", nodeClassName);
|
|
|
|
TQStringList nameParts = TQStringList::split("::", nodeClassName);
|
|
|
|
|
|
|
|
|
|
|
|
Class classData;
|
|
|
|
Class classData;
|
|
|
|
classData.name = nameParts.back();
|
|
|
|
classData.name = nameParts.back();
|
|
|
|
|
|
|
|
|
|
|
|
nameParts.pop_back();
|
|
|
|
nameParts.pop_back();
|
|
|
|
classData.namespaces = nameParts;
|
|
|
|
classData.namespaces = nameParts;
|
|
|
|
|
|
|
|
|
|
|
|
if (checkForOption(options, "namespace"))
|
|
|
|
if (checkForOption(options, "namespace"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nameParts = TQStringList::split("::", options["namespace"]);
|
|
|
|
nameParts = TQStringList::split("::", options["namespace"]);
|
|
|
|
|
|
|
|
|
|
|
|
classData.namespaces = nameParts;
|
|
|
|
classData.namespaces = nameParts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQTextStream headerStream;
|
|
|
|
TQTextStream headerStream;
|
|
|
|
TQTextStream sourceStream;
|
|
|
|
TQTextStream sourceStream;
|
|
|
|
|
|
|
|
|
|
|
|
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"))
|
|
|
|
}
|
|
|
|
{
|
|
|
|
if (!checkForOption(options, "classname"))
|
|
|
|
classData.name += "Node";
|
|
|
|
{
|
|
|
|
}
|
|
|
|
classData.name += "Node";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream))
|
|
|
|
if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::cerr << "dbusxml2qt3: interface files, using base name '"
|
|
|
|
std::cerr << "dbusxml2qt3: interface files, using base name '"
|
|
|
|
<< baseName.local8Bit().data()
|
|
|
|
<< baseName.local8Bit().data()
|
|
|
|
<< "', could not be opened for writing"
|
|
|
|
<< "', could not be opened for writing" << std::endl;
|
|
|
|
<< std::endl;
|
|
|
|
exit(4);
|
|
|
|
exit(4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClassGenerator::generateNode(classData, interfaces, customInterfaceFilename,
|
|
|
|
ClassGenerator::generateNode(classData, interfaces, customInterfaceFilename,
|
|
|
|
headerStream, sourceStream);
|
|
|
|
headerStream, sourceStream);
|
|
|
|
|
|
|
|
|
|
|
|
ClassGenerator::finishStreams(baseName, headerStream, sourceStream);
|
|
|
|
ClassGenerator::finishStreams(baseName, headerStream, sourceStream);
|
|
|
|
|
|
|
|
|
|
|
|
// create dummy node to handle the path hierarchy
|
|
|
|
// create dummy node to handle the path hierarchy
|
|
|
|
if ( nameParts.size() > 1 ) {
|
|
|
|
if (nameParts.size() > 1)
|
|
|
|
TQTextStream headerStreamDBusBaseNode;
|
|
|
|
{
|
|
|
|
TQTextStream sourceStreamDBusBaseNode;
|
|
|
|
TQTextStream headerStreamDBusBaseNode;
|
|
|
|
|
|
|
|
TQTextStream sourceStreamDBusBaseNode;
|
|
|
|
|
|
|
|
|
|
|
|
TQString baseName = "DBusBase";
|
|
|
|
TQString baseName = "DBusBase";
|
|
|
|
Class classDataDBusBaseNode;
|
|
|
|
Class classDataDBusBaseNode;
|
|
|
|
classDataDBusBaseNode.name = baseName + "Node";
|
|
|
|
classDataDBusBaseNode.name = baseName + "Node";
|
|
|
|
TQValueList<Class> interfacesDBusBase = TQValueList<Class>();
|
|
|
|
TQValueList<Class> interfacesDBusBase = TQValueList<Class>();
|
|
|
|
|
|
|
|
|
|
|
|
TQString baseNameDBusBaseNode = baseName.lower() + "Node";
|
|
|
|
TQString baseNameDBusBaseNode = baseName.lower() + "Node";
|
|
|
|
|
|
|
|
|
|
|
|
if (!ClassGenerator::initStreams(baseNameDBusBaseNode, headerStreamDBusBaseNode, sourceStreamDBusBaseNode))
|
|
|
|
if (!ClassGenerator::initStreams(baseNameDBusBaseNode, headerStreamDBusBaseNode, sourceStreamDBusBaseNode))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::cerr << "dbusxml2qt3: interface files, using base name '"
|
|
|
|
std::cerr << "dbusxml2qt3: interface files, using base name '"
|
|
|
|
<< baseNameDBusBaseNode.local8Bit().data()
|
|
|
|
<< baseNameDBusBaseNode.local8Bit().data()
|
|
|
|
<< "', could not be opened for writing"
|
|
|
|
<< "', could not be opened for writing"
|
|
|
|
<< std::endl;
|
|
|
|
<< std::endl;
|
|
|
|
exit(4);
|
|
|
|
exit(4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ClassGenerator::generateNode(classDataDBusBaseNode,
|
|
|
|
ClassGenerator::generateNode(classDataDBusBaseNode,
|
|
|
|
interfacesDBusBase, baseNameDBusBaseNode,
|
|
|
|
interfacesDBusBase, baseNameDBusBaseNode,
|
|
|
|
headerStreamDBusBaseNode, sourceStreamDBusBaseNode);
|
|
|
|
headerStreamDBusBaseNode, sourceStreamDBusBaseNode);
|
|
|
|
|
|
|
|
|
|
|
|
ClassGenerator::finishStreams(baseNameDBusBaseNode, headerStreamDBusBaseNode, sourceStreamDBusBaseNode);
|
|
|
|
ClassGenerator::finishStreams(baseNameDBusBaseNode, headerStreamDBusBaseNode, sourceStreamDBusBaseNode);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|