51 ValueIteratorBase::ValueIteratorBase()
52 #ifndef JSON_VALUE_USE_INTERNAL_MAP
61 iterator_.array_ = ValueInternalArray::IteratorState();
66 #ifndef JSON_VALUE_USE_INTERNAL_MAP
67 ValueIteratorBase::ValueIteratorBase(
const Value::ObjectValues::iterator ¤t )
73 ValueIteratorBase::ValueIteratorBase(
const ValueInternalArray::IteratorState &state )
76 iterator_.array_ = state;
80 ValueIteratorBase::ValueIteratorBase(
const ValueInternalMap::IteratorState &state )
83 iterator_.map_ = state;
88 ValueIteratorBase::deref()
const
90 #ifndef JSON_VALUE_USE_INTERNAL_MAP
91 return current_->second;
94 return ValueInternalArray::dereference( iterator_.array_ );
95 return ValueInternalMap::value( iterator_.map_ );
101 ValueIteratorBase::increment()
103 #ifndef JSON_VALUE_USE_INTERNAL_MAP
107 ValueInternalArray::increment( iterator_.array_ );
108 ValueInternalMap::increment( iterator_.map_ );
114 ValueIteratorBase::decrement()
116 #ifndef JSON_VALUE_USE_INTERNAL_MAP
120 ValueInternalArray::decrement( iterator_.array_ );
121 ValueInternalMap::decrement( iterator_.map_ );
126 ValueIteratorBase::difference_type
127 ValueIteratorBase::computeDistance(
const SelfType &other )
const
129 #ifndef JSON_VALUE_USE_INTERNAL_MAP
130 # ifdef JSON_USE_CPPTL_SMALLMAP
131 return current_ - other.current_;
138 if ( isNull_ && other.isNull_ )
148 difference_type myDistance = 0;
149 for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it )
157 return ValueInternalArray::distance( iterator_.array_, other.iterator_.array_ );
158 return ValueInternalMap::distance( iterator_.map_, other.iterator_.map_ );
164 ValueIteratorBase::isEqual(
const SelfType &other )
const
166 #ifndef JSON_VALUE_USE_INTERNAL_MAP
169 return other.isNull_;
171 return current_ == other.current_;
174 return ValueInternalArray::equals( iterator_.array_, other.iterator_.array_ );
175 return ValueInternalMap::equals( iterator_.map_, other.iterator_.map_ );
181 ValueIteratorBase::copy(
const SelfType &other )
183 #ifndef JSON_VALUE_USE_INTERNAL_MAP
184 current_ = other.current_;
187 iterator_.array_ = other.iterator_.array_;
188 iterator_.map_ = other.iterator_.map_;
196 #ifndef JSON_VALUE_USE_INTERNAL_MAP
197 const Value::CZString czstring = (*current_).first;
198 if ( czstring.c_str() )
200 if ( czstring.isStaticString() )
201 return Value( StaticString( czstring.c_str() ) );
202 return Value( czstring.c_str() );
204 return Value( czstring.index() );
207 return Value( ValueInternalArray::indexOf( iterator_.array_ ) );
209 const char *
memberName = ValueInternalMap::key( iterator_.map_, isStatic );
211 return Value( StaticString( memberName ) );
212 return Value( memberName );
220 #ifndef JSON_VALUE_USE_INTERNAL_MAP
221 const Value::CZString czstring = (*current_).first;
222 if ( !czstring.c_str() )
223 return czstring.index();
224 return Value::UInt( -1 );
227 return Value::UInt( ValueInternalArray::indexOf( iterator_.array_ ) );
228 return Value::UInt( -1 );
236 #ifndef JSON_VALUE_USE_INTERNAL_MAP
237 const char *name = (*current_).first.c_str();
238 return name ? name :
"";
241 return ValueInternalMap::key( iterator_.map_ );
255 ValueConstIterator::ValueConstIterator()
260 #ifndef JSON_VALUE_USE_INTERNAL_MAP
261 ValueConstIterator::ValueConstIterator(
const Value::ObjectValues::iterator ¤t )
262 : ValueIteratorBase( current )
266 ValueConstIterator::ValueConstIterator(
const ValueInternalArray::IteratorState &state )
267 : ValueIteratorBase( state )
271 ValueConstIterator::ValueConstIterator(
const ValueInternalMap::IteratorState &state )
272 : ValueIteratorBase( state )
278 ValueConstIterator::operator =(
const ValueIteratorBase &other )
293 ValueIterator::ValueIterator()
298 #ifndef JSON_VALUE_USE_INTERNAL_MAP
299 ValueIterator::ValueIterator(
const Value::ObjectValues::iterator ¤t )
300 : ValueIteratorBase( current )
304 ValueIterator::ValueIterator(
const ValueInternalArray::IteratorState &state )
305 : ValueIteratorBase( state )
309 ValueIterator::ValueIterator(
const ValueInternalMap::IteratorState &state )
310 : ValueIteratorBase( state )
315 ValueIterator::ValueIterator(
const ValueConstIterator &other )
316 : ValueIteratorBase( other )
320 ValueIterator::ValueIterator(
const ValueIterator &other )
321 : ValueIteratorBase( other )
326 ValueIterator::operator =(
const SelfType &other )
const char * memberName() const
Return the member name of the referenced Value. "" if it is not an objectValue.
Value key() const
Return either the index or the member name of the referenced value as a Value.
UInt index() const
Return the index of the referenced Value. -1 if it is not an arrayValue.