Changeset 439 for trunk/src


Ignore:
Timestamp:
07/23/15 18:14:48 (10 years ago)
Author:
epyon
Message:
  • more std::string removal
Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/engine/particle_engine.cc

    r433 r439  
    302302void nv::particle_engine::load( lua::table_guard& table )
    303303{
    304         std::string id = table.get_std_string( "id" );
    305         if ( id == "" )
     304        shash64 id = table.get_string_hash_64( "id" );
     305        if ( !id.valid() )
    306306        {
    307307                NV_LOG_ERROR( "Bad table passed to particle_engine!" )
     
    355355        {
    356356                lua::table_guard element( table, i+1 );
    357                 const_string type     = element.get_string("type");
    358                 std::string sub_type = element.get_std_string("sub_type");
     357                const_string type     = element.get_string( "type" );
     358                const_string sub_type = element.get_string( "sub_type" );
    359359                if ( type == "emmiter" )
    360360                {
     
    370370                                {
    371371                                        edata.emmiter_func = nv_particle_emmiter_point;
    372                                         NV_LOG_WARNING( "Unknown emmiter type in particle system! (", sub_type.c_str(), ")" );
     372                                        NV_LOG_WARNING( "Unknown emmiter type in particle system! (", sub_type, ")" );
    373373                                }
    374374
     
    435435                                        {
    436436                                                data.affector_count--;
    437                                                 NV_LOG_WARNING( "Bad data passed to ", string_view( sub_type.c_str(), sub_type.size() ), " affector in particle system!" );
     437                                                NV_LOG_WARNING( "Bad data passed to ", sub_type, " affector in particle system!" );
    438438                                        }
    439439                                }
     
    441441                                {
    442442                                        data.affector_count--;
    443                                         NV_LOG_WARNING( "Unknown affector type in particle system! (", string_view( sub_type.c_str(), sub_type.size() ), ")" );
     443                                        NV_LOG_WARNING( "Unknown affector type in particle system! (", sub_type, ")" );
    444444                                }
    445445                        }
     
    469469}
    470470
    471 nv::particle_system nv::particle_engine::create_system( const std::string& id )
     471nv::particle_system nv::particle_engine::create_system( const string_view& id )
    472472{
    473473        auto it = m_names.find( id );
     
    823823}
    824824
    825 void nv::particle_engine::register_emmiter_type( const std::string& name, particle_emmiter_func func )
     825void nv::particle_engine::register_emmiter_type( const string_view& name, particle_emmiter_func func )
    826826{
    827827        m_emmiters[ name ] = func;
     
    842842}
    843843
    844 void nv::particle_engine::register_affector_type( const std::string& name, particle_affector_init_func init, particle_affector_func process )
     844void nv::particle_engine::register_affector_type( const string_view& name, particle_affector_init_func init, particle_affector_func process )
    845845{
    846846        m_affectors[ name ].init    = init;
  • trunk/src/gl/gl_device.cc

    r438 r439  
    212212                for ( auto& i : *info->m_uniform_map )
    213213                {
    214                         auto j = lmap.find( i.first.c_str() );
     214                        auto j = lmap.find( i.first );
    215215                        if ( j != lmap.end() )
    216216                        {
     
    218218                        }                       
    219219
    220                         auto k = map.find( i.first.c_str() );
     220                        auto k = map.find( i.first );
    221221                        if ( k != map.end() )
    222222                        {
     
    227227}
    228228
    229 uniform_base* nv::gl_device::get_uniform( program p, const std::string& name, bool fatal /*= true */ ) const
     229uniform_base* nv::gl_device::get_uniform( program p, const string_view& name, bool fatal /*= true */ ) const
    230230{
    231231        const gl_program_info* info = m_programs.get( p );
     
    238238                if ( fatal )
    239239                {
    240                         NV_LOG_CRITICAL( "gl_device : uniform '", string_view( name.c_str(), name.size() ), "' not found in program!" );
     240                        NV_LOG_CRITICAL( "gl_device : uniform '", name, "' not found in program!" );
    241241                        NV_ABORT( "gl_device : uniform not found!" );
    242242                }
     
    245245}
    246246
    247 int nv::gl_device::get_attribute_location( program p, const std::string& name, bool fatal /*= true */ ) const
     247int nv::gl_device::get_attribute_location( program p, const string_view& name, bool fatal /*= true */ ) const
    248248{
    249249        const gl_program_info* info = m_programs.get( p );
     
    257257                if ( fatal )
    258258                {
    259                         NV_LOG_CRITICAL( "gl_device : attribute '", string_view( name.c_str(), name.size() ), "' not found in program!" );
     259                        NV_LOG_CRITICAL( "gl_device : attribute '", name, "' not found in program!" );
    260260                        NV_ABORT( "gl_device : attribute not found!" );
    261261                }
     
    357357                glGetActiveAttrib( p->glid, i, 128, &attr_nlen, &attr_len, &attr_type, name_buffer );
    358358
    359                 std::string name( name_buffer, size_t( attr_nlen ) );
     359                string_view name( name_buffer, size_t( attr_nlen ) );
    360360
    361361                // skip built-ins
    362362                if ( name.substr(0,3) == "gl_" ) continue;
    363363
    364                 int attr_loc = glGetAttribLocation( p->glid, name.c_str() );
     364                int attr_loc = glGetAttribLocation( p->glid, name.data() );
    365365
    366366                attribute& attr = (*p->m_attribute_map)[ name ];
    367                 attr.name     = name;
    368367                attr.location = attr_loc;
    369368                attr.type     = gl_enum_to_datatype( attr_type );
     
    386385                glGetActiveUniform( p->glid, i, 128, &uni_nlen, &uni_len, &uni_type, name_buffer );
    387386
    388                 std::string name( name_buffer, size_t( uni_nlen ) );
     387                string_view name( name_buffer, size_t( uni_nlen ) );
    389388
    390389                // skip built-ins
    391390                if ( name.substr(0,3) == "gl_" ) continue;
    392391
    393                 int uni_loc = glGetUniformLocation( p->glid, name.c_str() );
     392                int uni_loc = glGetUniformLocation( p->glid, name.data() );
    394393                datatype utype = gl_enum_to_datatype( uni_type );
    395394
    396395                // check for array
    397                 std::string::size_type arrchar = name.find( '[' );
    398                 if ( arrchar != std::string::npos )
     396                size_t arrchar = name.find( '[' );
     397                if ( arrchar != string_view::npos )
    399398                {
    400399                        name = name.substr( 0, arrchar );
    401400                }
    402401
    403                 uniform_base* u = uniform_base::create( utype, name, uni_loc, uni_len );
     402                uniform_base* u = uniform_base::create( utype, uni_loc, uni_len );
    404403                NV_ASSERT( u, "Unknown uniform type!" );
    405404                (*p->m_uniform_map)[ name ] = u;
Note: See TracChangeset for help on using the changeset viewer.