* Enabled the symbol visibility feature from gcc 4, reduces binary size and dynamic loading speed
* A lot of fixes to keep compatibility with older (0.6x) versions of libdbus * Moved the xml handling code from the library to the code generator * Rewrote the routine to generate introspection data * Autojunk cleanup git-svn-id: http://dev.openwengo.org/svn/openwengo/wengophone-ng/branches/wengophone-dbus-api/libs/dbus@12019 30a43799-04e7-0310-8b2b-ea0d24f86d0e
This commit is contained in:
parent
a8f5e819bd
commit
7c420f87cd
36 changed files with 287 additions and 172 deletions
85
configure.ac
85
configure.ac
|
@ -14,19 +14,22 @@ AC_CANONICAL_HOST
|
|||
AC_ARG_ENABLE(debug,
|
||||
AS_HELP_STRING([--enable-debug],
|
||||
[enable debugging support]),
|
||||
enable_debug=$enableval,enable_debug=auto
|
||||
[enable_debug=$enableval],
|
||||
[enable_debug=no]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(glib,
|
||||
AS_HELP_STRING([--enable-glib],
|
||||
[enable glib integration]),
|
||||
enable_glib=$enableval,enable_debug=auto
|
||||
[enable_glib=$enableval],
|
||||
[enable_glib=no]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(doxygen-docs,
|
||||
AS_HELP_STRING([--enable-doxygen-docs],
|
||||
[build DOXYGEN documentation (requires Doxygen)]),
|
||||
enable_doxygen_docs=$enableval,enable_doxygen_docs=auto
|
||||
[enable_doxygen_docs=$enableval],
|
||||
[enable_doxygen_docs=no]
|
||||
)
|
||||
|
||||
# Check for programs
|
||||
|
@ -44,10 +47,24 @@ AM_PROG_LIBTOOL
|
|||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
|
||||
AC_MSG_CHECKING([whether $CXX supports symbol visibility])
|
||||
|
||||
vtest=`$CXX --help --verbose 2>&1 | grep fvisibility`
|
||||
|
||||
if test -n "$vtest"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
AC_DEFINE(GCC_HASCLASSVISIBILITY, 1, [to enable hidden symbols])
|
||||
CXXFLAGS="-fvisibility=hidden"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
|
||||
# Check for dependencies
|
||||
|
||||
DBUS_REQUIRED_VERSION=0.60
|
||||
PKG_CHECK_MODULES([dbus], dbus-1 >= $DBUS_REQUIRED_VERSION,,
|
||||
PKG_CHECK_MODULES(dbus, [dbus-1 >= $DBUS_REQUIRED_VERSION],,
|
||||
AC_MSG_ERROR([You need the DBus libraries (version 0.6 or better)]
|
||||
[http://www.freedesktop.org/wiki/Software_2fdbus])
|
||||
)
|
||||
|
@ -55,16 +72,22 @@ AC_SUBST(dbus_CFLAGS)
|
|||
AC_SUBST(dbus_LIBS)
|
||||
|
||||
DBUS_API_STABLE_VERSION=1.0.0
|
||||
PKG_CHECK_EXISTS(dbus-1 < $DBUS_API_STABLE_VERSION,
|
||||
AC_DEFINE(DBUS_API_SUBJECT_TO_CHANGE, , [unstable DBus])
|
||||
PKG_CHECK_EXISTS([dbus-1 < $DBUS_API_STABLE_VERSION],
|
||||
[AC_DEFINE(DBUS_API_SUBJECT_TO_CHANGE, , [unstable DBus])]
|
||||
)
|
||||
|
||||
DBUS_THREADS_INIT_DEFAULT_VERSION=0.93
|
||||
PKG_CHECK_EXISTS([dbus-1 >= $DBUS_THREADS_INIT_DEFAULT_VERSION],
|
||||
[AC_DEFINE(DBUS_HAS_THREADS_INIT_DEFAULT, , [dbus_threads_init_default (needs DBus >= 0.93)])]
|
||||
)
|
||||
|
||||
DBUS_RECURSIVE_MUTEX_VERSION=0.95
|
||||
PKG_CHECK_EXISTS(dbus-1 >= $DBUS_RECURSIVE_MUTEX_VERSION,
|
||||
AC_DEFINE(DBUS_HAS_RECURSIVE_MUTEX, , [DBus supports recursive mutexes (needs DBus >= 0.95)])
|
||||
PKG_CHECK_EXISTS([dbus-1 >= $DBUS_RECURSIVE_MUTEX_VERSION],
|
||||
[AC_DEFINE(DBUS_HAS_RECURSIVE_MUTEX, , [DBus supports recursive mutexes (needs DBus >= 0.95)])]
|
||||
)
|
||||
|
||||
if test x$enable_glib = xyes ; then
|
||||
|
||||
if test "$enable_glib" = "yes" ; then
|
||||
PKG_CHECK_MODULES([glib], glib-2.0)
|
||||
AC_SUBST(glib_CFLAGS)
|
||||
AC_SUBST(glib_LIBS)
|
||||
|
@ -99,12 +122,12 @@ AC_CHECK_LIB([pthread], pthread_create,
|
|||
[AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)],
|
||||
have_pthread=false)
|
||||
|
||||
AM_CONDITIONAL(HAVE_PTHREAD, test x$have_pthread = xtrue)
|
||||
AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "true")
|
||||
|
||||
if test x$enable_debug = xyes ; then
|
||||
CXXFLAGS="-Wall -ggdb -O0 -DDEBUG"
|
||||
if test "$enable_debug" = "yes" ; then
|
||||
CXXFLAGS="$CXXFLAGS -Wall -ggdb -O0 -DDEBUG"
|
||||
else
|
||||
CXXFLAGS="-Wall -O3"
|
||||
CXXFLAGS="$CXXFLAGS -Wall -O3"
|
||||
fi
|
||||
|
||||
|
||||
|
@ -114,35 +137,37 @@ AC_PATH_PROG(DOXYGEN, doxygen, no)
|
|||
|
||||
AC_MSG_CHECKING([whether to build Doxygen documentation])
|
||||
|
||||
if test x$DOXYGEN = xno ; then
|
||||
have_doxygen=no
|
||||
if test "$DOXYGEN" = "no" ; then
|
||||
have_doxygen=no
|
||||
else
|
||||
have_doxygen=yes
|
||||
have_doxygen=yes
|
||||
fi
|
||||
|
||||
if test x$enable_doxygen_docs = xauto ; then
|
||||
enable_doxygen_docs=no
|
||||
if test "$enable_doxygen_docs" = "auto" ; then
|
||||
enable_doxygen_docs=no
|
||||
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
if test x$enable_doxygen_docs = xyes ; then
|
||||
if test x$have_doxygen = xno; then
|
||||
AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
|
||||
fi
|
||||
if test "$enable_doxygen_docs" = "yes" ; then
|
||||
if test "$have_doxygen" = "no"; then
|
||||
AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test "$enable_doxygen_docs" = "yes")
|
||||
|
||||
# For the tools/, we need libdbus-c++ for the "build" architecture as well
|
||||
|
||||
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
|
||||
AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes")
|
||||
|
||||
AC_ARG_WITH(build-libdbus-cxx,
|
||||
AS_HELP_STRING([--with-build-libdbus-cxx],[For cross compilation: path to
|
||||
libdbus-cxx which was compiled for the 'build' system.]),
|
||||
[ BUILD_LIBDBUS_CXX_DIR=${withval} ],
|
||||
[ BUILD_LIBDBUS_CXX_DIR="\$(top_builddir)" ]
|
||||
AS_HELP_STRING([--with-build-libdbus-cxx],
|
||||
[For cross compilation: path to libdbus-cxx which was compiled for the 'build' system.]),
|
||||
[ BUILD_LIBDBUS_CXX_DIR=${withval} ],
|
||||
[ BUILD_LIBDBUS_CXX_DIR="\$(top_builddir)" ]
|
||||
)
|
||||
AC_SUBST(BUILD_LIBDBUS_CXX_DIR)
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <dbus-c++/config.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
static const char* ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
|
||||
|
@ -58,7 +62,11 @@ int main()
|
|||
signal(SIGTERM, niam);
|
||||
signal(SIGINT, niam);
|
||||
|
||||
#ifdef DBUS_HAS_THREADS_INIT_DEFAULT
|
||||
DBus::_init_threading();
|
||||
#else
|
||||
cerr << "Thread support is not enabled! your D-Bus version is too old" << endl;
|
||||
#endif
|
||||
|
||||
DBus::default_dispatcher = &dispatcher;
|
||||
|
||||
|
|
42
include/dbus-c++/api.h
Normal file
42
include/dbus-c++/api.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
*
|
||||
* D-Bus++ - C++ bindings for D-Bus
|
||||
*
|
||||
* Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DBUSXX_API_H
|
||||
#define __DBUSXX_API_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_HASCLASSVISIBILITY
|
||||
# define DXXAPILOCAL __attribute__ ((visibility("hidden")))
|
||||
# define DXXAPIPUBLIC __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define DXXAPILOCAL
|
||||
# define DXXAPIPUBLIC
|
||||
#endif
|
||||
|
||||
#define DXXAPI DXXAPIPUBLIC
|
||||
|
||||
#endif//__DBUSXX_API_H
|
|
@ -6,6 +6,12 @@
|
|||
/* DBus supports recursive mutexes (needs DBus >= 0.95) */
|
||||
#undef DBUS_HAS_RECURSIVE_MUTEX
|
||||
|
||||
/* dbus_threads_init_default (needs DBus >= 0.93) */
|
||||
#undef DBUS_HAS_THREADS_INIT_DEFAULT
|
||||
|
||||
/* to enable hidden symbols */
|
||||
#undef GCC_HASCLASSVISIBILITY
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <list>
|
||||
|
||||
#include "api.h"
|
||||
#include "types.h"
|
||||
#include "util.h"
|
||||
#include "message.h"
|
||||
|
@ -47,7 +48,7 @@ typedef std::list<Connection> ConnectionList;
|
|||
class ObjectAdaptor;
|
||||
class Dispatcher;
|
||||
|
||||
class Connection
|
||||
class DXXAPI Connection
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -111,7 +112,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
void init();
|
||||
DXXAPILOCAL void init();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "util.h"
|
||||
#include "dispatcher.h"
|
||||
#include "eventloop.h"
|
||||
#include "xml.h"
|
||||
#include "introspection.h"
|
||||
|
||||
#endif//__DBUSXX_DBUS_H
|
||||
|
|
|
@ -29,11 +29,13 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "api.h"
|
||||
|
||||
namespace DBus {
|
||||
|
||||
typedef void (*LogFunction)(const char* format, ...);
|
||||
|
||||
extern LogFunction debug_log;
|
||||
extern DXXAPI LogFunction debug_log;
|
||||
|
||||
} /* namespace DBus */
|
||||
|
||||
|
|
|
@ -29,11 +29,12 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "api.h"
|
||||
#include "connection.h"
|
||||
|
||||
namespace DBus {
|
||||
|
||||
class Timeout
|
||||
class DXXAPI Timeout
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -53,14 +54,14 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
Timeout( const Timeout& );
|
||||
DXXAPILOCAL Timeout( const Timeout& );
|
||||
|
||||
private:
|
||||
|
||||
Internal* _int;
|
||||
};
|
||||
|
||||
class Watch
|
||||
class DXXAPI Watch
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -82,14 +83,14 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
Watch( const Watch& );
|
||||
DXXAPILOCAL Watch( const Watch& );
|
||||
|
||||
private:
|
||||
|
||||
Internal* _int;
|
||||
};
|
||||
|
||||
class Dispatcher
|
||||
class DXXAPI Dispatcher
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -119,12 +120,12 @@ private:
|
|||
Connection::PrivatePList _pending_queue;
|
||||
};
|
||||
|
||||
extern Dispatcher* default_dispatcher;
|
||||
extern DXXAPI Dispatcher* default_dispatcher;
|
||||
|
||||
/* classes for multithreading support
|
||||
*/
|
||||
|
||||
class Mutex
|
||||
class DXXAPI Mutex
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -141,7 +142,7 @@ protected:
|
|||
Internal* _int;
|
||||
};
|
||||
|
||||
class CondVar
|
||||
class DXXAPI CondVar
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -181,9 +182,11 @@ typedef bool (*CondVarWaitTimeoutFn)( CondVar* cv, Mutex* mx, int timeout );
|
|||
typedef void (*CondVarWakeOneFn)( CondVar* cv );
|
||||
typedef void (*CondVarWakeAllFn)( CondVar* cv );
|
||||
|
||||
void _init_threading();
|
||||
#ifdef DBUS_HAS_THREADS_INIT_DEFAULT
|
||||
void DXXAPI _init_threading();
|
||||
#endif//DBUS_HAS_THREADS_INIT_DEFAULT
|
||||
|
||||
void _init_threading(
|
||||
void DXXAPI _init_threading(
|
||||
MutexNewFn, MutexFreeFn, MutexLockFn, MutexUnlockFn,
|
||||
CondVarNewFn, CondVarFreeFn, CondVarWaitFn, CondVarWaitTimeoutFn, CondVarWakeOneFn, CondVarWakeAllFn
|
||||
);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "api.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <exception>
|
||||
|
@ -38,7 +39,7 @@ namespace DBus {
|
|||
class Message;
|
||||
class InternalError;
|
||||
|
||||
class Error : public std::exception
|
||||
class DXXAPI Error : public std::exception
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -50,8 +51,7 @@ public:
|
|||
|
||||
Error( Message& );
|
||||
|
||||
~Error() throw()
|
||||
{}
|
||||
~Error() throw();
|
||||
|
||||
const char* what() const throw();
|
||||
|
||||
|
@ -74,210 +74,210 @@ private:
|
|||
RefPtrI<InternalError> _int;
|
||||
};
|
||||
|
||||
struct ErrorFailed : public Error
|
||||
struct DXXAPI ErrorFailed : public Error
|
||||
{
|
||||
ErrorFailed( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.Failed", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorNoMemory : public Error
|
||||
struct DXXAPI ErrorNoMemory : public Error
|
||||
{
|
||||
ErrorNoMemory( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.NoMemory", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorServiceUnknown : public Error
|
||||
struct DXXAPI ErrorServiceUnknown : public Error
|
||||
{
|
||||
ErrorServiceUnknown( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.ServiceUnknown", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorNameHasNoOwner : public Error
|
||||
struct DXXAPI ErrorNameHasNoOwner : public Error
|
||||
{
|
||||
ErrorNameHasNoOwner( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.NameHasNoOwner", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorNoReply : public Error
|
||||
struct DXXAPI ErrorNoReply : public Error
|
||||
{
|
||||
ErrorNoReply( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.NoReply", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorIOError : public Error
|
||||
struct DXXAPI ErrorIOError : public Error
|
||||
{
|
||||
ErrorIOError( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.IOError", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorBadAddress : public Error
|
||||
struct DXXAPI ErrorBadAddress : public Error
|
||||
{
|
||||
ErrorBadAddress( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.BadAddress", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorNotSupported : public Error
|
||||
struct DXXAPI ErrorNotSupported : public Error
|
||||
{
|
||||
ErrorNotSupported( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.NotSupported", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorLimitsExceeded : public Error
|
||||
struct DXXAPI ErrorLimitsExceeded : public Error
|
||||
{
|
||||
ErrorLimitsExceeded( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.LimitsExceeded", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorAccessDenied : public Error
|
||||
struct DXXAPI ErrorAccessDenied : public Error
|
||||
{
|
||||
ErrorAccessDenied( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.AccessDenied", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorAuthFailed : public Error
|
||||
struct DXXAPI ErrorAuthFailed : public Error
|
||||
{
|
||||
ErrorAuthFailed( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.AuthFailed", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorNoServer : public Error
|
||||
struct DXXAPI ErrorNoServer : public Error
|
||||
{
|
||||
ErrorNoServer( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.NoServer", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorTimeout : public Error
|
||||
struct DXXAPI ErrorTimeout : public Error
|
||||
{
|
||||
ErrorTimeout( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.Timeout", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorNoNetwork : public Error
|
||||
struct DXXAPI ErrorNoNetwork : public Error
|
||||
{
|
||||
ErrorNoNetwork( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.NoNetwork", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorAddressInUse : public Error
|
||||
struct DXXAPI ErrorAddressInUse : public Error
|
||||
{
|
||||
ErrorAddressInUse( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.AddressInUse", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorDisconnected : public Error
|
||||
struct DXXAPI ErrorDisconnected : public Error
|
||||
{
|
||||
ErrorDisconnected( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.Disconnected", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorInvalidArgs : public Error
|
||||
struct DXXAPI ErrorInvalidArgs : public Error
|
||||
{
|
||||
ErrorInvalidArgs( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.InvalidArgs", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorFileNotFound : public Error
|
||||
struct DXXAPI ErrorFileNotFound : public Error
|
||||
{
|
||||
ErrorFileNotFound( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.FileNotFound", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorUnknownMethod : public Error
|
||||
struct DXXAPI ErrorUnknownMethod : public Error
|
||||
{
|
||||
ErrorUnknownMethod( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.UnknownMethod", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorTimedOut : public Error
|
||||
struct DXXAPI ErrorTimedOut : public Error
|
||||
{
|
||||
ErrorTimedOut( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.TimedOut", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorMatchRuleNotFound : public Error
|
||||
struct DXXAPI ErrorMatchRuleNotFound : public Error
|
||||
{
|
||||
ErrorMatchRuleNotFound( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.MatchRuleNotFound", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorMatchRuleInvalid : public Error
|
||||
struct DXXAPI ErrorMatchRuleInvalid : public Error
|
||||
{
|
||||
ErrorMatchRuleInvalid( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.MatchRuleInvalid", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorSpawnExecFailed : public Error
|
||||
struct DXXAPI ErrorSpawnExecFailed : public Error
|
||||
{
|
||||
ErrorSpawnExecFailed( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.Spawn.ExecFailed", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorSpawnForkFailed : public Error
|
||||
struct DXXAPI ErrorSpawnForkFailed : public Error
|
||||
{
|
||||
ErrorSpawnForkFailed( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.Spawn.ForkFailed", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorSpawnChildExited : public Error
|
||||
struct DXXAPI ErrorSpawnChildExited : public Error
|
||||
{
|
||||
ErrorSpawnChildExited( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.Spawn.ChildExited", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorSpawnChildSignaled : public Error
|
||||
struct DXXAPI ErrorSpawnChildSignaled : public Error
|
||||
{
|
||||
ErrorSpawnChildSignaled( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.Spawn.ChildSignaled", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorSpawnFailed : public Error
|
||||
struct DXXAPI ErrorSpawnFailed : public Error
|
||||
{
|
||||
ErrorSpawnFailed( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.Spawn.Failed", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorInvalidSignature : public Error
|
||||
struct DXXAPI ErrorInvalidSignature : public Error
|
||||
{
|
||||
ErrorInvalidSignature( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.InvalidSignature", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorUnixProcessIdUnknown : public Error
|
||||
struct DXXAPI ErrorUnixProcessIdUnknown : public Error
|
||||
{
|
||||
ErrorUnixProcessIdUnknown( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.UnixProcessIdUnknown", message)
|
||||
{}
|
||||
};
|
||||
|
||||
struct ErrorSELinuxSecurityContextUnknown : public Error
|
||||
struct DXXAPI ErrorSELinuxSecurityContextUnknown : public Error
|
||||
{
|
||||
ErrorSELinuxSecurityContextUnknown( const char* message )
|
||||
: Error("org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", message)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <list>
|
||||
|
||||
#include "api.h"
|
||||
#include "dispatcher.h"
|
||||
#include "util.h"
|
||||
|
||||
|
@ -38,7 +39,7 @@ namespace DBus {
|
|||
|
||||
class EepleMainLoop;
|
||||
|
||||
class EepleTimeout
|
||||
class DXXAPI EepleTimeout
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -78,7 +79,7 @@ friend class EepleMainLoop;
|
|||
|
||||
typedef std::list< EepleTimeout* > Timeouts;
|
||||
|
||||
class EepleWatch
|
||||
class DXXAPI EepleWatch
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -118,7 +119,7 @@ friend class EepleMainLoop;
|
|||
|
||||
typedef std::list< EepleWatch* > Watches;
|
||||
|
||||
class EepleMainLoop
|
||||
class DXXAPI EepleMainLoop
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -145,7 +146,7 @@ friend class EepleWatch;
|
|||
|
||||
class BusDispatcher;
|
||||
|
||||
class BusTimeout : public Timeout, public EepleTimeout
|
||||
class DXXAPI BusTimeout : public Timeout, public EepleTimeout
|
||||
{
|
||||
BusTimeout( Timeout::Internal*, BusDispatcher* );
|
||||
|
||||
|
@ -154,7 +155,7 @@ class BusTimeout : public Timeout, public EepleTimeout
|
|||
friend class BusDispatcher;
|
||||
};
|
||||
|
||||
class BusWatch : public Watch, public EepleWatch
|
||||
class DXXAPI BusWatch : public Watch, public EepleWatch
|
||||
{
|
||||
BusWatch( Watch::Internal*, BusDispatcher* );
|
||||
|
||||
|
@ -163,7 +164,7 @@ class BusWatch : public Watch, public EepleWatch
|
|||
friend class BusDispatcher;
|
||||
};
|
||||
|
||||
class BusDispatcher : public Dispatcher, public EepleMainLoop
|
||||
class DXXAPI BusDispatcher : public Dispatcher, public EepleMainLoop
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include "api.h"
|
||||
#include "eventloop.h"
|
||||
|
||||
namespace DBus {
|
||||
|
@ -39,7 +40,7 @@ namespace Glib {
|
|||
|
||||
class BusDispatcher;
|
||||
|
||||
class BusTimeout : public Timeout
|
||||
class DXXAPI BusTimeout : public Timeout
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -63,7 +64,7 @@ private:
|
|||
friend class BusDispatcher;
|
||||
};
|
||||
|
||||
class BusWatch : public Watch
|
||||
class DXXAPI BusWatch : public Watch
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -87,7 +88,7 @@ private:
|
|||
friend class BusDispatcher;
|
||||
};
|
||||
|
||||
class BusDispatcher : public Dispatcher
|
||||
class DXXAPI BusDispatcher : public Dispatcher
|
||||
{
|
||||
public:
|
||||
BusDispatcher() : _ctx(NULL) {}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "api.h"
|
||||
#include "util.h"
|
||||
#include "types.h"
|
||||
|
||||
|
@ -39,7 +40,7 @@
|
|||
namespace DBus {
|
||||
|
||||
//todo: this should belong to to properties.h
|
||||
struct PropertyData
|
||||
struct DXXAPI PropertyData
|
||||
{
|
||||
bool read;
|
||||
bool write;
|
||||
|
@ -57,7 +58,7 @@ class SignalMessage;
|
|||
|
||||
typedef std::map<std::string, InterfaceAdaptor*> InterfaceAdaptorTable;
|
||||
|
||||
class AdaptorBase
|
||||
class DXXAPI AdaptorBase
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -84,7 +85,7 @@ class CallMessage;
|
|||
|
||||
typedef std::map<std::string, InterfaceProxy*> InterfaceProxyTable;
|
||||
|
||||
class ProxyBase
|
||||
class DXXAPI ProxyBase
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -102,7 +103,7 @@ protected:
|
|||
InterfaceProxyTable _interfaces;
|
||||
};
|
||||
|
||||
class Interface
|
||||
class DXXAPI Interface
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -130,7 +131,7 @@ const std::string& Interface::name() const
|
|||
|
||||
typedef std::map< std::string, Slot<Message, const CallMessage&> > MethodTable;
|
||||
|
||||
class InterfaceAdaptor : public Interface, public virtual AdaptorBase
|
||||
class DXXAPI InterfaceAdaptor : public Interface, public virtual AdaptorBase
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -160,7 +161,7 @@ protected:
|
|||
|
||||
typedef std::map< std::string, Slot<void, const SignalMessage&> > SignalTable;
|
||||
|
||||
class InterfaceProxy : public Interface, public virtual ProxyBase
|
||||
class DXXAPI InterfaceProxy : public Interface, public virtual ProxyBase
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -29,24 +29,25 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "api.h"
|
||||
#include "interface.h"
|
||||
|
||||
namespace DBus {
|
||||
|
||||
struct IntrospectedArgument
|
||||
struct DXXAPI IntrospectedArgument
|
||||
{
|
||||
const char* name;
|
||||
const char* type;
|
||||
const bool in;
|
||||
};
|
||||
|
||||
struct IntrospectedMethod
|
||||
struct DXXAPI IntrospectedMethod
|
||||
{
|
||||
const char* name;
|
||||
const IntrospectedArgument* args;
|
||||
};
|
||||
|
||||
struct IntrospectedProperty
|
||||
struct DXXAPI IntrospectedProperty
|
||||
{
|
||||
const char* name;
|
||||
const char* type;
|
||||
|
@ -54,7 +55,7 @@ struct IntrospectedProperty
|
|||
const bool write;
|
||||
};
|
||||
|
||||
struct IntrospectedInterface
|
||||
struct DXXAPI IntrospectedInterface
|
||||
{
|
||||
const char* name;
|
||||
const IntrospectedMethod* methods;
|
||||
|
@ -62,7 +63,7 @@ struct IntrospectedInterface
|
|||
const IntrospectedProperty* properties;
|
||||
};
|
||||
|
||||
class IntrospectableAdaptor : public InterfaceAdaptor
|
||||
class DXXAPI IntrospectableAdaptor : public InterfaceAdaptor
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -75,7 +76,7 @@ protected:
|
|||
IntrospectedInterface* const introspect() const;
|
||||
};
|
||||
|
||||
class IntrospectableProxy : public InterfaceProxy
|
||||
class DXXAPI IntrospectableProxy : public InterfaceProxy
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "api.h"
|
||||
#include "util.h"
|
||||
|
||||
namespace DBus {
|
||||
|
@ -43,7 +44,7 @@ class ReturnMessage;
|
|||
class Error;
|
||||
class Connection;
|
||||
|
||||
class MessageIter
|
||||
class DXXAPI MessageIter
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -140,11 +141,11 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
MessageIter(Message& msg) : _msg(&msg) {}
|
||||
DXXAPILOCAL MessageIter(Message& msg) : _msg(&msg) {}
|
||||
|
||||
bool append_basic( int type_id, void* value );
|
||||
DXXAPILOCAL bool append_basic( int type_id, void* value );
|
||||
|
||||
void get_basic( int type_id, void* ptr );
|
||||
DXXAPILOCAL void get_basic( int type_id, void* ptr );
|
||||
|
||||
private:
|
||||
|
||||
|
@ -157,7 +158,7 @@ private:
|
|||
friend class Message;
|
||||
};
|
||||
|
||||
class Message
|
||||
class DXXAPI Message
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -221,7 +222,7 @@ friend class Connection;
|
|||
/*
|
||||
*/
|
||||
|
||||
class ErrorMessage : public Message
|
||||
class DXXAPI ErrorMessage : public Message
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -239,7 +240,7 @@ public:
|
|||
/*
|
||||
*/
|
||||
|
||||
class SignalMessage : public Message
|
||||
class DXXAPI SignalMessage : public Message
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -267,7 +268,7 @@ public:
|
|||
/*
|
||||
*/
|
||||
|
||||
class CallMessage : public Message
|
||||
class DXXAPI CallMessage : public Message
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -297,7 +298,7 @@ public:
|
|||
/*
|
||||
*/
|
||||
|
||||
class ReturnMessage : public Message
|
||||
class DXXAPI ReturnMessage : public Message
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "api.h"
|
||||
#include "interface.h"
|
||||
#include "connection.h"
|
||||
#include "message.h"
|
||||
|
@ -39,7 +40,7 @@
|
|||
|
||||
namespace DBus {
|
||||
|
||||
class Object
|
||||
class DXXAPI Object
|
||||
{
|
||||
protected:
|
||||
|
||||
|
@ -57,9 +58,9 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
virtual bool handle_message( const Message& ) = 0;
|
||||
virtual void register_obj() = 0;
|
||||
virtual void unregister_obj() = 0;
|
||||
DXXAPILOCAL virtual bool handle_message( const Message& ) = 0;
|
||||
DXXAPILOCAL virtual void register_obj() = 0;
|
||||
DXXAPILOCAL virtual void unregister_obj() = 0;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -89,7 +90,7 @@ const std::string& Object::service() const
|
|||
/*
|
||||
*/
|
||||
|
||||
class Tag
|
||||
class DXXAPI Tag
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -104,7 +105,7 @@ class ObjectAdaptor;
|
|||
|
||||
typedef std::list<ObjectAdaptor*> ObjectAdaptorPList;
|
||||
|
||||
class ObjectAdaptor : public Object, public virtual AdaptorBase
|
||||
class DXXAPI ObjectAdaptor : public Object, public virtual AdaptorBase
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -122,7 +123,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
class Continuation
|
||||
class DXXAPI Continuation
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -188,7 +189,7 @@ class ObjectProxy;
|
|||
|
||||
typedef std::list<ObjectProxy*> ObjectProxyPList;
|
||||
|
||||
class ObjectProxy : public Object, public virtual ProxyBase
|
||||
class DXXAPI ObjectProxy : public Object, public virtual ProxyBase
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -29,13 +29,14 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "api.h"
|
||||
#include "util.h"
|
||||
|
||||
namespace DBus {
|
||||
|
||||
class Connection;
|
||||
|
||||
class PendingCall
|
||||
class DXXAPI PendingCall
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -59,7 +60,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
PendingCall( const PendingCall& );
|
||||
DXXAPILOCAL PendingCall( const PendingCall& );
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "api.h"
|
||||
#include "types.h"
|
||||
#include "interface.h"
|
||||
|
||||
|
@ -67,7 +68,7 @@ private:
|
|||
|
||||
struct IntrospectedInterface;
|
||||
|
||||
class PropertiesAdaptor : public InterfaceAdaptor
|
||||
class DXXAPI PropertiesAdaptor : public InterfaceAdaptor
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -88,7 +89,7 @@ protected:
|
|||
IntrospectedInterface* const introspect() const;
|
||||
};
|
||||
|
||||
class PropertiesProxy : public InterfaceProxy
|
||||
class DXXAPI PropertiesProxy : public InterfaceProxy
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "api.h"
|
||||
#include "util.h"
|
||||
|
||||
namespace DBus {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <list>
|
||||
|
||||
#include "api.h"
|
||||
#include "error.h"
|
||||
#include "connection.h"
|
||||
#include "util.h"
|
||||
|
@ -42,7 +43,7 @@ class Server;
|
|||
|
||||
typedef std::list<Server> ServerList;
|
||||
|
||||
class Server
|
||||
class DXXAPI Server
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "api.h"
|
||||
#include "util.h"
|
||||
#include "message.h"
|
||||
#include "error.h"
|
||||
|
@ -50,7 +51,7 @@ typedef unsigned long long UInt64;
|
|||
typedef double Double;
|
||||
typedef std::string String;
|
||||
|
||||
struct Path : public std::string
|
||||
struct DXXAPI Path : public std::string
|
||||
{
|
||||
Path() {}
|
||||
Path( const std::string& s ) : std::string(s) {}
|
||||
|
@ -62,7 +63,7 @@ struct Path : public std::string
|
|||
}
|
||||
};
|
||||
|
||||
struct Signature : public std::string
|
||||
struct DXXAPI Signature : public std::string
|
||||
{
|
||||
Signature() {}
|
||||
Signature( const std::string& s ) : std::string(s) {}
|
||||
|
@ -74,9 +75,9 @@ struct Signature : public std::string
|
|||
}
|
||||
};
|
||||
|
||||
struct Invalid {};
|
||||
struct DXXAPI Invalid {};
|
||||
|
||||
class Variant
|
||||
class DXXAPI Variant
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -344,7 +345,7 @@ inline DBus::MessageIter& operator << ( DBus::MessageIter& iter, const DBus::Str
|
|||
return iter;
|
||||
}
|
||||
|
||||
DBus::MessageIter& operator << ( DBus::MessageIter& iter, const DBus::Variant& val );
|
||||
extern DXXAPI DBus::MessageIter& operator << ( DBus::MessageIter& iter, const DBus::Variant& val );
|
||||
|
||||
/*
|
||||
*/
|
||||
|
@ -507,7 +508,7 @@ inline DBus::MessageIter& operator >> ( DBus::MessageIter& iter, DBus::Struct<T1
|
|||
return ++iter;
|
||||
}
|
||||
|
||||
DBus::MessageIter& operator >> ( DBus::MessageIter& iter, DBus::Variant& val );
|
||||
extern DXXAPI DBus::MessageIter& operator >> ( DBus::MessageIter& iter, DBus::Variant& val );
|
||||
|
||||
#endif//__DBUSXX_TYPES_H
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "api.h"
|
||||
#include "debug.h"
|
||||
|
||||
namespace DBus {
|
||||
|
@ -37,7 +38,7 @@ namespace DBus {
|
|||
* Very simple reference counting
|
||||
*/
|
||||
|
||||
class RefCnt
|
||||
class DXXAPI RefCnt
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -78,11 +79,11 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
void ref() const
|
||||
DXXAPILOCAL void ref() const
|
||||
{
|
||||
++ (*__ref);
|
||||
}
|
||||
void unref() const
|
||||
DXXAPILOCAL void unref() const
|
||||
{
|
||||
-- (*__ref);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
AM_CPPFLAGS = \
|
||||
$(dbus_CFLAGS) \
|
||||
$(xml_CFLAGS) \
|
||||
$(glib_CFLAGS) \
|
||||
-I$(top_srcdir)/include
|
||||
|
||||
|
@ -28,16 +27,16 @@ HEADER_FILES = \
|
|||
$(HEADER_DIR)/debug.h \
|
||||
$(HEADER_DIR)/util.h \
|
||||
$(HEADER_DIR)/refptr_impl.h \
|
||||
$(HEADER_DIR)/xml.h \
|
||||
$(HEADER_DIR)/introspection.h \
|
||||
$(HEADER_DIR)/api.h \
|
||||
$(GLIB_H)
|
||||
|
||||
lib_includedir=$(includedir)/dbus-c++-1/dbus-c++/
|
||||
lib_include_HEADERS = $(HEADER_FILES)
|
||||
|
||||
lib_LTLIBRARIES = libdbus-c++-1.la
|
||||
libdbus_c___1_la_SOURCES = $(HEADER_FILES) interface.cpp object.cpp introspection.cpp debug.cpp eventloop.cpp xml.cpp types.cpp connection.cpp connection_p.h property.cpp dispatcher.cpp dispatcher_p.h pendingcall.cpp pendingcall_p.h error.cpp internalerror.h message.cpp message_p.h server.cpp server_p.h $(GLIB_CPP)
|
||||
libdbus_c___1_la_LIBADD = $(dbus_LIBS) $(xml_LIBS) $(glib_LIBS)
|
||||
libdbus_c___1_la_SOURCES = $(HEADER_FILES) interface.cpp object.cpp introspection.cpp debug.cpp eventloop.cpp types.cpp connection.cpp connection_p.h property.cpp dispatcher.cpp dispatcher_p.h pendingcall.cpp pendingcall_p.h error.cpp internalerror.h message.cpp message_p.h server.cpp server_p.h $(GLIB_CPP)
|
||||
libdbus_c___1_la_LIBADD = $(dbus_LIBS) $(glib_LIBS)
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
namespace DBus {
|
||||
|
||||
struct Connection::Private
|
||||
struct DXXAPILOCAL Connection::Private
|
||||
{
|
||||
DBusConnection* conn;
|
||||
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#include <cstdio>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int debug_env = -1;
|
||||
|
||||
static void _debug_log_default(const char* format, ...)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
||||
static int debug_env = -1;
|
||||
|
||||
if(debug_env < 0) debug_env = getenv("DBUSXX_VERBOSE") ? 1 : 0;
|
||||
|
||||
if(debug_env)
|
||||
|
|
|
@ -168,10 +168,12 @@ void Dispatcher::dispatch_pending()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DBUS_HAS_THREADS_INIT_DEFAULT
|
||||
void DBus::_init_threading()
|
||||
{
|
||||
dbus_threads_init_default();
|
||||
}
|
||||
#endif//DBUS_HAS_THREADS_INIT_DEFAULT
|
||||
|
||||
void DBus::_init_threading(
|
||||
MutexNewFn m1,
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
namespace DBus {
|
||||
|
||||
struct Dispatcher::Private
|
||||
struct DXXAPILOCAL Dispatcher::Private
|
||||
{
|
||||
static dbus_bool_t on_add_watch( DBusWatch* watch, void* data );
|
||||
|
||||
|
|
|
@ -55,6 +55,10 @@ Error::Error( Message& m )
|
|||
dbus_set_error_from_message(&(_int->error), m._pvt->msg);
|
||||
}
|
||||
|
||||
Error::~Error() throw()
|
||||
{
|
||||
}
|
||||
|
||||
const char* Error::name() const
|
||||
{
|
||||
return _int->error.name;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
namespace DBus {
|
||||
|
||||
struct InternalError
|
||||
struct DXXAPI InternalError
|
||||
{
|
||||
DBusError error;
|
||||
|
||||
|
|
|
@ -25,10 +25,11 @@
|
|||
#include <dbus-c++/introspection.h>
|
||||
#include <dbus-c++/object.h>
|
||||
#include <dbus-c++/message.h>
|
||||
#include <dbus-c++/xml.h>
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace DBus;
|
||||
|
||||
static const char* introspectable_name = "org.freedesktop.DBus.Introspectable";
|
||||
|
@ -42,8 +43,14 @@ IntrospectableAdaptor::IntrospectableAdaptor()
|
|||
Message IntrospectableAdaptor::Introspect( const CallMessage& call )
|
||||
{
|
||||
debug_log("requested introspection data");
|
||||
|
||||
Xml::Node iroot("node");
|
||||
|
||||
std::ostringstream xml;
|
||||
|
||||
xml << DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE;
|
||||
|
||||
const std::string path = object()->path();
|
||||
|
||||
xml << "<node name=\"" << path << "\">";
|
||||
|
||||
InterfaceAdaptorTable::const_iterator iti;
|
||||
|
||||
|
@ -54,71 +61,72 @@ Message IntrospectableAdaptor::Introspect( const CallMessage& call )
|
|||
IntrospectedInterface* const intro = iti->second->introspect();
|
||||
if(intro)
|
||||
{
|
||||
Xml::Node& iface = iroot.add(Xml::Node("interface"));
|
||||
iface.set("name", intro->name);
|
||||
xml << "<interface name=\"" << intro->name << "\">";
|
||||
|
||||
for(const IntrospectedProperty* p = intro->properties; p->name; ++p)
|
||||
{
|
||||
Xml::Node& property = iface.add(Xml::Node("property"));
|
||||
property.set("name", p->name);
|
||||
property.set("type", p->type);
|
||||
|
||||
std::string access;
|
||||
|
||||
if(p->read) access += "read";
|
||||
if(p->write) access += "write";
|
||||
|
||||
property.set("access", access);
|
||||
xml << "<property name=\"" << p->name << "\""
|
||||
<< " type=\"" << p->type << "\""
|
||||
<< " access=\"" << access << "\"/>";
|
||||
}
|
||||
|
||||
for(const IntrospectedMethod* m = intro->methods; m->args; ++m)
|
||||
{
|
||||
Xml::Node& method = iface.add(Xml::Node("method"));
|
||||
method.set("name", m->name);
|
||||
xml << "<method name=\"" << m->name << "\">";
|
||||
|
||||
for(const IntrospectedArgument* a = m->args; a->type; ++a)
|
||||
{
|
||||
Xml::Node& arg = method.add(Xml::Node("arg"));
|
||||
if(a->name) arg.set("name", a->name);
|
||||
arg.set("direction", a->in ? "in" : "out");
|
||||
arg.set("type", a->type);
|
||||
xml << "<arg direction=\"" << (a->in ? "in" : "out") << "\""
|
||||
<< " type=\"" << a->type << "\"";
|
||||
|
||||
if(a->name) xml << " name=\"" << a->name << "\"";
|
||||
|
||||
xml << "/>";
|
||||
}
|
||||
|
||||
xml << "</method>";
|
||||
}
|
||||
|
||||
for(const IntrospectedMethod* m = intro->signals; m->args; ++m)
|
||||
{
|
||||
Xml::Node& method = iface.add(Xml::Node("signal"));
|
||||
method.set("name", m->name);
|
||||
xml << "<signal name=\"" << m->name << "\">";
|
||||
|
||||
for(const IntrospectedArgument* a = m->args; a->type; ++a)
|
||||
{
|
||||
Xml::Node& arg = method.add(Xml::Node("arg"));
|
||||
if(a->name) arg.set("name", a->name);
|
||||
arg.set("type", a->type);
|
||||
xml << "<arg type=\"" << a->type << "\"";
|
||||
|
||||
if(a->name) xml << " name=\"" << a->name << "\"";
|
||||
|
||||
xml << "/>";
|
||||
}
|
||||
xml << "</signal>";
|
||||
}
|
||||
|
||||
xml << "</interface>";
|
||||
}
|
||||
}
|
||||
const std::string parent = object()->path();
|
||||
const ObjectAdaptorPList children = ObjectAdaptor::from_path_prefix(parent + '/');
|
||||
const ObjectAdaptorPList children = ObjectAdaptor::from_path_prefix(path + '/');
|
||||
|
||||
ObjectAdaptorPList::const_iterator oci;
|
||||
|
||||
for(oci = children.begin(); oci != children.end(); ++oci)
|
||||
{
|
||||
Xml::Node& subnode = iroot.add(Xml::Node("node"));
|
||||
|
||||
std::string name = (*oci)->path().substr(parent.length()+1);
|
||||
std::string name = (*oci)->path().substr(path.length()+1);
|
||||
name.substr(name.find('/'));
|
||||
|
||||
subnode.set("name", name);
|
||||
xml << "<node name=\"" << name << "\"/>";
|
||||
}
|
||||
|
||||
std::string xml = DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE + iroot.to_xml();
|
||||
xml << "</node>";
|
||||
|
||||
ReturnMessage reply(call);
|
||||
MessageIter wi = reply.writer();
|
||||
wi.append_string(xml.c_str());
|
||||
wi.append_string(xml.str().c_str());
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
namespace DBus {
|
||||
|
||||
struct Message::Private
|
||||
struct DXXAPILOCAL Message::Private
|
||||
{
|
||||
DBusMessage* msg;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
namespace DBus {
|
||||
|
||||
struct PendingCall::Private
|
||||
struct DXXAPILOCAL PendingCall::Private
|
||||
{
|
||||
DBusPendingCall* call;
|
||||
int dataslot;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
namespace DBus {
|
||||
|
||||
struct Server::Private
|
||||
struct DXXAPILOCAL Server::Private
|
||||
{
|
||||
DBusServer* server;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ CXX = $(CXX_FOR_BUILD)
|
|||
|
||||
AM_CPPFLAGS = \
|
||||
$(dbus_CFLAGS) \
|
||||
$(xml_CFLAGS) \
|
||||
-I$(top_srcdir)/include
|
||||
|
||||
if CROSS_COMPILING
|
||||
|
@ -14,7 +15,7 @@ endif
|
|||
|
||||
bin_PROGRAMS = dbusxx-xml2cpp dbusxx-introspect
|
||||
|
||||
dbusxx_xml2cpp_SOURCES = xml2cpp.h xml2cpp.cpp
|
||||
dbusxx_xml2cpp_SOURCES = xml.h xml.cpp xml2cpp.h xml2cpp.cpp
|
||||
dbusxx_xml2cpp_LDADD = $(libdbus_cxx_la)
|
||||
|
||||
dbusxx_introspect_SOURCES = introspect.h introspect.cpp
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <dbus-c++/xml.h>
|
||||
#include "xml.h"
|
||||
|
||||
#include <dbus-c++/debug.h>
|
||||
|
||||
#include <expat.h>
|
|
@ -32,4 +32,6 @@
|
|||
#include <dbus-c++/dbus.h>
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include "xml.h"
|
||||
|
||||
#endif//__DBUSXX_TOOLS_XML2CPP_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue