{
typedef std::vector< StringValuePair > StringValueContainer;
-typedef std::pair< Property::Index, Property::Value > IndexValuePair;
-typedef std::vector< IndexValuePair > IndexValueContainer;
+using IndexValuePair = std::pair<Property::Index, Property::Value>;
+using IndexValueContainer = std::vector<IndexValuePair>;
}; // unnamed namespace
{
}
+Property::Map::Map( const std::initializer_list< KeyValuePair >& values ) : Map()
+{
+ for( auto&& value : values )
+ {
+ const auto& key = value.first;
+ switch( key.type )
+ {
+ case Property::Key::INDEX:
+ {
+ Property::Map::Insert( key.indexKey, value.second );
+ break;
+ }
+ case Property::Key::STRING:
+ {
+ Property::Map::Insert( key.stringKey, value.second );
+ break;
+ }
+ }
+ }
+}
+
Property::Map::Map( const Property::Map& other )
: mImpl( new Impl )
{
{
DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- for ( StringValueContainer::iterator iter = mImpl->mStringValueContainer.begin(), endIter = mImpl->mStringValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : mImpl->mStringValueContainer )
{
- if ( iter->first == key )
+ if ( iter.first == key )
{
- return &iter->second;
+ return &iter.second;
}
}
- return NULL; // Not found
+ return nullptr; // Not found
}
Property::Value* Property::Map::Find( const std::string& key ) const
{
DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- for ( IndexValueContainer::iterator iter = mImpl->mIndexValueContainer.begin(), endIter = mImpl->mIndexValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : mImpl->mIndexValueContainer )
{
- if ( iter->first == key )
+ if ( iter.first == key )
{
- return &iter->second;
+ return &iter.second;
}
}
- return NULL; // Not found
+ return nullptr; // Not found
}
Property::Value* Property::Map::Find( Property::Index indexKey, const std::string& stringKey ) const
{
DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- for ( StringValueContainer::iterator iter = mImpl->mStringValueContainer.begin(), endIter = mImpl->mStringValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : mImpl->mStringValueContainer )
{
- if( (iter->second.GetType() == type) && (iter->first == key) )
+ if( (iter.second.GetType() == type) && (iter.first == key) )
{
- return &iter->second;
+ return &iter.second;
}
}
- return NULL; // Not found
+ return nullptr; // Not found
}
Property::Value* Property::Map::Find( Property::Index key, Property::Type type ) const
{
DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- for ( IndexValueContainer::iterator iter = mImpl->mIndexValueContainer.begin(), endIter = mImpl->mIndexValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : mImpl->mIndexValueContainer )
{
- if( (iter->second.GetType() == type) && (iter->first == key) )
+ if( (iter.second.GetType() == type) && (iter.first == key) )
{
- return &iter->second;
+ return &iter.second;
}
}
- return NULL; // Not found
+ return nullptr; // Not found
}
void Property::Map::Clear()
{
if ( Count() )
{
- for ( StringValueContainer::const_iterator iter = from.mImpl->mStringValueContainer.begin(), endIter = from.mImpl->mStringValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : from.mImpl->mStringValueContainer )
{
- (*this)[iter->first] = iter->second;
+ (*this)[iter.first] = iter.second;
}
- for ( IndexValueContainer::const_iterator iter = from.mImpl->mIndexValueContainer.begin(), endIter = from.mImpl->mIndexValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : from.mImpl->mIndexValueContainer )
{
- (*this)[iter->first] = iter->second;
+ (*this)[iter.first] = iter.second;
}
}
else
{
DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- for ( StringValueContainer::const_iterator iter = mImpl->mStringValueContainer.begin(), endIter = mImpl->mStringValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : mImpl->mStringValueContainer )
{
- if ( iter->first == key )
+ if ( iter.first == key )
{
- return iter->second;
+ return iter.second;
}
}
{
DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- for ( StringValueContainer::iterator iter = mImpl->mStringValueContainer.begin(), endIter = mImpl->mStringValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : mImpl->mStringValueContainer )
{
- if ( iter->first == key )
+ if ( iter.first == key )
{
- return iter->second;
+ return iter.second;
}
}
{
DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- for ( IndexValueContainer::const_iterator iter = mImpl->mIndexValueContainer.begin(), endIter = mImpl->mIndexValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : mImpl->mIndexValueContainer )
{
- if ( iter->first == key )
+ if ( iter.first == key )
{
- return iter->second;
+ return iter.second;
}
}
{
DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- for ( IndexValueContainer::iterator iter = mImpl->mIndexValueContainer.begin(), endIter = mImpl->mIndexValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : mImpl->mIndexValueContainer )
{
- if ( iter->first == key )
+ if ( iter.first == key )
{
- return iter->second;
+ return iter.second;
}
}
{
int32_t count = 0;
// Output the String-Value pairs
- for ( StringValueContainer::iterator iter = map.mImpl->mStringValueContainer.begin(), endIter = map.mImpl->mStringValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : map.mImpl->mStringValueContainer )
{
if( count++ > 0 )
{
stream<<", ";
}
- stream<< iter->first << ":"<<iter->second;
+ stream<< iter.first << ":" << iter.second;
}
// Output the Index-Value pairs
- for ( IndexValueContainer::iterator iter = map.mImpl->mIndexValueContainer.begin(), endIter = map.mImpl->mIndexValueContainer.end(); iter != endIter; ++iter )
+ for( auto&& iter : map.mImpl->mIndexValueContainer )
{
if( count++ > 0 )
{
stream<<", ";
}
- stream<< iter->first << ":"<<iter->second;
+ stream<< iter.first << ":" << iter.second;
}
}