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 |
|
---|
30 | namespace KJS {
|
---|
31 |
|
---|
32 | class PropertyNameArray {
|
---|
33 | public:
|
---|
34 | typedef Identifier ValueType;
|
---|
35 | typedef Vector<Identifier>::const_iterator const_iterator;
|
---|
36 |
|
---|
37 | void add(const Identifier&);
|
---|
38 | const_iterator begin() const { return m_vector.begin(); }
|
---|
39 | const_iterator end() const { return m_vector.end(); }
|
---|
40 | size_t size() const { return m_vector.size(); }
|
---|
41 |
|
---|
42 | Identifier& operator[](unsigned i) { return m_vector[i]; }
|
---|
43 | const Identifier& operator[](unsigned i) const { return m_vector[i]; }
|
---|
44 |
|
---|
45 | void swap(PropertyNameArray&);
|
---|
46 | private:
|
---|
47 | typedef HashSet<UString::Rep*, PtrHash<UString::Rep*> > IdentifierSet;
|
---|
48 | IdentifierSet m_set;
|
---|
49 | Vector<Identifier> m_vector;
|
---|
50 | };
|
---|
51 |
|
---|
52 |
|
---|
53 | } // namespace KJS
|
---|
54 |
|
---|
55 |
|
---|
56 | #endif // KJS_PROPERTY_NAME_ARRAY_H
|
---|