-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsrt.h
44 lines (36 loc) · 937 Bytes
/
jsrt.h
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
// jsrt.h - Javascript runtime
namespace jsrt
{
class jsString;
class jsObject;
class jsArray;
typedef enum {
dtUndef,
dtNull,
dtNumber,
dtBool,
dtString,
dtObject,
dtArray
} ValDataType;
class jsValue
{
short type;
union {
double dvalue;
jsString *pstring;
jsObject *pobj;
jsArray *parray;
}
public:
ValDataType Type(void) const { return type; }
bool isUndef(void) const { return (type==dtUndef); }
bool isNull(void) const { return (type==dtNull); }
bool isNumber(void) const { return (type==dtNumber); }
bool isBool(void) const { return (type==dtBool); }
bool isString(void) const { return (type==dtString); }
bool isObject(void) const { return (type==dtObject); }
bool isArray(void) const { return (type==dtArray); }
bool getNumber(double &d) const { return (type==dtNumber) ? (d=dvalue,true) : false; }
}; // jsValue
}