|
|
|
@ -147,93 +147,91 @@ static bool parseDBusSignature(const TQString& signature, Argument& argument)
|
|
|
|
|
if (from == -1 || to == -1 || (to - from - 1) < 2) return false;
|
|
|
|
|
|
|
|
|
|
TQString dictSignature = signature.mid(from + 1, (to - from - 1));
|
|
|
|
|
if (dictSignature.startsWith("oa")) {
|
|
|
|
|
argument.signature = "TQT_DBusData";
|
|
|
|
|
argument.accessor = "ObjectPathKeyMap";
|
|
|
|
|
argument.subAccessor = "StringKeyMapMap";
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append("class TQT_DBusData");
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
|
|
|
|
|
Argument key;
|
|
|
|
|
if (!parseDBusSignature(dictSignature.left(1), key)) return false;
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
argument.containerClass = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.signature = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.accessor = key.accessor + "KeyMap";
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append( "template <typename K> class TQT_DBusDataMap");
|
|
|
|
|
argument.forwardDeclarations += key.forwardDeclarations;
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes = key.sourceIncludes;
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>");
|
|
|
|
|
} else {
|
|
|
|
|
Argument key;
|
|
|
|
|
if (!parseDBusSignature(dictSignature.left(1), key)) return false;
|
|
|
|
|
|
|
|
|
|
Argument value;
|
|
|
|
|
if (parseDBusSignature(dictSignature.mid(1), value))
|
|
|
|
|
{
|
|
|
|
|
if (!value.subAccessor.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
argument.containerClass = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.signature = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.accessor = key.accessor + "KeyMap";
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append("template <typename K> class TQT_DBusDataMap");
|
|
|
|
|
argument.forwardDeclarations += key.forwardDeclarations;
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes = key.sourceIncludes;
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
argument.containerClass = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.signature = "TQMap< " + key.signature +
|
|
|
|
|
", " + value.signature + " >";
|
|
|
|
|
argument.accessor = key.accessor + "KeyMap";
|
|
|
|
|
argument.subAccessor = value.accessor + "Map";
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append("template <typename K, typename V> class TQMap");
|
|
|
|
|
argument.forwardDeclarations += key.forwardDeclarations;
|
|
|
|
|
argument.forwardDeclarations += value.forwardDeclarations;
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes = key.sourceIncludes;
|
|
|
|
|
argument.sourceIncludes["TQt"].append("<tqmap.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>");
|
|
|
|
|
|
|
|
|
|
TQMap<TQString, TQStringList>::const_iterator it =
|
|
|
|
|
value.sourceIncludes.begin();
|
|
|
|
|
TQMap<TQString, TQStringList>::const_iterator endIt =
|
|
|
|
|
value.sourceIncludes.end();
|
|
|
|
|
for (; it != endIt; ++it)
|
|
|
|
|
{
|
|
|
|
|
argument.sourceIncludes[it.key()] += it.data();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
argument.containerClass = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.signature = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.accessor = key.accessor + "KeyMap";
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append("template <typename K> class TQT_DBusDataMap");
|
|
|
|
|
argument.forwardDeclarations += key.forwardDeclarations;
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes = key.sourceIncludes;
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (dictSignature.startsWith("oa")) {
|
|
|
|
|
argument.signature = "TQT_DBusData";
|
|
|
|
|
argument.accessor = "ObjectPathKeyMap";
|
|
|
|
|
argument.subAccessor = "StringKeyMapMap";
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append("class TQT_DBusData");
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
|
|
|
|
|
Argument key;
|
|
|
|
|
if (!parseDBusSignature(dictSignature.left(1), key)) return false;
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
argument.containerClass = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.signature = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.accessor = key.accessor + "KeyMap";
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append( "template <typename K> class TQT_DBusDataMap");
|
|
|
|
|
argument.forwardDeclarations += key.forwardDeclarations;
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes = key.sourceIncludes;
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Argument key;
|
|
|
|
|
if (!parseDBusSignature(dictSignature.left(1), key)) return false;
|
|
|
|
|
|
|
|
|
|
Argument value;
|
|
|
|
|
if (parseDBusSignature(dictSignature.mid(1), value))
|
|
|
|
|
{
|
|
|
|
|
if (!value.subAccessor.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
argument.containerClass = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.signature = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.accessor = key.accessor + "KeyMap";
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append("template <typename K> class TQT_DBusDataMap");
|
|
|
|
|
argument.forwardDeclarations += key.forwardDeclarations;
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes = key.sourceIncludes;
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>");
|
|
|
|
|
} else {
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
argument.containerClass = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.signature = "TQMap< " + key.signature +
|
|
|
|
|
", " + value.signature + " >";
|
|
|
|
|
argument.accessor = key.accessor + "KeyMap";
|
|
|
|
|
argument.subAccessor = value.accessor + "Map";
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append("template <typename K, typename V> class TQMap");
|
|
|
|
|
argument.forwardDeclarations += key.forwardDeclarations;
|
|
|
|
|
argument.forwardDeclarations += value.forwardDeclarations;
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes = key.sourceIncludes;
|
|
|
|
|
argument.sourceIncludes["TQt"].append("<tqmap.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>");
|
|
|
|
|
|
|
|
|
|
TQMap<TQString, TQStringList>::const_iterator it =
|
|
|
|
|
value.sourceIncludes.begin();
|
|
|
|
|
TQMap<TQString, TQStringList>::const_iterator endIt =
|
|
|
|
|
value.sourceIncludes.end();
|
|
|
|
|
for (; it != endIt; ++it)
|
|
|
|
|
{
|
|
|
|
|
argument.sourceIncludes[it.key()] += it.data();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
argument.isPrimitive = false;
|
|
|
|
|
argument.containerClass = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.signature = "TQT_DBusDataMap< " + key.signature + " >";
|
|
|
|
|
argument.accessor = key.accessor + "KeyMap";
|
|
|
|
|
|
|
|
|
|
argument.forwardDeclarations.append("template <typename K> class TQT_DBusDataMap");
|
|
|
|
|
argument.forwardDeclarations += key.forwardDeclarations;
|
|
|
|
|
|
|
|
|
|
argument.sourceIncludes = key.sourceIncludes;
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdata.h>");
|
|
|
|
|
argument.sourceIncludes["tqdbus"].append("<tqdbusdatamap.h>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -555,6 +553,56 @@ static void writeNodeInitialization(const Class& classData,
|
|
|
|
|
stream << " return true;" << endl;
|
|
|
|
|
stream << "}" << endl;
|
|
|
|
|
stream << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stream << "bool " << classData.name
|
|
|
|
|
<< "::registerObject(const TQT_DBusConnection& connection, "
|
|
|
|
|
<< "const TQString& path, const TQString& next)" << endl;
|
|
|
|
|
stream << "{" << endl;
|
|
|
|
|
stream << " if (path.isEmpty()) return false;" << endl;
|
|
|
|
|
stream << endl;
|
|
|
|
|
|
|
|
|
|
stream << " if (!m_private->objectPath.isEmpty()) unregisterObject();"
|
|
|
|
|
<< endl;
|
|
|
|
|
stream << endl;
|
|
|
|
|
|
|
|
|
|
stream << " m_private->connection = connection;" << endl;
|
|
|
|
|
stream << " m_private->objectPath = path;" << endl;
|
|
|
|
|
stream << " m_private->nextNode = next;" << endl;
|
|
|
|
|
stream << endl;
|
|
|
|
|
stream << " if (!m_private->connection.registerObject(path, this))" << endl;
|
|
|
|
|
stream << " {" << endl;
|
|
|
|
|
stream << " m_private->connection = TQT_DBusConnection();" << endl;
|
|
|
|
|
stream << " m_private->objectPath = TQString();" << endl;
|
|
|
|
|
stream << " m_private->nextNode = TQString();" << endl;
|
|
|
|
|
stream << endl;
|
|
|
|
|
stream << " return false;" << endl;
|
|
|
|
|
stream << " }" << endl;
|
|
|
|
|
stream << endl;
|
|
|
|
|
|
|
|
|
|
stream << " if (m_private->interfaces.isEmpty())" << endl;
|
|
|
|
|
stream << " {" << endl;
|
|
|
|
|
stream << " TQString name = \"org.freedesktop.DBus.Introspectable\";"
|
|
|
|
|
<< endl;
|
|
|
|
|
stream << " TQT_DBusObjectBase* interface = m_private;" << endl;
|
|
|
|
|
stream << " m_private->interfaces.insert(name, interface);" << endl;
|
|
|
|
|
|
|
|
|
|
it = interfaces.begin();
|
|
|
|
|
endIt = interfaces.end();
|
|
|
|
|
for (; it != endIt; ++it)
|
|
|
|
|
{
|
|
|
|
|
stream << endl;
|
|
|
|
|
stream << " name = \"" << (*it).dbusName << "\";" << endl;
|
|
|
|
|
stream << " interface = createInterface(name);" << endl;
|
|
|
|
|
stream << " Q_ASSERT(interface != 0);" << endl;
|
|
|
|
|
stream << " m_private->interfaces.insert(name, interface);" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stream << " }" << endl;
|
|
|
|
|
stream << endl;
|
|
|
|
|
stream << " return true;" << endl;
|
|
|
|
|
stream << "}" << endl;
|
|
|
|
|
stream << endl;
|
|
|
|
|
}
|
|
|
|
|
static void writeNodeIntrospection(const Class& classData,
|
|
|
|
|
const TQValueList<Class>& interfaces, TQTextStream& stream)
|
|
|
|
@ -589,6 +637,13 @@ static void writeNodeIntrospection(const Class& classData,
|
|
|
|
|
stream << " nodeElement.appendChild(interfaceElement);" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stream << endl;
|
|
|
|
|
stream << " if (!nextNode.isEmpty()) {" << endl;
|
|
|
|
|
stream << " TQDomElement nodeElement1 = doc.createElement(\"node\");" << endl;
|
|
|
|
|
stream << " nodeElement1.setAttribute ( \"name\", nextNode );" << endl;
|
|
|
|
|
stream << " nodeElement.appendChild(nodeElement1);" << endl;
|
|
|
|
|
stream << " }" << endl;
|
|
|
|
|
|
|
|
|
|
stream << endl;
|
|
|
|
|
stream << " doc.appendChild(nodeElement);" << endl;
|
|
|
|
|
stream << endl;
|
|
|
|
@ -1726,6 +1781,7 @@ void MethodGenerator::writeNodePrivate(const Class& classData, TQTextStream& str
|
|
|
|
|
stream << endl;
|
|
|
|
|
stream << " TQT_DBusConnection connection;" << endl;
|
|
|
|
|
stream << " TQString objectPath;" << endl;
|
|
|
|
|
stream << " TQString nextNode;" << endl;
|
|
|
|
|
stream << endl;
|
|
|
|
|
|
|
|
|
|
stream << "protected:" << endl;
|
|
|
|
|