QtGStreamer 1.2.0
Loading...
Searching...
No Matches
wrap.h
1/*
2 Copyright (C) 2010 Collabora Ltd. <info@collabora.co.uk>
3 @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
4
5 This library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published
7 by the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef QGLIB_WRAP_H
19#define QGLIB_WRAP_H
20
21#include "global.h"
22
23namespace QGlib {
24
25class RefCountedObject;
26class Type;
27
37QTGLIB_EXPORT RefCountedObject *constructWrapper(Type instanceType, void *instance);
38
39template <typename T, typename Enable = void>
40struct WrapImpl {};
41
42#define QGLIB_REGISTER_WRAPIMPL_FOR_SUBCLASSES_OF(BaseClass, WrapFunc) \
43 namespace QGlib { \
44 template <typename T> \
45 struct WrapImpl<T, typename boost::enable_if< boost::is_base_of<BaseClass, T> >::type > \
46 { \
47 static inline RefCountedObject *wrap(typename T::CType *object) \
48 { \
49 return WrapFunc(object); \
50 } \
51 }; \
52 } //namespace QGlib
53
54#define QGLIB_REGISTER_INTERFACE(IfaceClass) \
55 namespace QGlib { \
56 template <> \
57 struct WrapImpl<IfaceClass, void> \
58 { \
59 static inline RefCountedObject *wrap(IfaceClass::CType *object) \
60 { \
61 return Private::wrapInterface(GetType<IfaceClass>(), object); \
62 } \
63 }; \
64 } //namespace QGlib
65
66namespace Private {
67
68QTGLIB_EXPORT RefCountedObject *wrapObject(void *gobject);
69QTGLIB_EXPORT RefCountedObject *wrapParamSpec(void *param);
70QTGLIB_EXPORT RefCountedObject *wrapInterface(Type interfaceType, void *gobject);
71
72} //namespace Private
73} //namespace QGlib
74
75
76#endif // QGLIB_WRAP_H
Wrappers for Glib and GObject classes.
RefCountedObject * constructWrapper(Type instanceType, void *instance)
Definition wrap.cpp:24