1// -*- mode: c++; c-basic-offset: 4 -*-
2/*
3 * Copyright (C) 2006 Apple Computer, Inc
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 */
21
22#ifndef KJS_PROPERTY_NAME_ARRAY_H
23#define KJS_PROPERTY_NAME_ARRAY_H
24
25#include "identifier.h"
26
27#include <wtf/HashSet.h>
28#include <wtf/Vector.h>
29
30namespace KJS {
31
32 class PropertyNameArray;
33
34 typedef Vector<Identifier>::const_iterator PropertyNameArrayIterator;
35
36 class KJS_EXPORT PropertyNameArray {
37 public:
38 typedef PropertyNameArrayIterator iterator;
39
40 void add(const Identifier&);
41 iterator begin() const { return m_vector.begin(); }
42 iterator end() const { return m_vector.end(); }
43 int size() const { return m_vector.size(); }
44
45 Identifier& operator[](unsigned i) { return m_vector[i]; }
46 const Identifier& operator[](unsigned i) const { return m_vector[i]; }
47
48 private:
49 typedef HashSet<UString::Rep*, PtrHash<UString::Rep*> > IdentifierSet;
50 IdentifierSet m_set;
51 Vector<Identifier> m_vector;
52 };
53
54
55} // namespace KJS
56
57
58#endif // KJS_PROPERTY_NAME_ARRAY_H
59