1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QCLucene library and is distributable under
|
---|
7 | ** the terms of the LGPL license as specified in the license.txt file.
|
---|
8 | **
|
---|
9 | ****************************************************************************/
|
---|
10 |
|
---|
11 | #ifndef QCLUCENE_GLOBAL_P_H
|
---|
12 | #define QCLUCENE_GLOBAL_P_H
|
---|
13 |
|
---|
14 | //
|
---|
15 | // W A R N I N G
|
---|
16 | // -------------
|
---|
17 | //
|
---|
18 | // This file is not part of the Qt API. It exists for the convenience
|
---|
19 | // of the help generator tools. This header file may change from version
|
---|
20 | // to version without notice, or even be removed.
|
---|
21 | //
|
---|
22 | // We mean it.
|
---|
23 | //
|
---|
24 |
|
---|
25 | #if !defined(_MSC_VER)
|
---|
26 | # include "qclucene-config_p.h"
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | #include <QtCore/QChar>
|
---|
30 | #include <QtCore/QString>
|
---|
31 |
|
---|
32 | QT_BEGIN_HEADER
|
---|
33 |
|
---|
34 | QT_BEGIN_NAMESPACE
|
---|
35 |
|
---|
36 | #if !defined(QT_SHARED) && !defined(QT_DLL)
|
---|
37 | # define QHELP_EXPORT
|
---|
38 | #elif defined(QHELP_LIB)
|
---|
39 | # define QHELP_EXPORT Q_DECL_EXPORT
|
---|
40 | #else
|
---|
41 | # define QHELP_EXPORT Q_DECL_IMPORT
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | //
|
---|
45 | // W A R N I N G
|
---|
46 | // -------------
|
---|
47 | //
|
---|
48 | // adjustments here, need to be done in
|
---|
49 | // QTDIR/src/3rdparty/clucene/src/CLucene/StdHeader.h as well
|
---|
50 | //
|
---|
51 | #if defined(_LUCENE_DONTIMPLEMENT_NS_MACROS)
|
---|
52 |
|
---|
53 | #elif !defined(DISABLE_NAMESPACE)
|
---|
54 | # ifdef QT_NAMESPACE
|
---|
55 | # define CL_NS_DEF(sub) namespace QT_NAMESPACE { namespace lucene{ namespace sub{
|
---|
56 | # define CL_NS_DEF2(sub,sub2) namespace QT_NAMESPACE { namespace lucene{ namespace sub{ namespace sub2 {
|
---|
57 |
|
---|
58 | # define CL_NS_END }}}
|
---|
59 | # define CL_NS_END2 }}}}
|
---|
60 |
|
---|
61 | # define CL_NS_USE(sub) using namespace QT_NAMESPACE::lucene::sub;
|
---|
62 | # define CL_NS_USE2(sub,sub2) using namespace QT_NAMESPACE::lucene::sub::sub2;
|
---|
63 |
|
---|
64 | # define CL_NS(sub) QT_NAMESPACE::lucene::sub
|
---|
65 | # define CL_NS2(sub,sub2) QT_NAMESPACE::lucene::sub::sub2
|
---|
66 | # else
|
---|
67 | # define CL_NS_DEF(sub) namespace lucene{ namespace sub{
|
---|
68 | # define CL_NS_DEF2(sub,sub2) namespace lucene{ namespace sub{ namespace sub2 {
|
---|
69 |
|
---|
70 | # define CL_NS_END }}
|
---|
71 | # define CL_NS_END2 }}}
|
---|
72 |
|
---|
73 | # define CL_NS_USE(sub) using namespace lucene::sub;
|
---|
74 | # define CL_NS_USE2(sub,sub2) using namespace lucene::sub::sub2;
|
---|
75 |
|
---|
76 | # define CL_NS(sub) lucene::sub
|
---|
77 | # define CL_NS2(sub,sub2) lucene::sub::sub2
|
---|
78 | # endif
|
---|
79 | #else
|
---|
80 | # define CL_NS_DEF(sub)
|
---|
81 | # define CL_NS_DEF2(sub, sub2)
|
---|
82 | # define CL_NS_END
|
---|
83 | # define CL_NS_END2
|
---|
84 | # define CL_NS_USE(sub)
|
---|
85 | # define CL_NS_USE2(sub,sub2)
|
---|
86 | # define CL_NS(sub)
|
---|
87 | # define CL_NS2(sub,sub2)
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | #if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
|
---|
91 | # if !defined(TCHAR)
|
---|
92 | # define TCHAR wchar_t
|
---|
93 | # endif
|
---|
94 | #else
|
---|
95 | # include <windows.h>
|
---|
96 | #endif
|
---|
97 |
|
---|
98 | namespace {
|
---|
99 | TCHAR* QStringToTChar(const QString &str)
|
---|
100 | {
|
---|
101 | TCHAR *string = new TCHAR[(str.length() +1) * sizeof(TCHAR)];
|
---|
102 | memset(string, 0, (str.length() +1) * sizeof(TCHAR));
|
---|
103 | #if defined(UNICODE) || defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
|
---|
104 | str.toWCharArray(string);
|
---|
105 | #else
|
---|
106 | const QByteArray ba = str.toAscii();
|
---|
107 | strcpy(string, ba.constData());
|
---|
108 | #endif
|
---|
109 | return string;
|
---|
110 | }
|
---|
111 |
|
---|
112 | QString TCharToQString(const TCHAR *string)
|
---|
113 | {
|
---|
114 | #if defined(UNICODE) || defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
|
---|
115 | QString retValue = QString::fromWCharArray(string);
|
---|
116 | return retValue;
|
---|
117 | #else
|
---|
118 | return QString(QLatin1String(string));
|
---|
119 | #endif
|
---|
120 | }
|
---|
121 | }
|
---|
|
---|