00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#ifndef _KJS_PROPERTY_MAP_H_
00024
#define _KJS_PROPERTY_MAP_H_
00025
00026
#include "identifier.h"
00027
00028
namespace KJS {
00029
00030
class Object;
00031
class ReferenceList;
00032
class ValueImp;
00033
00034
class SavedProperty;
00035
00036
struct PropertyMapHashTable;
00037
00038
class SavedProperties {
00039
friend class PropertyMap;
00040
public:
00041 SavedProperties();
00042 ~SavedProperties();
00043
00044
private:
00045
int _count;
00046 SavedProperty *_properties;
00047
00048 SavedProperties(
const SavedProperties&);
00049 SavedProperties& operator=(
const SavedProperties&);
00050 };
00051
00052
struct PropertyMapHashTableEntry
00053 {
00054 PropertyMapHashTableEntry() :
key(0) { }
00055 UString::Rep *
key;
00056
ValueImp *value;
00057
int attributes;
00058 };
00059
00060
class PropertyMap {
00061
public:
00062 PropertyMap();
00063 ~PropertyMap();
00064
00065
void clear();
00066
00067
void put(
const Identifier &name,
ValueImp *value,
int attributes);
00068
void remove(
const Identifier &name);
00069
ValueImp *get(
const Identifier &name)
const;
00070
ValueImp *get(
const Identifier &name,
int &attributes)
const;
00071
00072
void mark() const;
00073
void addEnumerablesToReferenceList(ReferenceList &, const
Object &) const;
00074
void addSparseArrayPropertiesToReferenceList(ReferenceList &, const
Object &) const;
00075
00076
void save(SavedProperties &) const;
00077
void restore(const SavedProperties &p);
00078
00079 private:
00080
int hash(const
UString::Rep *) const;
00081 static
bool keysMatch(const
UString::Rep *, const
UString::Rep *);
00082
void expand();
00083
00084
void insert(
UString::Rep *,
ValueImp *value,
int attributes);
00085
00086
void checkConsistency();
00087
00088 typedef PropertyMapHashTableEntry Entry;
00089 typedef PropertyMapHashTable Table;
00090
00091 Table *_table;
00092
00093 Entry _singleEntry;
00094 };
00095
00096 }
00097
00098 #endif