reference.h
00001 // -*- c-basic-offset: 2 -*- 00002 /* 00003 * This file is part of the KDE libraries 00004 * Copyright (C) 2003 Apple Computer, Inc 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 */ 00022 00023 #ifndef _KJS_REFERENCE_H_ 00024 #define _KJS_REFERENCE_H_ 00025 00026 #include "identifier.h" 00027 #include "value.h" 00028 00029 namespace KJS { 00030 00031 // delme 00035 class KJS_EXPORT Reference : public Value { 00036 // fixme 00037 /* class Reference : private Value { */ 00038 friend class ReferenceList; 00039 friend class ReferenceListIterator; 00040 public: 00041 Reference(const Object& b, const Identifier& p); 00042 Reference(const Object& b, unsigned p); 00043 Reference(ObjectImp *b, const Identifier& p); 00044 Reference(ObjectImp *b, unsigned p); 00045 Reference(const Null& b, const Identifier& p); 00046 Reference(const Null& b, unsigned p); 00047 static Reference makeValueReference(const Value& v); 00048 00055 Value getBase(ExecState *exec) const; 00056 00061 Identifier getPropertyName(ExecState *exec) const; 00062 00067 Value getValue(ExecState *exec) const; 00068 00073 void putValue(ExecState *exec, const Value &w); 00074 bool deleteValue(ExecState *exec); 00075 00076 bool isMutable(); 00077 00078 private: 00079 Reference(); 00080 00081 Value base; 00082 unsigned propertyNameAsNumber; 00083 bool baseIsValue; 00084 bool propertyNameIsNumber; 00085 mutable Identifier prop; 00086 }; 00087 } 00088 00089 #endif