tools/assistant/lib/fulltextsearch/qclucene_global_p.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
       
     4 ** All rights reserved.
       
     5 **
       
     6 ** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     7 ** All rights reserved.
       
     8 **
       
     9 ** This file may be used under the terms of the GNU Lesser General Public
       
    10 ** License version 2.1 as published by the Free Software Foundation and
       
    11 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    12 ** Please review the following information to ensure the GNU Lesser General
       
    13 ** Public License version 2.1 requirements will be met:
       
    14 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    15 **
       
    16 ****************************************************************************/
       
    17 
       
    18 #ifndef QCLUCENE_GLOBAL_P_H
       
    19 #define QCLUCENE_GLOBAL_P_H
       
    20 
       
    21 //
       
    22 //  W A R N I N G
       
    23 //  -------------
       
    24 //
       
    25 // This file is not part of the Qt API. It exists for the convenience
       
    26 // of the help generator tools. This header file may change from version
       
    27 // to version without notice, or even be removed.
       
    28 //
       
    29 // We mean it.
       
    30 //
       
    31 
       
    32 #if !defined(_MSC_VER)
       
    33 #   include "qclucene-config_p.h"
       
    34 #endif
       
    35 
       
    36 #include <QtCore/QChar>
       
    37 #include <QtCore/QString>
       
    38 
       
    39 #if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
       
    40 #   if !defined(TCHAR)
       
    41 #       define TCHAR wchar_t
       
    42 #   endif
       
    43 #else
       
    44 #   include <windows.h>
       
    45 #endif
       
    46 
       
    47 QT_BEGIN_HEADER
       
    48 
       
    49 QT_BEGIN_NAMESPACE
       
    50 
       
    51 #if !defined(QT_SHARED) && !defined(QT_DLL)
       
    52 #   define QHELP_EXPORT
       
    53 #elif defined(QHELP_LIB)
       
    54 #   define QHELP_EXPORT Q_DECL_EXPORT
       
    55 #else
       
    56 #   define QHELP_EXPORT Q_DECL_IMPORT
       
    57 #endif
       
    58 
       
    59 //
       
    60 //  W A R N I N G
       
    61 //  -------------
       
    62 //
       
    63 // adjustments here, need to be done in 
       
    64 // QTDIR/src/3rdparty/clucene/src/CLucene/StdHeader.h as well
       
    65 //
       
    66 #if defined(_LUCENE_DONTIMPLEMENT_NS_MACROS)
       
    67 
       
    68 #elif !defined(DISABLE_NAMESPACE)
       
    69 #   ifdef QT_NAMESPACE
       
    70 #       define CL_NS_DEF(sub) namespace QT_NAMESPACE { namespace lucene{ namespace sub{
       
    71 #       define CL_NS_DEF2(sub,sub2) namespace QT_NAMESPACE { namespace lucene{ namespace sub{ namespace sub2 {
       
    72 
       
    73 #       define CL_NS_END }}}
       
    74 #       define CL_NS_END2 }}}}
       
    75 
       
    76 #       define CL_NS_USE(sub) using namespace QT_NAMESPACE::lucene::sub;
       
    77 #       define CL_NS_USE2(sub,sub2) using namespace QT_NAMESPACE::lucene::sub::sub2;
       
    78 
       
    79 #       define CL_NS(sub) QT_NAMESPACE::lucene::sub
       
    80 #       define CL_NS2(sub,sub2) QT_NAMESPACE::lucene::sub::sub2
       
    81 #   else
       
    82 #       define CL_NS_DEF(sub) namespace lucene{ namespace sub{
       
    83 #       define CL_NS_DEF2(sub,sub2) namespace lucene{ namespace sub{ namespace sub2 {
       
    84 
       
    85 #       define CL_NS_END }}
       
    86 #       define CL_NS_END2 }}}
       
    87 
       
    88 #       define CL_NS_USE(sub) using namespace lucene::sub;
       
    89 #       define CL_NS_USE2(sub,sub2) using namespace lucene::sub::sub2;
       
    90 
       
    91 #       define CL_NS(sub) lucene::sub
       
    92 #       define CL_NS2(sub,sub2) lucene::sub::sub2
       
    93 #   endif
       
    94 #else
       
    95 #   define CL_NS_DEF(sub)
       
    96 #   define CL_NS_DEF2(sub, sub2)
       
    97 #   define CL_NS_END
       
    98 #   define CL_NS_END2
       
    99 #   define CL_NS_USE(sub)
       
   100 #   define CL_NS_USE2(sub,sub2)
       
   101 #   define CL_NS(sub)
       
   102 #   define CL_NS2(sub,sub2)
       
   103 #endif
       
   104 
       
   105 namespace {
       
   106     TCHAR* QStringToTChar(const QString &str)
       
   107     {
       
   108         TCHAR *string = new TCHAR[(str.length() +1) * sizeof(TCHAR)];
       
   109         memset(string, 0, (str.length() +1) * sizeof(TCHAR));
       
   110         #if defined(UNICODE) || defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
       
   111             str.toWCharArray(string);
       
   112         #else
       
   113             const QByteArray ba = str.toAscii();
       
   114             strcpy(string, ba.constData());
       
   115         #endif
       
   116         return string;
       
   117     }
       
   118 
       
   119     QString TCharToQString(const TCHAR *string)
       
   120     {
       
   121         #if defined(UNICODE) || defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
       
   122             QString retValue = QString::fromWCharArray(string);
       
   123             return retValue;
       
   124         #else
       
   125             return QString(QLatin1String(string));
       
   126         #endif
       
   127     }
       
   128 }
       
   129 
       
   130 QT_END_NAMESPACE
       
   131 
       
   132 QT_END_HEADER
       
   133 
       
   134 #endif // QCLUCENE_GLOBAL_P_H