1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtCore module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
49 // This file is not part of the Qt API. It exists for the convenience
50 // of other Qt classes. This header file may change from version to
51 // version without notice, or even be removed.
56 #ifndef __IMAGECAPTURE__
57 # define __IMAGECAPTURE__
62 # define OLD_DEBUG DEBUG
67 # define old_qDebug qDebug
71 #if defined(QT_BUILD_QMAKE) || defined(QT_BOOTSTRAPPED)
72 #include <ApplicationServices/ApplicationServices.h>
74 #include <CoreFoundation/CoreFoundation.h>
77 #ifndef QT_NO_CORESERVICES
78 #include <CoreServices/CoreServices.h>
82 #include <Foundation/Foundation.h>
87 # define DEBUG OLD_DEBUG
93 # define qDebug QT_NO_QDEBUG_MACRO
102 Helper class that automates refernce counting for CFtypes.
103 After constructing the QCFType object, it can be copied like a
106 Note that you must own the object you are wrapping.
107 This is typically the case if you get the object from a Core
108 Foundation function with the word "Create" or "Copy" in it. If
109 you got the object from a "Get" function, either retain it or use
110 constructFromGet(). One exception to this rule is the
111 HIThemeGet*Shape functions, which in reality are "Copy" functions.
113 template <typename T>
114 class Q_CORE_EXPORT QCFType
117 inline QCFType(const T &t = 0) : type(t) {}
118 inline QCFType(const QCFType &helper) : type(helper.type) { if (type) CFRetain(type); }
119 inline ~QCFType() { if (type) CFRelease(type); }
120 inline operator T() { return type; }
121 inline QCFType operator =(const QCFType &helper)
124 CFRetain(helper.type);
125 CFTypeRef type2 = type;
131 inline T *operator&() { return &type; }
132 static QCFType constructFromGet(const T &t)
135 return QCFType<T>(t);
141 class Q_CORE_EXPORT QCFString : public QCFType<CFStringRef>
144 inline QCFString(const QString &str) : QCFType<CFStringRef>(0), string(str) {}
145 inline QCFString(const CFStringRef cfstr = 0) : QCFType<CFStringRef>(cfstr) {}
146 inline QCFString(const QCFType<CFStringRef> &other) : QCFType<CFStringRef>(other) {}
147 operator QString() const;
148 operator CFStringRef() const;
149 static QString toQString(CFStringRef cfstr);
150 static CFStringRef toCFStringRef(const QString &str);
152 static QString toQString(const NSString *nsstr);
153 static NSString *toNSString(const QString &string);
162 #if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
164 typedef float CGFloat;
165 typedef int NSInteger;
166 typedef unsigned int NSUInteger;
167 #define SRefCon SInt32
168 #define URefCon UInt32
172 #endif // QCORE_MAC_P_H