Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdbuscpp2xml.cpp File Reference

(4183fa4c0b75a76fbc687298f4513971a9230152)

#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 <private/qdbusmetatype_p.h>
#include <qdbusmetatype.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 27 of file qdbuscpp2xml.cpp.

Referenced by addFunction().

◆ PROGRAMCOPYRIGHT

#define PROGRAMCOPYRIGHT   QT_COPYRIGHT

Definition at line 41 of file qdbuscpp2xml.cpp.

◆ PROGRAMNAME

#define PROGRAMNAME   "qdbuscpp2xml"

Definition at line 39 of file qdbuscpp2xml.cpp.

Referenced by generateInterfaceXml(), main(), and showVersion().

◆ PROGRAMVERSION

#define PROGRAMVERSION   "0.2"

Definition at line 40 of file qdbuscpp2xml.cpp.

Referenced by showVersion().

◆ QCLASSINFO_DBUS_INTERFACE

#define QCLASSINFO_DBUS_INTERFACE   "D-Bus Interface"

Definition at line 28 of file qdbuscpp2xml.cpp.

Referenced by qDBusInterfaceFromClassDef().

◆ QCLASSINFO_DBUS_INTROSPECTION

#define QCLASSINFO_DBUS_INTROSPECTION   "D-Bus Introspection"

Definition at line 29 of file qdbuscpp2xml.cpp.

Referenced by qDBusGenerateClassDefXml().

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 427 of file qdbuscpp2xml.cpp.

References QList< T >::append(), arg, args, docTypeHeader, fileName, QString::fromLocal8Bit(), QDBusMetaTypeId::init(), QList< T >::isEmpty(), moc(), output, outputFile, parseCmdLine(), 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 336 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 270 of file qdbuscpp2xml.cpp.

References 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 245 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 62 of file qdbuscpp2xml.cpp.

References arg, FunctionDef::arguments, qDBusParametersForMethod(), 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 288 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 294 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 74 of file qdbuscpp2xml.cpp.

References typeName.

Referenced by addFunction(), and generateInterfaceXml().

+ 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 23 of file qdbuscpp2xml.cpp.

Referenced by main().

◆ flags

int flags
static

Definition at line 44 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 46 of file qdbuscpp2xml.cpp.

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

◆ outputFile

◆ s_customTypes

std::deque<CustomType> s_customTypes
static

Definition at line 334 of file qdbuscpp2xml.cpp.

Referenced by parseCmdLine().