3
* Copyright (C) 2009 Yandex LLC (Michail Pishchagin)
4
* based on http://doc.trolltech.com/solutions/4/qtspellcheckingtextedit/
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
#ifndef PRIVATEQT_MAC_H
23
#define PRIVATEQT_MAC_H
25
#include <CoreFoundation/CoreFoundation.h>
26
#include <QtCore/QString>
32
inline QtCFType(const T &t = 0) : type(t) {}
33
inline QtCFType(const QtCFType &helper) : type(helper.type) {
34
if (type) CFRetain(type);
37
if (type) CFRelease(type);
42
inline QtCFType operator=(const QtCFType &helper) {
44
CFRetain(helper.type);
45
CFTypeRef type2 = type;
51
inline T *operator&() {
54
static QtCFType constructFromGet(const T &t) {
56
return QtCFType<T>(t);
62
class QtCFString : public QtCFType<CFStringRef>
65
inline QtCFString(const QString &str) : QtCFType<CFStringRef>(0), string(str) {}
66
inline QtCFString(const CFStringRef cfstr = 0) : QtCFType<CFStringRef>(cfstr) {}
67
inline QtCFString(const QtCFType<CFStringRef> &other) : QtCFType<CFStringRef>(other) {}
68
operator QString() const;
69
operator CFStringRef() const;
70
static QString toQString(CFStringRef cfstr);
71
static CFStringRef toCFStringRef(const QString &str);
76
class QtMacCocoaAutoReleasePool
81
QtMacCocoaAutoReleasePool();
82
~QtMacCocoaAutoReleasePool();
84
inline void *handle() const {
90
typedef struct _NSRange NSRange;