]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/referencecache.cpp
Wrap GtkAccelGroup
[xonotic/netradiant.git] / radiant / referencecache.cpp
index ee3ab8061e17f4a16201458e6b66d641cfb4eef0..5773fa32b8d614c0065709ae3e01ea03c33f1fd8 100644 (file)
@@ -215,7 +215,7 @@ inline hash_t path_hash( const char* path, hash_t previous = 0 ){
 
 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() );
        }
 };
@@ -223,12 +223,12 @@ struct PathEqual
 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
 {
@@ -258,9 +258,9 @@ ModelCache::iterator ModelCache_find( const char* path, const char* name ){
 
 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 ){
@@ -322,16 +322,16 @@ const char* rootPath( 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() ) ),
@@ -374,7 +374,7 @@ struct ModelResource : public Resource
                                        );
                        }
 
-                       setModel( ( *i ).value );
+                       setModel( ( *i ).second );
                }
                else
                {
@@ -424,7 +424,7 @@ struct ModelResource : public Resource
        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 ) );
 
@@ -508,7 +508,7 @@ struct ModelResource : public Resource
 
 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;
 
@@ -560,10 +560,10 @@ void clear(){
 
 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";
 }
 
@@ -584,8 +584,8 @@ void realise(){
                        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();
                                }
                        }
                }
@@ -600,8 +600,8 @@ void unrealise(){
                        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();
                                }
                        }
                }
@@ -613,7 +613,7 @@ void refresh(){
        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();
                }
@@ -638,7 +638,7 @@ void SaveReferences(){
        ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Saving Map" );
        for ( HashtableReferenceCache::iterator i = g_referenceCache.begin(); i != g_referenceCache.end(); ++i )
        {
-               ( *i ).value->save();
+               ( *i ).second->save();
        }
        MapChanged();
 }
@@ -646,7 +646,7 @@ void SaveReferences(){
 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() ) {