author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 19 Feb 2010 23:40:16 +0200 | |
branch | RCL_3 |
changeset 4 | 3b1da2848fc7 |
parent 0 | 1918ee327afb |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtCore module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
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 |
||
71 |
#include <ApplicationServices/ApplicationServices.h> |
|
72 |
||
73 |
#undef DEBUG |
|
74 |
#ifdef OLD_DEBUG |
|
75 |
# define DEBUG OLD_DEBUG |
|
76 |
# undef OLD_DEBUG |
|
77 |
#endif |
|
78 |
||
79 |
#ifdef old_qDebug |
|
80 |
# undef qDebug |
|
81 |
# define qDebug QT_NO_QDEBUG_MACRO |
|
82 |
# undef old_qDebug |
|
83 |
#endif |
|
84 |
||
85 |
#include "qstring.h" |
|
86 |
||
87 |
QT_BEGIN_NAMESPACE |
|
88 |
||
89 |
/* |
|
90 |
Helper class that automates refernce counting for CFtypes. |
|
91 |
After constructing the QCFType object, it can be copied like a |
|
92 |
value-based type. |
|
93 |
||
94 |
Note that you must own the object you are wrapping. |
|
95 |
This is typically the case if you get the object from a Core |
|
96 |
Foundation function with the word "Create" or "Copy" in it. If |
|
97 |
you got the object from a "Get" function, either retain it or use |
|
98 |
constructFromGet(). One exception to this rule is the |
|
99 |
HIThemeGet*Shape functions, which in reality are "Copy" functions. |
|
100 |
*/ |
|
101 |
template <typename T> |
|
102 |
class Q_CORE_EXPORT QCFType |
|
103 |
{ |
|
104 |
public: |
|
105 |
inline QCFType(const T &t = 0) : type(t) {} |
|
106 |
inline QCFType(const QCFType &helper) : type(helper.type) { if (type) CFRetain(type); } |
|
107 |
inline ~QCFType() { if (type) CFRelease(type); } |
|
108 |
inline operator T() { return type; } |
|
109 |
inline QCFType operator =(const QCFType &helper) |
|
110 |
{ |
|
111 |
if (helper.type) |
|
112 |
CFRetain(helper.type); |
|
113 |
CFTypeRef type2 = type; |
|
114 |
type = helper.type; |
|
115 |
if (type2) |
|
116 |
CFRelease(type2); |
|
117 |
return *this; |
|
118 |
} |
|
119 |
inline T *operator&() { return &type; } |
|
120 |
static QCFType constructFromGet(const T &t) |
|
121 |
{ |
|
122 |
CFRetain(t); |
|
123 |
return QCFType<T>(t); |
|
124 |
} |
|
125 |
protected: |
|
126 |
T type; |
|
127 |
}; |
|
128 |
||
129 |
class Q_CORE_EXPORT QCFString : public QCFType<CFStringRef> |
|
130 |
{ |
|
131 |
public: |
|
132 |
inline QCFString(const QString &str) : QCFType<CFStringRef>(0), string(str) {} |
|
133 |
inline QCFString(const CFStringRef cfstr = 0) : QCFType<CFStringRef>(cfstr) {} |
|
134 |
inline QCFString(const QCFType<CFStringRef> &other) : QCFType<CFStringRef>(other) {} |
|
135 |
operator QString() const; |
|
136 |
operator CFStringRef() const; |
|
137 |
static QString toQString(CFStringRef cfstr); |
|
138 |
static CFStringRef toCFStringRef(const QString &str); |
|
139 |
private: |
|
140 |
QString string; |
|
141 |
}; |
|
142 |
||
143 |
QT_END_NAMESPACE |
|
144 |
||
145 |
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5) |
|
146 |
#ifndef __LP64__ |
|
147 |
typedef float CGFloat; |
|
148 |
typedef int NSInteger; |
|
149 |
typedef unsigned int NSUInteger; |
|
150 |
#define SRefCon SInt32 |
|
151 |
#define URefCon UInt32 |
|
152 |
#endif |
|
153 |
#endif |
|
154 |
||
155 |
#endif // QCORE_MAC_P_H |