global.h

00001 /*
00002     Copyright (C) 2009-2010  George Kiagiadakis <kiagiadakis.george@gmail.com>
00003 
00004     This library is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU Lesser General Public License as published
00006     by the Free Software Foundation; either version 2.1 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU Lesser General Public License
00015     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 */
00017 #ifndef QGLIB_GLOBAL_H
00018 #define QGLIB_GLOBAL_H
00019 
00020 #include <QtCore/QtGlobal>
00021 #include <boost/config.hpp>
00022 
00023 /* defined by cmake when building this library */
00024 #if defined(QtGLib_EXPORTS)
00025 # define QTGLIB_EXPORT Q_DECL_EXPORT
00026 #else
00027 # define QTGLIB_EXPORT Q_DECL_IMPORT
00028 #endif
00029 
00030 #if !defined(Q_OS_WIN) && !defined(Q_CC_NOKIAX86) && \
00031     !defined(Q_CC_RVCT) && defined(QT_VISIBILITY_AVAILABLE)
00032 # define QTGLIB_NO_EXPORT __attribute__((visibility("hidden")))
00033 #else
00034 # define QTGLIB_NO_EXPORT
00035 #endif
00036 
00037 typedef struct _GValue GValue;
00038 typedef struct _GParamSpec GParamSpec;
00039 typedef struct _GClosure GClosure;
00040 typedef struct _GObject GObject;
00041 typedef struct _GError GError;
00042 
00043 namespace QGlib {
00044 
00045 class Error;
00046 class Value;
00047 class Quark;
00048 class Type;
00049 class Signal;
00050 class SignalHandler;
00051 template <class T> class RefPointer;
00052 class ParamSpec;
00053 typedef RefPointer<ParamSpec> ParamSpecPtr;
00054 class Object;
00055 typedef RefPointer<Object> ObjectPtr;
00056 
00057 } //namespace QGlib
00058 
00059 
00060 #define QGLIB_WRAPPER_DECLARATION_MACRO(CppClass, CClass, CNamespace, FakeSuperClass) \
00061     public: \
00062         typedef CNamespace##CClass CType; \
00063     protected: \
00064         CppClass() {} \
00065         CppClass(const CppClass &); \
00066         CppClass & operator=(const CppClass &); \
00067         ~CppClass() {} \
00068         friend QGlib::RefCountedObject* FakeSuperClass##_new(void*); \
00069     private:
00070 
00071 #define QGLIB_WRAPPER(Class) \
00072     QGLIB_WRAPPER_DECLARATION_MACRO(Class, Class, G, Class)
00073 
00074 #define QGLIB_WRAPPER_DIFFERENT_C_CLASS(Class, CClass) \
00075     QGLIB_WRAPPER_DECLARATION_MACRO(Class, CClass, G, Class)
00076 
00077 
00078 #if !defined(BOOST_NO_STATIC_ASSERT) //we have c++0x static_assert
00079 # define QGLIB_STATIC_ASSERT(expr, message) static_assert(expr, message)
00080 # define QGLIB_HAVE_CXX0X_STATIC_ASSERT 1
00081 #else
00082 # include <boost/static_assert.hpp>
00083 # define QGLIB_STATIC_ASSERT(expr, message) BOOST_STATIC_ASSERT(expr)
00084 #endif
00085 
00086 //check for the C++0x features that we need
00087 #if !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_NO_RVALUE_REFERENCES)
00088 # define QGLIB_HAVE_CXX0X 1
00089 #else
00090 # define QGLIB_HAVE_CXX0X 0
00091 #endif
00092 
00093 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator