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 #ifdef HAVE_ITOA
00045 char *itoa(int num, char *str, int radix = 10);
00046 #endif
00047 #endif
00048
00049 #include <QtCore/QTextStream>
00050 namespace KJSEmbed {
00051 KJSEMBED_EXPORT QTextStream *conin();
00052 KJSEMBED_EXPORT QTextStream *conout();
00053 KJSEMBED_EXPORT QTextStream *conerr();
00054 }
00055
00056 #include <kjs/ustring.h>
00057 #include <kjs/identifier.h>
00058 #include <kjs/value.h>
00059
00060 namespace KJSEmbed {
00061 inline QString toQString(const KJS::UString& u)
00062 {
00063 return QString((QChar*)u.data(), u.size());
00064 }
00065 inline QString toQString(const KJS::Identifier& i)
00066 {
00067 return QString((QChar*)i.data(), i.size());
00068 }
00069 inline KJS::UString toUString(const QString& qs)
00070 {
00071 return KJS::UString((KJS::UChar*)qs.data(), qs.size());
00072 }
00073 }
00074
00075 namespace KJS {
00076 inline KJS::JSCell* jsString(const QString& s)
00077 {
00078 return jsString(KJSEmbed::toUString(s));
00079 }
00080 }
00081
00082 #ifndef QT_ONLY
00083
00084
00085
00086
00087
00088 #include <kdebug.h>
00089 #include <klocale.h>
00090
00091 #else // QT_ONLY
00092
00093
00094
00095
00096
00097 KJSEMBED_EXPORT QTextStream &kdDebug( int area=0 );
00098 KJSEMBED_EXPORT QTextStream &kdWarning( int area=0 );
00099
00100 #ifndef NO_I18N
00101 KJSEMBED_EXPORT QString i18n( const char *string );
00102 #else
00103 #define i18n(x) QString(x)
00104 #endif // NO_I18N
00105
00106 inline KJSEMBED_EXPORT QString i18n( const QString& string, const QString& comment )
00107 {
00108 return i18n(string.toUtf8().data(), comment.toUtf8().data());
00109 }
00110 template <typename A1>
00111 inline QString i18n (const char *text, const A1 &a1)
00112 {
00113 return i18n(text).arg(a1);
00114 }
00115 template <typename A1, typename A2>
00116 inline QString i18n (const char *text, const A1 &a1, const A2 &a2)
00117 {
00118 return i18n(text).arg(a1).arg(a2);
00119 }
00120 template <typename A1, typename A2, typename A3>
00121 inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3)
00122 {
00123 return i18n(text).arg(a1).arg(a2).arg(a3);
00124 }
00125 template <typename A1, typename A2, typename A3, typename A4>
00126 inline QString i18n (const char *text, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4)
00127 {
00128 return i18n(text).arg(a1).arg(a2).arg(a3).arg(a4);
00129 }
00130
00131 #endif // QT_ONLY
00132
00133 #endif // KJSEGLOBAL_H
00134
00135