|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
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_SYMBIAN_P_H |
|
43 #define QCORE_SYMBIAN_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 #include <e32std.h> |
|
57 #include <QtCore/qglobal.h> |
|
58 #include <qstring.h> |
|
59 #include <qrect.h> |
|
60 #include <qhash.h> |
|
61 #include <f32file.h> |
|
62 |
|
63 QT_BEGIN_HEADER |
|
64 |
|
65 QT_BEGIN_NAMESPACE |
|
66 |
|
67 Q_CORE_EXPORT HBufC* qt_QString2HBufC(const QString& aString); |
|
68 |
|
69 Q_CORE_EXPORT QString qt_TDesC2QString(const TDesC& aDescriptor); |
|
70 inline QString qt_TDes2QString(const TDes& aDescriptor) { return qt_TDesC2QString(aDescriptor); } |
|
71 |
|
72 static inline QSize qt_TSize2QSize(const TSize& ts) |
|
73 { |
|
74 return QSize(ts.iWidth, ts.iHeight); |
|
75 } |
|
76 |
|
77 static inline TSize qt_QSize2TSize(const QSize& qs) |
|
78 { |
|
79 return TSize(qs.width(), qs.height()); |
|
80 } |
|
81 |
|
82 static inline QRect qt_TRect2QRect(const TRect& tr) |
|
83 { |
|
84 return QRect(tr.iTl.iX, tr.iTl.iY, tr.Width(), tr.Height()); |
|
85 } |
|
86 |
|
87 static inline TRect qt_QRect2TRect(const QRect& qr) |
|
88 { |
|
89 return TRect(TPoint(qr.left(), qr.top()), TSize(qr.width(), qr.height())); |
|
90 } |
|
91 |
|
92 // Returned TPtrC is valid as long as the given parameter is valid and unmodified |
|
93 static inline TPtrC qt_QString2TPtrC( const QString& string ) |
|
94 { |
|
95 return TPtrC16(static_cast<const TUint16*>(string.utf16()), string.length()); |
|
96 } |
|
97 |
|
98 /*! |
|
99 \internal |
|
100 This class is a wrapper around the Symbian HBufC descriptor class. |
|
101 It makes sure that the heap allocated HBufC class is freed when it is |
|
102 destroyed. |
|
103 */ |
|
104 class Q_CORE_EXPORT QHBufC |
|
105 { |
|
106 public: |
|
107 QHBufC(); |
|
108 QHBufC(const QHBufC &src); |
|
109 QHBufC(HBufC *src); |
|
110 QHBufC(const QString &src); |
|
111 ~QHBufC(); |
|
112 |
|
113 inline operator HBufC *() { return m_hBufC; } |
|
114 inline operator const HBufC *() const { return m_hBufC; } |
|
115 inline HBufC *data() { return m_hBufC; } |
|
116 inline const HBufC *data() const { return m_hBufC; } |
|
117 inline HBufC & operator*() { return *m_hBufC; } |
|
118 inline const HBufC & operator*() const { return *m_hBufC; } |
|
119 inline HBufC * operator->() { return m_hBufC; } |
|
120 inline const HBufC * operator->() const { return m_hBufC; } |
|
121 |
|
122 inline bool operator==(const QHBufC ¶m) const { return data() == param.data(); } |
|
123 inline bool operator!=(const QHBufC ¶m) const { return data() != param.data(); } |
|
124 |
|
125 private: |
|
126 HBufC *m_hBufC; |
|
127 }; |
|
128 |
|
129 inline uint qHash(TUid uid) |
|
130 { |
|
131 return qHash(uid.iUid); |
|
132 } |
|
133 |
|
134 // S60 version specific function ordinals that can be resolved |
|
135 enum S60PluginFuncOrdinals |
|
136 { |
|
137 S60Plugin_TimeFormatL = 1, |
|
138 S60Plugin_GetTimeFormatSpec = 2, |
|
139 S60Plugin_GetLongDateFormatSpec = 3, |
|
140 S60Plugin_GetShortDateFormatSpec = 4, |
|
141 S60Plugin_LocalizedDirectoryName = 5, |
|
142 S60Plugin_GetSystemDrive = 6 |
|
143 }; |
|
144 |
|
145 Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal); |
|
146 |
|
147 Q_CORE_EXPORT RFs& qt_s60GetRFs(); |
|
148 |
|
149 // Defined in qlocale_symbian.cpp. |
|
150 Q_CORE_EXPORT QByteArray qt_symbianLocaleName(int code); |
|
151 |
|
152 QT_END_NAMESPACE |
|
153 |
|
154 QT_END_HEADER |
|
155 |
|
156 #endif //QCORE_SYMBIAN_P_H |