| e5fcad3 by Lars Knoll at 2009-03-23 |
1 |
/**************************************************************************** |
|
2 |
** |
| 89c08c0 by Jason McDonald at 2012-01-11 |
3 |
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). |
| 04e3b30 by Jason McDonald at 2009-09-09 |
4 |
** All rights reserved. |
| 858c70f by Jason McDonald at 2009-06-16 |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
| e5fcad3 by Lars Knoll at 2009-03-23 |
6 |
** |
|
7 |
** This file is part of the QtCore module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** GNU Lesser General Public License Usage |
| 1eea52e by Jyri Tahtela at 2011-05-13 |
11 |
** This file may be used under the terms of the GNU Lesser General Public |
|
12 |
** License version 2.1 as published by the Free Software Foundation and |
|
13 |
** appearing in the file LICENSE.LGPL included in the packaging of this |
|
14 |
** file. Please review the following information to ensure the GNU Lesser |
|
15 |
** General Public License version 2.1 requirements will be met: |
|
16 |
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| e5fcad3 by Lars Knoll at 2009-03-23 |
17 |
** |
| 04e3b30 by Jason McDonald at 2009-09-09 |
18 |
** In addition, as a special exception, Nokia gives you certain additional |
| 1eea52e by Jyri Tahtela at 2011-05-13 |
19 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
| 04e3b30 by Jason McDonald at 2009-09-09 |
20 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| e5fcad3 by Lars Knoll at 2009-03-23 |
21 |
** |
| 1eea52e by Jyri Tahtela at 2011-05-13 |
22 |
** GNU General Public License Usage |
|
23 |
** Alternatively, this file may be used under the terms of the GNU General |
|
24 |
** Public License version 3.0 as published by the Free Software Foundation |
|
25 |
** and appearing in the file LICENSE.GPL included in the packaging of this |
|
26 |
** file. Please review the following information to ensure the GNU General |
|
27 |
** Public License version 3.0 requirements will be met: |
|
28 |
** http://www.gnu.org/copyleft/gpl.html. |
|
29 |
** |
|
30 |
** Other Usage |
|
31 |
** Alternatively, this file may be used in accordance with the terms and |
|
32 |
** conditions contained in a signed written agreement between you and Nokia. |
| 309db73 by Jason McDonald at 2009-08-31 |
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
| e5fcad3 by Lars Knoll at 2009-03-23 |
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
|
|
42 |
#ifndef QCORE_MAC_P_H |
|
43 |
#define QCORE_MAC_P_H |
|
44 |
|
|
45 |
// |
|
46 |
// W A R N I N G |
|
47 |
// ------------- |
|
48 |
// |
|
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. |
|
52 |
// |
|
53 |
// We mean it. |
|
54 |
// |
|
55 |
|
|
56 |
#ifndef __IMAGECAPTURE__ |
|
57 |
# define __IMAGECAPTURE__ |
|
58 |
#endif |
|
59 |
|
|
60 |
#undef OLD_DEBUG |
|
61 |
#ifdef DEBUG |
|
62 |
# define OLD_DEBUG DEBUG |
|
63 |
# undef DEBUG |
|
64 |
#endif |
|
65 |
#define DEBUG 0 |
|
66 |
#ifdef qDebug |
|
67 |
# define old_qDebug qDebug |
|
68 |
# undef qDebug |
|
69 |
#endif |
|
70 |
|
| b895d7a by Morten Johan Sørvig at 2010-10-20 |
71 |
#if defined(QT_BUILD_QMAKE) || defined(QT_BOOTSTRAPPED) |
| e5fcad3 by Lars Knoll at 2009-03-23 |
72 |
#include <ApplicationServices/ApplicationServices.h> |
| b895d7a by Morten Johan Sørvig at 2010-10-20 |
73 |
#else |
|
74 |
#include <CoreFoundation/CoreFoundation.h> |
|
75 |
#endif |
|
76 |
|
|
77 |
#ifndef QT_NO_CORESERVICES |
|
78 |
#include <CoreServices/CoreServices.h> |
|
79 |
#endif |
| e5fcad3 by Lars Knoll at 2009-03-23 |
80 |
|
|
81 |
#undef DEBUG |
|
82 |
#ifdef OLD_DEBUG |
|
83 |
# define DEBUG OLD_DEBUG |
|
84 |
# undef OLD_DEBUG |
|
85 |
#endif |
|
86 |
|
|
87 |
#ifdef old_qDebug |
|
88 |
# undef qDebug |
|
89 |
# define qDebug QT_NO_QDEBUG_MACRO |
|
90 |
# undef old_qDebug |
|
91 |
#endif |
|
92 |
|
|
93 |
#include "qstring.h" |
|
94 |
|
|
95 |
QT_BEGIN_NAMESPACE |
|
96 |
|
|
97 |
/* |
|
98 |
Helper class that automates refernce counting for CFtypes. |
|
99 |
After constructing the QCFType object, it can be copied like a |
|
100 |
value-based type. |
|
101 |
|
|
102 |
Note that you must own the object you are wrapping. |
|
103 |
This is typically the case if you get the object from a Core |
|
104 |
Foundation function with the word "Create" or "Copy" in it. If |
|
105 |
you got the object from a "Get" function, either retain it or use |
|
106 |
constructFromGet(). One exception to this rule is the |
|
107 |
HIThemeGet*Shape functions, which in reality are "Copy" functions. |
|
108 |
*/ |
|
109 |
template <typename T> |
|
110 |
class Q_CORE_EXPORT QCFType |
|
111 |
{ |
|
112 |
public: |
|
113 |
inline QCFType(const T &t = 0) : type(t) {} |
|
114 |
inline QCFType(const QCFType &helper) : type(helper.type) { if (type) CFRetain(type); } |
|
115 |
inline ~QCFType() { if (type) CFRelease(type); } |
|
116 |
inline operator T() { return type; } |
|
117 |
inline QCFType operator =(const QCFType &helper) |
|
118 |
{ |
|
119 |
if (helper.type) |
|
120 |
CFRetain(helper.type); |
|
121 |
CFTypeRef type2 = type; |
|
122 |
type = helper.type; |
|
123 |
if (type2) |
|
124 |
CFRelease(type2); |
|
125 |
return *this; |
|
126 |
} |
|
127 |
inline T *operator&() { return &type; } |
|
128 |
static QCFType constructFromGet(const T &t) |
|
129 |
{ |
|
130 |
CFRetain(t); |
|
131 |
return QCFType<T>(t); |
|
132 |
} |
|
133 |
protected: |
|
134 |
T type; |
|
135 |
}; |
|
136 |
|
|
137 |
class Q_CORE_EXPORT QCFString : public QCFType<CFStringRef> |
|
138 |
{ |
|
139 |
public: |
|
140 |
inline QCFString(const QString &str) : QCFType<CFStringRef>(0), string(str) {} |
|
141 |
inline QCFString(const CFStringRef cfstr = 0) : QCFType<CFStringRef>(cfstr) {} |
|
142 |
inline QCFString(const QCFType<CFStringRef> &other) : QCFType<CFStringRef>(other) {} |
|
143 |
operator QString() const; |
|
144 |
operator CFStringRef() const; |
|
145 |
static QString toQString(CFStringRef cfstr); |
|
146 |
static CFStringRef toCFStringRef(const QString &str); |
|
147 |
private: |
|
148 |
QString string; |
|
149 |
}; |
|
150 |
|
| 604279b by con at 2011-06-28 |
151 |
|
|
152 |
#ifndef QT_NO_CORESERVICES |
| 2cb398e by Ritt Konstantin at 2011-06-09 |
153 |
Q_CORE_EXPORT void qt_mac_to_pascal_string(const QString &s, Str255 str, TextEncoding encoding = 0, int len = -1); |
|
154 |
Q_CORE_EXPORT QString qt_mac_from_pascal_string(const Str255 pstr); |
|
155 |
|
|
156 |
Q_CORE_EXPORT OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref); |
|
157 |
// Don't use this function, it won't work in 10.5 (Leopard) and up |
|
158 |
Q_CORE_EXPORT OSErr qt_mac_create_fsspec(const QString &file, FSSpec *spec); |
| 604279b by con at 2011-06-28 |
159 |
#endif // QT_NO_CORESERVICES |
| 2cb398e by Ritt Konstantin at 2011-06-09 |
160 |
|
| e5fcad3 by Lars Knoll at 2009-03-23 |
161 |
QT_END_NAMESPACE |
|
162 |
|
|
163 |
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5) |
|
164 |
#ifndef __LP64__ |
|
165 |
typedef float CGFloat; |
|
166 |
typedef int NSInteger; |
|
167 |
typedef unsigned int NSUInteger; |
|
168 |
#define SRefCon SInt32 |
|
169 |
#define URefCon UInt32 |
|
170 |
#endif |
|
171 |
#endif |
|
172 |
|
|
173 |
#endif // QCORE_MAC_P_H |