From a1a605a3419961d6af073d346e88c58e7536681e Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Wed, 2 Jan 2013 18:14:12 +0100 Subject: [PATCH] dptr: add ability to export the proxy class elam: make it work on win32, remove version number --- dptr/dptr_base.h | 31 +++++++++++++++++++++++-------- include/elamcharclass.h | 2 +- include/elamengine.h | 2 +- src/elam.pro | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/dptr/dptr_base.h b/dptr/dptr_base.h index 85f2e52..fde8265 100644 --- a/dptr/dptr_base.h +++ b/dptr/dptr_base.h @@ -1,6 +1,6 @@ //d-ptr header // -// (c) Konrad Rosenbaum, 2010-2011 +// (c) Konrad Rosenbaum, 2010-2013 // Copying and distribution of this file, with or without modification, // are permitted in any medium without royalty provided the copyright // notice and this notice are preserved. This file is offered as-is, @@ -56,11 +56,16 @@ You can use DEFINE_DPTR to define the necessary methods for a non-shared d-point The d-pointer class Private is only forward declared, you have to fully declare and implement it in the code where you are using it, i.e. where you are implementing the containing class. -\param dp name of the d-pointer*/ -#define DECLARE_DPTR(dp) \ +Use the DECLARE_DPTRX version if your surrounding class is part of a library's exported API. + +\param dp name of the d-pointer +\param export_spec use Q_DECL_EXPORT or Q_DECL_IMPORT to signal public API export or import +*/ +#define DECLARE_DPTR(dp) DECLARE_DPTRX(dp,) +#define DECLARE_DPTRX(dp,export_spec) \ private:\ class Private; \ - class DPrivate{\ + class export_spec DPrivate{\ public:DPrivate();DPrivate(const DPrivate&);~DPrivate();\ DPrivate&operator=(const DPrivate&);\ const Private*operator->()const{return d;}\ @@ -93,8 +98,13 @@ The d-pointer class Private is only forward declared, you have to fully declare Warning: shared d-pointers are not thread safe and they are only re-entrant if instances sharing the same d-pointer are only located in one thread, while instances with different d-pointers may be spread over different threads. -\param dp name of the d-pointer*/ +Use the DECLARE_SHARED_DPTRX version if your surrounding class is part of a library's exported API. + +\param dp name of the d-pointer +\param export_spec use Q_DECL_EXPORT or Q_DECL_IMPORT to signal public API export or import +*/ #define DECLARE_SHARED_DPTR(dp) DECLARE_DPTR(dp) +#define DECLARE_SHARED_DPTRX(dp,export_spec) DECLARE_DPTRX(dp,export_spec) #ifdef DECLARE_NONCOPY_DPTR @@ -118,11 +128,16 @@ You can use DEFINE_NONCOPY_DPTR to define the necessary methods for a non-shared The d-pointer class Private is only forward declared, you have to fully declare and implement it in the code where you are using it, i.e. where you are implementing the containing class. -\param dp name of the d-pointer*/ -#define DECLARE_NONCOPY_DPTR(dp) \ +Use the DECLARE_NONCOPY_DPTRX version if your surrounding class is part of a library's exported API. + +\param dp name of the d-pointer +\param export_spec use Q_DECL_EXPORT or Q_DECL_IMPORT to signal public API export or import +*/ +#define DECLARE_NONCOPY_DPTR(dp) DECLARE_NONCOPY_DPTRX(dp,) +#define DECLARE_NONCOPY_DPTRX(dp,export_spec) \ private:\ class Private; \ - class DPrivate{\ + class export_spec DPrivate{\ public:DPrivate();~DPrivate();\ const Private*operator->()const{return d;}\ Private*operator->(){return d;}\ diff --git a/include/elamcharclass.h b/include/elamcharclass.h index c08bcd5..bda9fd8 100644 --- a/include/elamcharclass.h +++ b/include/elamcharclass.h @@ -50,7 +50,7 @@ None of these three classes may overlap. There are several more minor classes: */ class ELAM_EXPORT CharacterClassSettings { - DECLARE_SHARED_DPTR(d) + DECLARE_SHARED_DPTRX(d,ELAM_EXPORT) public: ///class of operator characters QString operatorClass()const; diff --git a/include/elamengine.h b/include/elamengine.h index 1dab137..35e9054 100644 --- a/include/elamengine.h +++ b/include/elamengine.h @@ -89,7 +89,7 @@ Methods of this class are used to evaluate expressions into final values. class ELAM_EXPORT Engine:public QObject { Q_OBJECT - DECLARE_DPTR(d); + DECLARE_DPTRX(d,ELAM_EXPORT); public: ///instantiates an engine object explicit Engine(QObject*parent=0); diff --git a/src/elam.pro b/src/elam.pro index d07e3cd..18b4ad6 100644 --- a/src/elam.pro +++ b/src/elam.pro @@ -7,7 +7,7 @@ OBJECTS_DIR = .ctmp MOC_DIR = .ctmp RCC_DIR = .ctmp DEFINES += ELAM_LIBRARY_BUILD -VERSION = 0.3.0 +VERSION = HEADERS += \ ../include/elam.h \ -- 1.7.2.5