Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qdbuscpp2xml.cpp File Reference
#include <qbuffer.h>
#include <qbytearray.h>
#include <qdebug.h>
#include <qfile.h>
#include <qlist.h>
#include <qstring.h>
#include <qvarlengtharray.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <qdbusconnection.h>
#include <private/qdbusconnection_p.h>
#include <qdbusmetatype.h>
#include <private/qdbusmetatype_p.h>
#include <private/qdbusutil_p.h>
#include "moc.h"
#include "generator.h"
#include "preprocessor.h"
+ Include dependency graph for qdbuscpp2xml.cpp:

Go to the source code of this file.

Classes

class  CustomType
 [1] More...
 

Macros

#define ANNOTATION_NO_WAIT   "org.freedesktop.DBus.Method.NoReply"
 
#define QCLASSINFO_DBUS_INTERFACE   "D-Bus Interface"
 
#define QCLASSINFO_DBUS_INTROSPECTION   "D-Bus Introspection"
 
#define PROGRAMNAME   "qdbuscpp2xml"
 
#define PROGRAMVERSION   "0.2"
 
#define PROGRAMCOPYRIGHT   QT_COPYRIGHT
 

Functions

int qDBusParametersForMethod (const FunctionDef &mm, QList< QMetaType > &metaTypes, QString &errorMsg)
 
static QString typeNameToXml (const char *typeName)
 
static QString addFunction (const FunctionDef &mm, bool isSignal=false)
 
static QString generateInterfaceXml (const ClassDef *mo)
 
QString qDBusInterfaceFromClassDef (const ClassDef *mo)
 
QString qDBusGenerateClassDefXml (const ClassDef *cdef)
 
static void showHelp ()
 
static void showVersion ()
 
static void parseCmdLine (QStringList &arguments)
 
int main (int argc, char **argv)
 [0]
 

Variables

static const char docTypeHeader []
 
static QString outputFile
 
static int flags
 
static const char help []
 
static std::deque< CustomTypes_customTypes
 

Macro Definition Documentation

◆ ANNOTATION_NO_WAIT

#define ANNOTATION_NO_WAIT   "org.freedesktop.DBus.Method.NoReply"

Definition at line 26 of file qdbuscpp2xml.cpp.

◆ PROGRAMCOPYRIGHT

#define PROGRAMCOPYRIGHT   QT_COPYRIGHT

Definition at line 40 of file qdbuscpp2xml.cpp.

◆ PROGRAMNAME

#define PROGRAMNAME   "qdbuscpp2xml"

Definition at line 38 of file qdbuscpp2xml.cpp.

◆ PROGRAMVERSION

#define PROGRAMVERSION   "0.2"

Definition at line 39 of file qdbuscpp2xml.cpp.

◆ QCLASSINFO_DBUS_INTERFACE

#define QCLASSINFO_DBUS_INTERFACE   "D-Bus Interface"

Definition at line 27 of file qdbuscpp2xml.cpp.

◆ QCLASSINFO_DBUS_INTROSPECTION

#define QCLASSINFO_DBUS_INTROSPECTION   "D-Bus Introspection"

Definition at line 28 of file qdbuscpp2xml.cpp.

Function Documentation

◆ addFunction()

static QString addFunction ( const FunctionDef mm,
bool  isSignal = false 
)
static

◆ generateInterfaceXml()

◆ main()

int main ( int  argc,
char **  argv 
)

[0]

[0]

[0]

[6]

[0]

[0]

[1]

[1]

[2]

[2]

[3]

[3]

[0]

[0]

[1]

[1]

[0]

[0]

[0]

[0]

Definition at line 424 of file qdbuscpp2xml.cpp.

References QList< T >::append(), arg, args, docTypeHeader, QString::fromLocal8Bit(), QString::isEmpty(), Preprocessor::macros, moc(), output, outputFile, parseCmdLine(), Preprocessor::preprocessed(), PROGRAMNAME, qDBusGenerateClassDefXml(), qPrintable, QIODeviceBase::ReadOnly, QList< T >::reserve(), QIODeviceBase::Text, toLocal8Bit(), QIODeviceBase::WriteOnly, and xml.

+ Here is the call graph for this function:

◆ parseCmdLine()

static void parseCmdLine ( QStringList arguments)
static

Definition at line 333 of file qdbuscpp2xml.cpp.

References arg, arguments, QList< T >::at(), QDBusConnection::ExportNonScriptableContents, QDBusConnection::ExportNonScriptableProperties, QDBusConnection::ExportNonScriptableSignals, QDBusConnection::ExportNonScriptableSlots, QDBusConnection::ExportScriptableContents, QDBusConnection::ExportScriptableProperties, QDBusConnection::ExportScriptableSignals, QDBusConnection::ExportScriptableSlots, i, outputFile, Q_FALLTHROUGH, qPrintable, QDBusMetaType::registerCustomType(), s_customTypes, showHelp(), showVersion(), QList< T >::size(), and QList< T >::takeAt().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qDBusGenerateClassDefXml()

QString qDBusGenerateClassDefXml ( const ClassDef cdef)

Definition at line 267 of file qdbuscpp2xml.cpp.

References QString::arg(), BaseDef::classInfoList, QString::fromLatin1(), QString::fromUtf8(), generateInterfaceXml(), interface, QCLASSINFO_DBUS_INTROSPECTION, and xml.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qDBusInterfaceFromClassDef()

QString qDBusInterfaceFromClassDef ( const ClassDef mo)

Definition at line 242 of file qdbuscpp2xml.cpp.

References QString::fromUtf8(), interface, mo, and QCLASSINFO_DBUS_INTERFACE.

+ Here is the call graph for this function:

◆ qDBusParametersForMethod()

int qDBusParametersForMethod ( const FunctionDef mm,
QList< QMetaType > &  metaTypes,
QString errorMsg 
)

Definition at line 61 of file qdbuscpp2xml.cpp.

References QList< T >::append(), arg, FunctionDef::arguments, qDBusParametersForMethod(), QList< T >::reserve(), and QList< T >::size().

Referenced by addFunction(), and qDBusParametersForMethod().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showHelp()

static void showHelp ( )
static

Definition at line 285 of file qdbuscpp2xml.cpp.

References help.

Referenced by parseCmdLine().

+ Here is the caller graph for this function:

◆ showVersion()

static void showVersion ( )
static

Definition at line 291 of file qdbuscpp2xml.cpp.

References PROGRAMNAME, and PROGRAMVERSION.

Referenced by parseCmdLine().

+ Here is the caller graph for this function:

◆ typeNameToXml()

static QString typeNameToXml ( const char *  typeName)
inlinestatic

Definition at line 73 of file qdbuscpp2xml.cpp.

References QString::toHtmlEscaped(), and typeName.

Referenced by addFunction(), and generateInterfaceXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ docTypeHeader

const char docTypeHeader[]
static
Initial value:
=
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" "
"\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"

Definition at line 22 of file qdbuscpp2xml.cpp.

Referenced by main().

◆ flags

int flags
static

Definition at line 43 of file qdbuscpp2xml.cpp.

◆ help

const char help[]
static
Initial value:
=
"Usage: " PROGRAMNAME " [options...] [files...]\n"
"Parses the C++ source or header file containing a QObject-derived class and\n"
"produces the D-Bus Introspection XML."
"\n"
"Options:\n"
" -p|-s|-m Only parse scriptable Properties, Signals and Methods (slots)\n"
" -P|-S|-M Parse all Properties, Signals and Methods (slots)\n"
" -a Output all scriptable contents (equivalent to -psm)\n"
" -A Output all contents (equivalent to -PSM)\n"
" -t <type>=<dbustype> Output <type> (ex: MyStruct) as <dbustype> (ex: {ss})\n"
" -o <filename> Write the output to file <filename>\n"
" -h Show this information\n"
" -V Show the program version and quit.\n"
"\n"
#define PROGRAMNAME

Definition at line 45 of file qdbuscpp2xml.cpp.

Referenced by QApplication::notify(), and showHelp().

◆ outputFile

◆ s_customTypes

std::deque<CustomType> s_customTypes
static

Definition at line 331 of file qdbuscpp2xml.cpp.

Referenced by parseCmdLine().