- Timestamp:
- 07/21/15 19:40:00 (10 years ago)
- Location:
- trunk/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/library.cc
r403 r433 62 62 string_view library::get_name() const 63 63 { 64 return string_view( m_name );64 return string_view( m_name.c_str(), m_name.size() ); 65 65 } 66 66 … … 71 71 return true; 72 72 } 73 NV_LOG_NOTICE( "library \"", string_view( m_name ), "\" : loading..." );73 NV_LOG_NOTICE( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : loading..." ); 74 74 75 75 std::string name = m_name; 76 st ring_viewext( NV_LIB_EXT );76 std::string ext( NV_LIB_EXT ); 77 77 78 78 if ( name.length() < ext.length() || name.substr( name.length() - ext.length(), ext.length() ) != ext ) … … 85 85 if ( m_handle == NULL ) 86 86 { 87 NV_LOG_NOTICE( "library \"", string_view( name), "\" : failed to open!" );87 NV_LOG_NOTICE( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : failed to open!" ); 88 88 return false; 89 89 } 90 NV_LOG_NOTICE( "library \"", string_view( name), "\" : loaded." );90 NV_LOG_NOTICE( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : loaded." ); 91 91 return true; 92 92 } … … 97 97 if ( !result ) 98 98 { 99 NV_LOG_CRITICAL( "library \"", string_view( m_name ), "\" : can't find symbol \"", symbol, "\"" );99 NV_LOG_CRITICAL( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : can't find symbol \"", symbol, "\"" ); 100 100 NV_ABORT( "Library symbol load failed!" ); 101 101 } … … 117 117 if ( ! NV_LIB_CLOSE( m_handle ) ) 118 118 { 119 NV_LOG_ERROR( "library \"", string_view( m_name ), "\" : can't close library!" );119 NV_LOG_ERROR( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : can't close library!" ); 120 120 } 121 121 m_handle = nullptr; -
trunk/src/engine/particle_engine.cc
r406 r433 435 435 { 436 436 data.affector_count--; 437 NV_LOG_WARNING( "Bad data passed to ", s ub_type, " affector in particle system!" );437 NV_LOG_WARNING( "Bad data passed to ", string_view( sub_type.c_str(), sub_type.size() ), " affector in particle system!" ); 438 438 } 439 439 } … … 441 441 { 442 442 data.affector_count--; 443 NV_LOG_WARNING( "Unknown affector type in particle system! (", s ub_type, ")" );443 NV_LOG_WARNING( "Unknown affector type in particle system! (", string_view( sub_type.c_str(), sub_type.size() ), ")" ); 444 444 } 445 445 } -
trunk/src/engine/program_manager.cc
r399 r433 37 37 } 38 38 39 nv::program program = m_context->get_device()->create_program( string_view( vsource ), string_view( fsource) );39 nv::program program = m_context->get_device()->create_program( string_view( vsource.c_str(), vsource.size() ), string_view( fsource.c_str(), fsource.size() ) ); 40 40 return add( program ); 41 41 } -
trunk/src/engine/resource_system.cc
r431 r433 12 12 { 13 13 m_lua = a_lua_state; 14 lua::register_storage( m_lua, get_storage_name(), string_view( "register_" + get_resource_name().to_string() ) ); 14 std::string delete_me = "register_" + std::string( get_resource_name().data(), get_resource_name().size() ); 15 lua::register_storage( m_lua, get_storage_name(), string_view( delete_me.c_str(), delete_me.size() ) ); 15 16 } 16 17 -
trunk/src/formats/md5_loader.cc
r428 r433 155 155 sstream >> shader; 156 156 remove_quotes( shader ); 157 maccess.set_name( make_name( shader ) );157 maccess.set_name( make_name( shader.c_str() ) ); 158 158 next_line( sstream ); 159 159 } -
trunk/src/formats/obj_loader.cc
r427 r433 328 328 data_channel_set* result = data_channel_set_creator::create_set( 1 ); 329 329 data_channel_set_creator raccess( result ); 330 raccess.set_name( make_name( reader->name ) );330 raccess.set_name( make_name( reader->name.c_str() ) ); 331 331 uint8* rdata = raccess.add_channel( m_descriptor, reader->size * 3 ).raw_data(); 332 332 -
trunk/src/gl/gl_device.cc
r406 r433 19 19 m_shader_header = "#version 120\n"; 20 20 for ( auto& i : get_uniform_factory() ) 21 m_shader_header += "uniform "+datatype_to_glsl_type( i.second->get_datatype() )+" "+ i.first.to_string() +";\n";21 m_shader_header += "uniform "+datatype_to_glsl_type( i.second->get_datatype() )+" "+ std::string( i.first.data(), i.first.size() ) +";\n"; 22 22 for ( auto& i : get_link_uniform_factory() ) 23 m_shader_header += "uniform sampler2D "+ i.first.to_string() +";\n";23 m_shader_header += "uniform sampler2D "+std::string( i.first.data(), i.first.size() ) +";\n"; 24 24 } 25 25 … … 212 212 for ( auto& i : *info->m_uniform_map ) 213 213 { 214 auto j = lmap.find( i.first );214 auto j = lmap.find( i.first.c_str() ); 215 215 if ( j != lmap.end() ) 216 216 { … … 218 218 } 219 219 220 auto k = map.find( i.first );220 auto k = map.find( i.first.c_str() ); 221 221 if ( k != map.end() ) 222 222 { … … 238 238 if ( fatal ) 239 239 { 240 NV_LOG_CRITICAL( "gl_device : uniform '", string_view( name ), "' not found in program!" );240 NV_LOG_CRITICAL( "gl_device : uniform '", string_view( name.c_str(), name.size() ), "' not found in program!" ); 241 241 NV_ABORT( "gl_device : uniform not found!" ); 242 242 } … … 257 257 if ( fatal ) 258 258 { 259 NV_LOG_CRITICAL( "gl_device : attribute '", string_view( name ), "' not found in program!" );259 NV_LOG_CRITICAL( "gl_device : attribute '", string_view( name.c_str(), name.size() ), "' not found in program!" ); 260 260 NV_ABORT( "gl_device : attribute not found!" ); 261 261 } -
trunk/src/gui/gui_environment.cc
r401 r433 30 30 } 31 31 32 void nv::gui::environment::load_style( const st d::string& filename )32 void nv::gui::environment::load_style( const string_view& filename ) 33 33 { 34 34 m_renderer->load_style( filename ); -
trunk/src/gui/gui_gfx_renderer.cc
r406 r433 187 187 } 188 188 189 nv::size_t gfx_renderer::load_font( const st d::string& filename, nv::size_t size )190 { 191 std::string id_name( filename );189 nv::size_t gfx_renderer::load_font( const string_view& filename, nv::size_t size ) 190 { 191 std::string id_name( filename.data(), filename.size() ); 192 192 char buffer[8]; size_t len = nv::sint32_to_buffer( sint32( size ), buffer ); 193 193 id_name.append( std::string( buffer, len ) ); 194 auto i = m_font_names.find( id_name ); 194 string_view id( id_name.c_str(), id_name.size() ); 195 auto i = m_font_names.find( id ); 195 196 if ( i != m_font_names.end() ) 196 197 { … … 198 199 } 199 200 size_t result = m_fonts.size(); 200 texture_font* f = new texture_font( &m_atlas, filename. c_str(), static_cast<float>( size ) );201 texture_font* f = new texture_font( &m_atlas, filename.data(), static_cast<float>( size ) ); 201 202 f->load_glyphs( "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ " ); 202 203 m_fonts.push_back( f ); 203 204 m_reupload = true; 204 m_font_names[ id_name] = result;205 m_font_names[ id ] = result; 205 206 return result; 206 207 } 207 208 208 nv::size_t gfx_renderer::load_image( const st d::string& filename )209 nv::size_t gfx_renderer::load_image( const string_view& filename ) 209 210 { 210 211 auto i = m_image_names.find( filename ); … … 253 254 if ( m_style.get( e, "skin", selector, path ) ) 254 255 { 255 size_t image_id = load_image( path);256 size_t image_id = load_image( string_view( path.c_str(), path.size() ) ); 256 257 const image_info* image = get_image( image_id ); 257 258 if ( image ) … … 318 319 if ( m_style.get( e, "text_color", selector, color ) && m_style.get( e, "text_font", selector, path ) && m_style.get( e, "text_size", selector, border ) ) 319 320 { 320 size_t font_id = load_font( path, size_t( border ) );321 size_t font_id = load_font( string_view( path.c_str(), path.size() ), size_t( border ) ); 321 322 texture_font* font = get_font( font_id ); 322 323 position p = abs.ul + position( 0, border ); -
trunk/src/gui/gui_renderer.cc
r395 r433 7 7 #include "nv/gui/gui_renderer.hh" 8 8 9 void nv::gui::renderer::load_style( const st d::string& filename )9 void nv::gui::renderer::load_style( const string_view& filename ) 10 10 { 11 11 m_style.load_style( filename ); -
trunk/src/gui/gui_style.cc
r406 r433 16 16 } 17 17 18 void style::load_style( const st d::string& filename )18 void style::load_style( const string_view& filename ) 19 19 { 20 20 m_lua.do_file( filename ); -
trunk/src/lua/lua_function.cc
r406 r433 21 21 { 22 22 lua_pop( L, 1 ); 23 NV_LUA_ABORT( "function_base::function_base", "not a valid path - ", a_path.to_string() );23 NV_LUA_ABORT( "function_base::function_base", "not a valid path - ", a_path.to_string().c_str() ); 24 24 } 25 25 … … 27 27 { 28 28 lua_pop( L, 1 ); 29 NV_LUA_ABORT( "function_base::function_base", "not a valid function - ", a_path.to_string() );29 NV_LUA_ABORT( "function_base::function_base", "not a valid function - ", a_path.to_string().c_str() ); 30 30 } 31 31 m_ref = luaL_ref( L, LUA_REGISTRYINDEX ); -
trunk/src/lua/lua_map_tile.cc
r406 r433 55 55 nv::map_area* map_area = nv::lua::detail::to_map_area( L, 3 ); 56 56 lua_settop( L, 2 ); 57 std::string code = nv::trimmed( lua_tostring( L, 1 ) ).to_string(); 57 nv::string_view lts = nv::trimmed( lua_tostring( L, 1 ) ); 58 std::string code( lts.data(), lts.size() ); 58 59 std::string chars( " \r\t" ); 59 60 code.erase( nv::remove_if( code.begin(), code.end(), -
trunk/src/lua/lua_state.cc
r431 r433 116 116 if ( !p.resolve( m_state, global ) ) 117 117 { 118 NV_LOG_ERROR( "Lua error : not a valid path - ", p.to_string() );118 NV_LOG_ERROR( "Lua error : not a valid path - ", p.to_string().c_str() ); 119 119 return false; 120 120 } … … 123 123 { 124 124 lua_pop( m_state, 1 ); 125 NV_LOG_ERROR( "Lua error : not a valid function - ", p.to_string() );125 NV_LOG_ERROR( "Lua error : not a valid function - ", p.to_string().c_str() ); 126 126 return false; 127 127 } … … 442 442 for ( int i = 0; i < top; ++i ) 443 443 { 444 NV_LOG_DEBUG( "#", i+1, " - ", lua_typename(m_state, lua_type(m_state, i+1) ), " = ", nlua_typecontent(m_state, i+1) );444 NV_LOG_DEBUG( "#", i+1, " - ", lua_typename(m_state, lua_type(m_state, i+1) ), " = ", nlua_typecontent(m_state, i+1).c_str() ); 445 445 } 446 446 }
Note: See TracChangeset
for help on using the changeset viewer.