Ejemplo n.º 1
0
Value::Members
Value::getMemberNames () const
{
    JSON_ASSERT ( type_ == nullValue  ||  type_ == objectValue );

    if ( type_ == nullValue )
        return Value::Members ();

    Members members;
    members.reserve ( value_.map_->size () );
#ifndef JSON_VALUE_USE_INTERNAL_MAP
    ObjectValues::const_iterator it = value_.map_->begin ();
    ObjectValues::const_iterator itEnd = value_.map_->end ();

    for ( ; it != itEnd; ++it )
        members.push_back ( std::string ( (*it).first.c_str () ) );

#else
    ValueInternalMap::IteratorState it;
    ValueInternalMap::IteratorState itEnd;
    value_.map_->makeBeginIterator ( it );
    value_.map_->makeEndIterator ( itEnd );

    for ( ; !ValueInternalMap::equals ( it, itEnd ); ValueInternalMap::increment (it) )
        members.push_back ( std::string ( ValueInternalMap::key ( it ) ) );

#endif
    return members;
}
Ejemplo n.º 2
0
Value::Members Value::getMemberNames() const {
  JSON_ASSERT_MESSAGE(
      type() == nullValue || type() == objectValue,
      "in Json::Value::getMemberNames(), value must be objectValue");
  if (type() == nullValue)
    return Value::Members();
  Members members;
  members.reserve(value_.map_->size());
  ObjectValues::const_iterator it = value_.map_->begin();
  ObjectValues::const_iterator itEnd = value_.map_->end();
  for (; it != itEnd; ++it) {
    members.push_back(String((*it).first.data(), (*it).first.length()));
  }
  return members;
}
Ejemplo n.º 3
0
Value::Members
Value::getMemberNames() const
{
   JSON_ASSERT( type_ == nullValue  ||  type_ == objectValue );
   if ( type_ == nullValue )
       return Value::Members();
   Members members;
   members.reserve( value_.map_->size() );

   ObjectValues::const_iterator it = value_.map_->begin();
   ObjectValues::const_iterator itEnd = value_.map_->end();
   for ( ; it != itEnd; ++it )
      members.push_back( std::string( (*it).first.c_str() ) );


   return members;
}