osgEarth 2.1.1
|
Experimental and untested: base class for Value iterators. More...
Public Types | |
typedef unsigned int | size_t |
typedef int | difference_type |
typedef ValueIteratorBase | SelfType |
Public Member Functions | |
ValueIteratorBase () | |
ValueIteratorBase (const Value::ObjectValues::iterator ¤t) | |
bool | operator== (const SelfType &other) const |
bool | operator!= (const SelfType &other) const |
difference_type | operator- (const SelfType &other) const |
Value | key () const |
Return either the index or the member name of the referenced value as a Value. | |
Value::UInt | index () const |
Return the index of the referenced Value. -1 if it is not an arrayValue. | |
const char * | memberName () const |
Return the member name of the referenced Value. "" if it is not an objectValue. | |
Protected Member Functions | |
Value & | deref () const |
void | increment () |
void | decrement () |
difference_type | computeDistance (const SelfType &other) const |
bool | isEqual (const SelfType &other) const |
void | copy (const SelfType &other) |
Private Attributes | |
Value::ObjectValues::iterator | current_ |
Experimental and untested: base class for Value iterators.
Reimplemented in osgEarth::Json::ValueConstIterator, and osgEarth::Json::ValueIterator.
Reimplemented in osgEarth::Json::ValueConstIterator, and osgEarth::Json::ValueIterator.
typedef unsigned int osgEarth::Json::ValueIteratorBase::size_t |
Reimplemented in osgEarth::Json::ValueConstIterator, and osgEarth::Json::ValueIterator.
ValueIteratorBase::ValueIteratorBase | ( | ) |
Definition at line 142 of file JsonUtils.cpp.
{ }
ValueIteratorBase::ValueIteratorBase | ( | const Value::ObjectValues::iterator & | current | ) | [explicit] |
Definition at line 148 of file JsonUtils.cpp.
: current_( current ) { }
ValueIteratorBase::difference_type ValueIteratorBase::computeDistance | ( | const SelfType & | other | ) | const [protected] |
Definition at line 207 of file JsonUtils.cpp.
{ #ifndef JSON_VALUE_USE_INTERNAL_MAP # ifdef JSON_USE_CPPTL_SMALLMAP return current_ - other.current_; # else return difference_type( std::distance( current_, other.current_ ) ); # endif #else if ( isArray_ ) return ValueInternalArray::distance( iterator_.array_, other.iterator_.array_ ); return ValueInternalMap::distance( iterator_.map_, other.iterator_.map_ ); #endif }
void ValueIteratorBase::copy | ( | const SelfType & | other | ) | [protected] |
Definition at line 237 of file JsonUtils.cpp.
{ #ifndef JSON_VALUE_USE_INTERNAL_MAP current_ = other.current_; #else if ( isArray_ ) iterator_.array_ = other.iterator_.array_; iterator_.map_ = other.iterator_.map_; #endif }
void ValueIteratorBase::decrement | ( | ) | [protected] |
Definition at line 194 of file JsonUtils.cpp.
{ #ifndef JSON_VALUE_USE_INTERNAL_MAP --current_; #else if ( isArray_ ) ValueInternalArray::decrement( iterator_.array_ ); ValueInternalMap::decrement( iterator_.map_ ); #endif }
Value & ValueIteratorBase::deref | ( | ) | const [protected] |
Definition at line 168 of file JsonUtils.cpp.
{ #ifndef JSON_VALUE_USE_INTERNAL_MAP return current_->second; #else if ( isArray_ ) return ValueInternalArray::dereference( iterator_.array_ ); return ValueInternalMap::value( iterator_.map_ ); #endif }
void ValueIteratorBase::increment | ( | ) | [protected] |
Definition at line 181 of file JsonUtils.cpp.
{ #ifndef JSON_VALUE_USE_INTERNAL_MAP ++current_; #else if ( isArray_ ) ValueInternalArray::increment( iterator_.array_ ); ValueInternalMap::increment( iterator_.map_ ); #endif }
Value::UInt ValueIteratorBase::index | ( | ) | const |
Return the index of the referenced Value. -1 if it is not an arrayValue.
Definition at line 274 of file JsonUtils.cpp.
{ #ifndef JSON_VALUE_USE_INTERNAL_MAP const Value::CZString czstring = (*current_).first; if ( !czstring.c_str() ) return czstring.index(); return Value::UInt( -1 ); #else if ( isArray_ ) return Value::UInt( ValueInternalArray::indexOf( iterator_.array_ ) ); return Value::UInt( -1 ); #endif }
bool ValueIteratorBase::isEqual | ( | const SelfType & | other | ) | const [protected] |
Definition at line 224 of file JsonUtils.cpp.
{ #ifndef JSON_VALUE_USE_INTERNAL_MAP return current_ == other.current_; #else if ( isArray_ ) return ValueInternalArray::equals( iterator_.array_, other.iterator_.array_ ); return ValueInternalMap::equals( iterator_.map_, other.iterator_.map_ ); #endif }
Value ValueIteratorBase::key | ( | ) | const |
Return either the index or the member name of the referenced value as a Value.
Definition at line 250 of file JsonUtils.cpp.
{ #ifndef JSON_VALUE_USE_INTERNAL_MAP const Value::CZString czstring = (*current_).first; if ( czstring.c_str() ) { if ( czstring.isStaticString() ) return Value( StaticString( czstring.c_str() ) ); return Value( czstring.c_str() ); } return Value( czstring.index() ); #else if ( isArray_ ) return Value( ValueInternalArray::indexOf( iterator_.array_ ) ); bool isStatic; const char *memberName = ValueInternalMap::key( iterator_.map_, isStatic ); if ( isStatic ) return Value( StaticString( memberName ) ); return Value( memberName ); #endif }
const char * ValueIteratorBase::memberName | ( | ) | const |
Return the member name of the referenced Value. "" if it is not an objectValue.
Definition at line 290 of file JsonUtils.cpp.
{ #ifndef JSON_VALUE_USE_INTERNAL_MAP const char *name = (*current_).first.c_str(); return name ? name : ""; #else if ( !isArray_ ) return ValueInternalMap::key( iterator_.map_ ); return ""; #endif }
bool osgEarth::Json::ValueIteratorBase::operator!= | ( | const SelfType & | other | ) | const [inline] |
difference_type osgEarth::Json::ValueIteratorBase::operator- | ( | const SelfType & | other | ) | const [inline] |
Definition at line 947 of file JsonUtils.
{ return computeDistance( other ); }
bool osgEarth::Json::ValueIteratorBase::operator== | ( | const SelfType & | other | ) | const [inline] |
Value::ObjectValues::iterator osgEarth::Json::ValueIteratorBase::current_ [private] |