Qt 4.8
Classes | Macros | Functions
qcore_mac_p.h File Reference
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#include "qstring.h"

Go to the source code of this file.

Classes

class  QCFString
 
class  QCFType< T >
 

Macros

#define __IMAGECAPTURE__
 
#define DEBUG   0
 

Functions

Q_CORE_EXPORT OSErr qt_mac_create_fsref (const QString &file, FSRef *fsref)
 
Q_CORE_EXPORT OSErr qt_mac_create_fsspec (const QString &file, FSSpec *spec)
 
Q_CORE_EXPORT QString qt_mac_from_pascal_string (const Str255 pstr)
 
Q_CORE_EXPORT void qt_mac_to_pascal_string (const QString &s, Str255 str, TextEncoding encoding=0, int len=-1)
 

Macro Definition Documentation

◆ __IMAGECAPTURE__

#define __IMAGECAPTURE__

Definition at line 57 of file qcore_mac_p.h.

◆ DEBUG

#define DEBUG   0

Definition at line 65 of file qcore_mac_p.h.

Function Documentation

◆ qt_mac_create_fsref()

Q_CORE_EXPORT OSErr qt_mac_create_fsref ( const QString file,
FSRef *  fsref 
)

Definition at line 125 of file qcore_mac.cpp.

Referenced by QFileDialogPrivate::createNavServicesDialog(), qt_mac_create_fsspec(), registerFont(), QFileDialogPrivate::selectFile_sys(), and QFileDialogPrivate::setDirectory_sys().

126 {
127  return FSPathMakeRef(reinterpret_cast<const UInt8 *>(file.toUtf8().constData()), fsref, 0);
128 }
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
Definition: qstring.cpp:4074
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ qt_mac_create_fsspec()

Q_CORE_EXPORT OSErr qt_mac_create_fsspec ( const QString file,
FSSpec *  spec 
)

Definition at line 131 of file qcore_mac.cpp.

Referenced by registerFont().

132 {
133  FSRef fsref;
134  OSErr ret = qt_mac_create_fsref(file, &fsref);
135  if (ret == noErr)
136  ret = FSGetCatalogInfo(&fsref, kFSCatInfoNone, 0, 0, spec, 0);
137  return ret;
138 }
OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref)
Definition: qcore_mac.cpp:125

◆ qt_mac_from_pascal_string()

Q_CORE_EXPORT QString qt_mac_from_pascal_string ( const Str255  pstr)

Definition at line 120 of file qcore_mac.cpp.

Referenced by qfontForThemeFont().

121 {
122  return QCFString(CFStringCreateWithPascalString(0, pstr, CFStringGetSystemEncoding()));
123 }

◆ qt_mac_to_pascal_string()

Q_CORE_EXPORT void qt_mac_to_pascal_string ( const QString s,
Str255  str,
TextEncoding  encoding = 0,
int  len = -1 
)

Definition at line 91 of file qcore_mac.cpp.

Referenced by QFileDialogPrivate::selectFile_sys().

92 {
93  if(len == -1)
94  len = s.length();
95 #if 0
96  UnicodeMapping mapping;
97  mapping.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault,
98  kTextEncodingDefaultVariant,
99  kUnicode16BitFormat);
100  mapping.otherEncoding = (encoding ? encoding : );
101  mapping.mappingVersion = kUnicodeUseLatestMapping;
102 
103  UnicodeToTextInfo info;
104  OSStatus err = CreateUnicodeToTextInfo(&mapping, &info);
105  if(err != noErr) {
106  qDebug("Qt: internal: Unable to create pascal string '%s'::%d [%ld]",
107  s.left(len).latin1(), (int)encoding, err);
108  return;
109  }
110  const int unilen = len * 2;
111  const UniChar *unibuf = (UniChar *)s.unicode();
112  ConvertFromUnicodeToPString(info, unilen, unibuf, str);
113  DisposeUnicodeToTextInfo(&info);
114 #else
115  Q_UNUSED(encoding);
116  CFStringGetPascalString(QCFString(s), str, 256, CFStringGetSystemEncoding());
117 #endif
118 }
static mach_timebase_info_data_t info
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
Q_CORE_EXPORT void qDebug(const char *,...)
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
const QChar * unicode() const
Returns a &#39;\0&#39;-terminated Unicode representation of the string.
Definition: qstring.h:706
signed long OSStatus
static QMap< QByteArray, int > mapping
Definition: qaxserver.cpp:577
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729