51 List(
bool needsMarking);
54 List(
const List &b) : _impBase(b._impBase), _needsMarking(
false) {
56 if (!_impBase->valueRefCount) refValues();
57 ++_impBase->valueRefCount;
81 List copyTail()
const;
86 bool isEmpty()
const {
return _impBase->size == 0; }
90 int size()
const {
return _impBase->size; }
120 static const List &empty();
122 void mark() {
if (_impBase->valueRefCount == 0) markValues(); }
124 ListImpBase *_impBase;
127 void deref() {
if (!_needsMarking && --_impBase->valueRefCount == 0) derefValues();
if (--_impBase->refCount == 0) release(); }
151 Value operator*()
const {
return Value(_list->impAt(_i)); }
189 inline List &List::operator=(
const List &b)
191 ListImpBase *bImpBase = b._impBase;
192 ++bImpBase->refCount;
195 if (!_needsMarking) {
196 if (!_impBase->valueRefCount) {
199 _impBase->valueRefCount++;
Value objects are act as wrappers ("smart pointers") around ValueImp objects and their descendents...
void append(const Value &val)
Append an object to the end of the list.
Value operator--(int)
Postfix decrement operator.
bool operator==(const ListIterator &it) const
Compare the iterator with another one.
Value at(int i) const
Retrieve an element at an indexed position.
Value operator++(int)
Postfix increment operator.
ListIterator(const List &l)
Construct an iterator that points to the first element of the list.
ListIterator begin() const
ValueImp * operator->() const
Dereference the iterator.
bool operator!=(const ListIterator &it) const
Check for inequality with another iterator.
ValueImp is the base type for all primitives (Undefined, Null, Boolean, String, Number) and objects i...
Value operator--()
Prefix decrement operator.
Value operator[](int i) const
Equivalent to at.
Value operator++()
Prefix increment operator.
Iterator for KJS::List objects.