kjsembed
kjseglobal.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KJSEGLOBAL_H
00024 #define KJSEGLOBAL_H
00025
00026 #include <kdemacros.h>
00027
00028 #if defined(Q_OS_WIN)
00029 # if (defined(KJSEMBED_DLL) && defined(KJSEMBED_MAKE_DLL)) || defined(MAKE_KJSEMBED_LIB)
00030 # define KJSEMBED_EXPORT KDE_EXPORT
00031 # else
00032 # define KJSEMBED_EXPORT KDE_IMPORT
00033 # endif
00034 #else
00035 # define KJSEMBED_EXPORT KDE_EXPORT
00036 #endif
00037
00038 #if !defined(Q_OS_WIN)
00039 #include <stdlib.h>
00040 #include <ctype.h>
00041
00042 KJSEMBED_EXPORT void RedirectIOToConsole();
00043
00044 #endif
00045
00046 #include <QtCore/QTextStream>
00047 namespace KJSEmbed {
00048 KJSEMBED_EXPORT QTextStream *conin();
00049 KJSEMBED_EXPORT QTextStream *conout();
00050 KJSEMBED_EXPORT QTextStream *conerr();
00051 }
00052
00053 #include <kjs/ustring.h>
00054 #include <kjs/identifier.h>
00055 #include <kjs/value.h>
00056
00057 namespace KJSEmbed {
00058 inline QString toQString(const KJS::UString& u)
00059 {
00060 return QString((QChar*)u.data(), u.size());
00061 }
00062 inline QString toQString(const KJS::Identifier& i)
00063 {
00064 return QString((QChar*)i.data(), i.size());
00065 }
00066 inline KJS::UString toUString(const QString& qs)
00067 {
00068 return KJS::UString((KJS::UChar*)qs.data(), qs.size());
00069 }
00070 }
00071
00072 namespace KJS {
00073 inline KJS::JSCell* jsString(const QString& s)
00074 {
00075 return jsString(KJSEmbed::toUString(s));
00076 }
00077 }
00078
00079 #ifndef QT_ONLY
00080
00081
00082
00083
00084
00085 #include <kdebug.h>
00086 #include <klocale.h>
00087
00088 #else // QT_ONLY
00089
00090
00091
00092
00093
00094 KJSEMBED_EXPORT QTextStream &kdDebug( int area=0 );
00095 KJSEMBED_EXPORT QTextStream &kdWarning( int area=0 );
00096
00097 #ifndef NO_I18N
00098 KJSEMBED_EXPORT QString i18n( const char *string );
00099 #else
00100 #define i18n(x) QString(x)
00101 #endif // NO_I18N
00102
00103 inline KJSEMBED_EXPORT QString i18n( const QString& string, const QString& comment )
00104 {
00105 return i18n(string.toUtf8().data(), comment.toUtf8().data());
00106 }
00107 template <typename A1>
00108 inline QString i18n (const char *text, const A1 &a1)
00109 {
00110 return i18n(text).arg(a1);
00111 }
00112 template <typename A1, typename A2>
00113 inline QString i18n (const char *text, const A1 &a1, const A2 &a2)
00114 {
00115 return i18n(text).arg(a1).arg(a2);
00116 }
00117 template <typename A1, typename A2, typename A3>
00118 inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3)
00119 {
00120 return i18n(text).arg(a1).arg(a2).arg(a3);
00121 }
00122 template <typename A1, typename A2, typename A3, typename A4>
00123 inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4)
00124 {
00125 return i18n(text).arg(a1).arg(a2).arg(a3).arg(a4);
00126 }
00127
00128 #endif // QT_ONLY
00129
00130 #endif // KJSEGLOBAL_H
00131
00132