/usr/include/KF5/kjs/kjsobject.h is in libkf5kjs-dev 5.18.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | /*
* This file is part of the KDE libraries
* Copyright (C) 2008 Harri Porten (porten@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef KJSOBJECT_H
#define KJSOBJECT_H
#include "kjsapi_export.h"
#include <QtCore/QString>
class QDateTime;
class KJSContext;
class KJSNull;
class KJSUndefined;
class KJSBoolean;
class KJSNumber;
class KJSString;
class KJSArray;
class KJSDate;
class KJSArguments;
class KJSInterpreter;
class KJSObjectHandle;
class KJSCustomProperty;
class KJSCustomFunction;
/**
* A class representing a JavaScript value.
*
* @short Script object
*/
class KJSAPI_EXPORT KJSObject
{
friend class KJSNull;
friend class KJSUndefined;
friend class KJSBoolean;
friend class KJSNumber;
friend class KJSString;
friend class KJSArray;
friend class KJSDate;
friend class KJSGlobalObject;
friend class KJSPrototype;
friend class KJSContext;
friend class KJSArguments;
friend class KJSInterpreter;
friend class KJSCustomProperty;
friend class KJSCustomFunction;
public:
/**
* Constructs a JavaScript object of the generic Object type.
*/
KJSObject();
/**
* Constructs on object from another one
*/
KJSObject(const KJSObject &o);
/**
* Assigns another JS object references to this one.
*/
KJSObject &operator=(const KJSObject &o);
/**
* Destructs this object freeing any references it might have held.
*/
~KJSObject();
/**
* Returns whether this object is undefined.
*/
bool isUndefined() const;
/**
* Returns whether this object is null.
*/
bool isNull() const;
/**
* Returns whether this object is a boolean.
*/
bool isBoolean() const;
/**
* Returns whether this object is a number.
*/
bool isNumber() const;
/**
* Returns whether this object is a string.
*/
bool isString() const;
/**
* Returns whether this object is a full blown object.
*/
bool isObject() const;
/**
* Returns this value converted to a boolean. If the conversion
* fails the context will have an exception set.
*/
bool toBoolean(KJSContext *ctx);
/**
* Returns this value converted to a number. If the conversion
* fails the context will have an exception set.
*/
double toNumber(KJSContext *ctx);
/**
* Returns this value converted to a 32-bit integer number. NaN,
* positive and negative Infinity will be converted to 0. If the
* conversion fails the context will have an exception set.
*/
int toInt32(KJSContext *ctx);
/**
* Returns this value converted to a string. If the conversion
* fails the context will have an exception set.
*/
QString toString(KJSContext *ctx);
/**
* Reads the specified property from this object. This operation
* might throw an exception.
*/
KJSObject property(KJSContext *ctx, const QString &name);
/**
* Sets the specified property on this object. This operation
* might throw an exception.
*/
void setProperty(KJSContext *ctx, const QString &name,
const KJSObject &value);
/**
* @overload
*/
void setProperty(KJSContext *ctx, const QString &name, bool value);
/**
* @overload
*/
void setProperty(KJSContext *ctx, const QString &name, double value);
/**
* @overload
*/
void setProperty(KJSContext *ctx, const QString &name, int value);
/**
* @overload
*/
void setProperty(KJSContext *ctx, const QString &name,
const QString &value);
/**
* @overload
*
* Accepts a Latin1 encoded, null-terminated string.
*/
void setProperty(KJSContext *ctx, const QString &name,
const char *value);
private:
KJSObject(KJSObjectHandle *h) : hnd(h) { }
KJSObjectHandle *hnd;
};
/**
* A class representing a JavaScript null value.
*
* @short Null value
*/
class KJSAPI_EXPORT KJSNull : public KJSObject
{
public:
/**
* Constructs a null object.
*/
KJSNull();
};
/**
* A class representing an undefined JavaScript value.
*
* @short Undefined value
*/
class KJSAPI_EXPORT KJSUndefined : public KJSObject
{
public:
/**
* Constructs an undefined object.
*/
KJSUndefined();
};
/**
* A class representing a boolean JavaScript value.
*
* @short Boolean value
*/
class KJSAPI_EXPORT KJSBoolean : public KJSObject
{
public:
/**
* Constructs a boolean object.
*/
KJSBoolean(bool b);
};
/**
* A class representing a JavaScript number value.
*
* @short Number value
*/
class KJSAPI_EXPORT KJSNumber : public KJSObject
{
public:
/**
* Constructs a number object.
*/
KJSNumber(double d);
};
/**
* A class representing a JavaScript string value.
*
* @short String value
*/
class KJSAPI_EXPORT KJSString : public KJSObject
{
public:
/**
* Constructs a string object.
*/
KJSString(const QString &s);
/**
* Constructs a string object from an Latin1 encoded,
* null-terminated string. Note the limited input character range
* which rules out a big part of Unicode.
*
* @overload
*/
KJSString(const char *s);
};
/**
* A class representing a JavaScript array object.
*
* @short Array object
*/
class KJSAPI_EXPORT KJSArray : public KJSObject
{
public:
/**
* Constructs an array object with the specified length.
*/
KJSArray(KJSContext *ctx, int len = 0);
};
/**
* A class representing a JavaScript date object.
*
* @short Date object
*/
class KJSAPI_EXPORT KJSDate : public KJSObject
{
public:
/**
* Constructs a date object from the specified date and time.
*/
KJSDate(KJSContext *ctx, const QDateTime &dt);
};
/**
* A class representing a global object of an execution environment.
*
* @short Global object
*/
class KJSAPI_EXPORT KJSGlobalObject : public KJSObject
{
friend class KJSPrototype;
public:
/**
* Constructs an empty global object. Usually done through
* KJSPrototype::constructGlobalObject().
*/
KJSGlobalObject();
private:
KJSGlobalObject(KJSObjectHandle *h) : KJSObject(h) { }
};
#endif
|