struct PathEqual
{
- bool operator()( const CopiedString& path, const CopiedString& other ) const {
+ bool operator()( const std::string& path, const std::string& other ) const {
return path_equal( path.c_str(), other.c_str() );
}
};
struct PathHash
{
typedef hash_t hash_type;
- hash_type operator()( const CopiedString& path ) const {
+ hash_type operator()( const std::string& path ) const {
return path_hash( path.c_str() );
}
};
-typedef std::pair<CopiedString, CopiedString> ModelKey;
+typedef std::pair<std::string, std::string> ModelKey;
struct ModelKeyEqual
{
ModelCache::iterator ModelCache_insert( const char* path, const char* name, scene::Node& node ){
if ( g_modelCache_enabled ) {
- return g_modelCache.insert( ModelKey( path, name ), NodeSmartReference( node ) );
+ return g_modelCache.emplace( ModelKey( path, name ), NodeSmartReference( node ) ).first;
}
- return g_modelCache.insert( ModelKey( "", "" ), g_nullModel );
+ return g_modelCache.emplace( ModelKey( "", "" ), g_nullModel ).first;
}
void ModelCache_flush( const char* path, const char* name ){
struct ModelResource : public Resource
{
NodeSmartReference m_model;
- const CopiedString m_originalName;
- CopiedString m_path;
- CopiedString m_name;
- CopiedString m_type;
+ const std::string m_originalName;
+ std::string m_path;
+ std::string m_name;
+ std::string m_type;
ModelLoader* m_loader;
ModuleObservers m_observers;
std::time_t m_modified;
std::size_t m_unrealised;
- ModelResource( const CopiedString& name ) :
+ ModelResource( const std::string& name ) :
m_model( g_nullModel ),
m_originalName( name ),
m_type( path_get_extension( name.c_str() ) ),
);
}
- setModel( ( *i ).value );
+ setModel( ( *i ).second );
}
else
{
void setNode( scene::Node* node ){
ModelCache::iterator i = ModelCache_find( m_path.c_str(), m_name.c_str() );
if ( i != g_modelCache.end() ) {
- ( *i ).value = NodeSmartReference( *node );
+ ( *i ).second = NodeSmartReference( *node );
}
setModel( NodeSmartReference( *node ) );
class HashtableReferenceCache : public ReferenceCache, public ModuleObserver
{
-typedef HashedCache<CopiedString, ModelResource, PathHash, PathEqual> ModelReferences;
+typedef HashedCache<std::string, ModelResource, PathHash, PathEqual> ModelReferences;
ModelReferences m_references;
std::size_t m_unrealised;
Resource* capture( const char* path ){
//globalOutputStream() << "capture: \"" << path << "\"\n";
- return m_references.capture( CopiedString( path ) ).get();
+ return m_references.capture( std::string( path ) ).get();
}
void release( const char* path ){
- m_references.release( CopiedString( path ) );
+ m_references.release( std::string( path ) );
//globalOutputStream() << "release: \"" << path << "\"\n";
}
for ( ModelReferencesSnapshot::iterator i = snapshot.begin(); i != snapshot.end(); ++i )
{
ModelReferences::value_type& value = *( *i );
- if ( value.value.count() != 1 ) {
- value.value.get()->realise();
+ if ( value.second.count() != 1 ) {
+ value.second.get()->realise();
}
}
}
for ( ModelReferencesSnapshot::iterator i = snapshot.begin(); i != snapshot.end(); ++i )
{
ModelReferences::value_type& value = *( *i );
- if ( value.value.count() != 1 ) {
- value.value.get()->unrealise();
+ if ( value.second.count() != 1 ) {
+ value.second.get()->unrealise();
}
}
}
ModelReferencesSnapshot snapshot( m_references );
for ( ModelReferencesSnapshot::iterator i = snapshot.begin(); i != snapshot.end(); ++i )
{
- ModelResource* resource = ( *( *i ) ).value.get();
+ ModelResource* resource = ( *( *i ) ).second.get();
if ( !resource->isMap() ) {
resource->refresh();
}
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Saving Map" );
for ( HashtableReferenceCache::iterator i = g_referenceCache.begin(); i != g_referenceCache.end(); ++i )
{
- ( *i ).value->save();
+ ( *i ).second->save();
}
MapChanged();
}
bool References_Saved(){
for ( HashtableReferenceCache::iterator i = g_referenceCache.begin(); i != g_referenceCache.end(); ++i )
{
- scene::Node* node = ( *i ).value->getNode();
+ scene::Node* node = ( *i ).second->getNode();
if ( node != 0 ) {
MapFile* map = Node_getMapFile( *node );
if ( map != 0 && !map->saved() ) {