1 | // -*- c-basic-offset: 2 -*-
|
---|
2 | /*
|
---|
3 | * This file is part of the KDE libraries
|
---|
4 | * Copyright (C) 2003 Apple Computer, Inc
|
---|
5 | *
|
---|
6 | * This library is free software; you can redistribute it and/or
|
---|
7 | * modify it under the terms of the GNU Library General Public
|
---|
8 | * License as published by the Free Software Foundation; either
|
---|
9 | * version 2 of the License, or (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This library is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
14 | * Library General Public License for more details.
|
---|
15 | *
|
---|
16 | * You should have received a copy of the GNU Library General Public License
|
---|
17 | * along with this library; see the file COPYING.LIB. If not, write to
|
---|
18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
---|
19 | * Boston, MA 02111-1307, USA.
|
---|
20 | *
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef _KJS_REFERENCE_H_
|
---|
24 | #define _KJS_REFERENCE_H_
|
---|
25 |
|
---|
26 | #include "identifier.h"
|
---|
27 | #include "value.h"
|
---|
28 |
|
---|
29 | namespace KJS {
|
---|
30 |
|
---|
31 | class Reference {
|
---|
32 | friend class ReferenceList;
|
---|
33 | friend class ReferenceListIterator;
|
---|
34 | friend class ProtectedReference;
|
---|
35 | public:
|
---|
36 | Reference(const Object& b, const Identifier& p);
|
---|
37 | Reference(const Object& b, unsigned p);
|
---|
38 | Reference(ObjectImp *b, const Identifier& p);
|
---|
39 | Reference(ObjectImp *b, unsigned p);
|
---|
40 | Reference(const Null& b, const Identifier& p);
|
---|
41 | Reference(const Null& b, unsigned p);
|
---|
42 | static Reference makeValueReference(const Value& v);
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Performs the GetBase type conversion operation on this value (ECMA 8.7)
|
---|
46 | *
|
---|
47 | * Since references are supposed to have an Object or null as their base,
|
---|
48 | * this method is guaranteed to return either Null() or an Object value.
|
---|
49 | */
|
---|
50 | Value getBase(ExecState *exec) const;
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Performs the GetPropertyName type conversion operation on this value
|
---|
54 | * (ECMA 8.7)
|
---|
55 | */
|
---|
56 | Identifier getPropertyName(ExecState *exec) const;
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Performs the GetValue type conversion operation on this value
|
---|
60 | * (ECMA 8.7.1)
|
---|
61 | */
|
---|
62 | Value getValue(ExecState *exec) const;
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Performs the PutValue type conversion operation on this value
|
---|
66 | * (ECMA 8.7.1)
|
---|
67 | */
|
---|
68 | void putValue(ExecState *exec, const Value &w);
|
---|
69 | bool deleteValue(ExecState *exec);
|
---|
70 |
|
---|
71 | bool isMutable();
|
---|
72 |
|
---|
73 | private:
|
---|
74 | Reference();
|
---|
75 |
|
---|
76 | Value base;
|
---|
77 | unsigned propertyNameAsNumber;
|
---|
78 | bool baseIsValue;
|
---|
79 | bool propertyNameIsNumber;
|
---|
80 | mutable Identifier prop;
|
---|
81 | };
|
---|
82 | }
|
---|
83 |
|
---|
84 | #endif
|
---|