- Timestamp:
- 06/13/15 11:47:09 (10 years ago)
- Location:
- trunk/src
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/library.cc
r395 r399 41 41 } 42 42 43 void library::open( string_ refname )43 void library::open( string_view name ) 44 44 { 45 45 m_name.assign( name.data(), name.size() ); … … 51 51 } 52 52 53 bool nv::library::try_open( string_ refname )53 bool nv::library::try_open( string_view name ) 54 54 { 55 55 m_name.assign( name.data(), name.size() ); … … 62 62 } 63 63 64 string_ reflibrary::get_name() const64 string_view library::get_name() const 65 65 { 66 return string_ ref( m_name );66 return string_view( m_name ); 67 67 } 68 68 … … 76 76 77 77 std::string name = m_name; 78 string_ refext( NV_LIB_EXT );78 string_view ext( NV_LIB_EXT ); 79 79 80 80 if ( name.length() < ext.length() || name.substr( name.length() - ext.length(), ext.length() ) != ext ) … … 94 94 } 95 95 96 void* library::get( string_ refsymbol )96 void* library::get( string_view symbol ) 97 97 { 98 98 void* result = (void*) NV_LIB_GET( (NV_LIB_HANDLE) m_handle, symbol.data() ); … … 104 104 } 105 105 106 void* nv::library::try_get( string_ refsymbol )106 void* nv::library::try_get( string_view symbol ) 107 107 { 108 108 return (void*) NV_LIB_GET( (NV_LIB_HANDLE) m_handle, symbol.data() ); -
trunk/src/core/logger.cc
r395 r399 85 85 86 86 // log function 87 void logger::log( log_level level, const string_ ref& message )87 void logger::log( log_level level, const string_view& message ) 88 88 { 89 89 for ( auto& sink_info : m_log_sinks ) … … 141 141 142 142 // console logging 143 void log_console_sink::log( log_level level, const string_ ref& message )143 void log_console_sink::log( log_level level, const string_view& message ) 144 144 { 145 145 char stamp[16]; … … 177 177 178 178 // handle logging 179 void log_handle_sink::log( log_level level, const string_ ref& message )179 void log_handle_sink::log( log_level level, const string_view& message ) 180 180 { 181 181 char stamp[16]; … … 204 204 } 205 205 206 nv::log_file_sink::log_file_sink( const string_ ref& file_name, bool flush_always /*= true */ )206 nv::log_file_sink::log_file_sink( const string_view& file_name, bool flush_always /*= true */ ) 207 207 : log_handle_sink( nullptr, flush_always ) 208 208 { … … 257 257 } 258 258 259 string_ refnv::log_sink::level_name( log_level level ) const259 string_view nv::log_sink::level_name( log_level level ) const 260 260 { 261 261 return NV_LOG_LEVEL_NAME( level ); 262 262 } 263 263 264 string_ refnv::log_sink::padded_level_name( log_level level ) const265 { 266 return string_ ref( NV_LOG_LEVEL_NAME_PAD( level ), 8 );267 } 268 264 string_view nv::log_sink::padded_level_name( log_level level ) const 265 { 266 return string_view( NV_LOG_LEVEL_NAME_PAD( level ), 8 ); 267 } 268 -
trunk/src/core/profiler.cc
r395 r399 30 30 } 31 31 32 void profiler::start_profile( const string_ ref& tag )32 void profiler::start_profile( const string_view& tag ) 33 33 { 34 34 if ( tag != m_current->m_tag ) … … 47 47 } 48 48 49 profiler::node::node( const string_ ref& tag, node* parent )49 profiler::node::node( const string_view& tag, node* parent ) 50 50 : m_tag( tag.to_string() ) 51 51 , m_parent( parent ) … … 58 58 } 59 59 60 profiler::node* profiler::node::request_child( const string_ ref& tag )60 profiler::node* profiler::node::request_child( const string_view& tag ) 61 61 { 62 62 std::string stag( tag.to_string() ); … … 110 110 char buffer[128]; 111 111 snprintf( buffer, 128, "%-23s %6s %6s %9s %6s", "TAG", "%PARNT", "CALLS", "TOTAL(ms)", "AVG(ms)" ); 112 NV_LOG_INFO( string_ ref( buffer, nvstrlen( buffer ) ) );112 NV_LOG_INFO( string_view( buffer, nvstrlen( buffer ) ) ); 113 113 log_node_children( 0, m_root ); 114 114 NV_LOG_INFO( "-- PROFILER REPORT END ---------------------------------" ); … … 131 131 snprintf( buffer + indent, 128 - indent, "%*.*s %6.2f %6d %9.2f %6.2f", indent - 23, 23 - indent, 132 132 c->m_tag.c_str(), pparent, calls, total_ms, avg_ms ); 133 NV_LOG_INFO( string_ ref( buffer, nvstrlen( buffer ) ) );133 NV_LOG_INFO( string_view( buffer, nvstrlen( buffer ) ) ); 134 134 if ( c->m_children.size() > 0 ) 135 135 { -
trunk/src/engine/program_manager.cc
r395 r399 37 37 } 38 38 39 nv::program program = m_context->get_device()->create_program( string_ ref( vsource ), string_ref( fsource ) );39 nv::program program = m_context->get_device()->create_program( string_view( vsource ), string_view( fsource ) ); 40 40 return add( program ); 41 41 } -
trunk/src/engine/resource_system.cc
r395 r399 12 12 { 13 13 m_lua = a_lua_state; 14 lua::register_storage( m_lua, get_storage_name(), string_ ref( "register_" + get_resource_name().to_string() ) );14 lua::register_storage( m_lua, get_storage_name(), string_view( "register_" + get_resource_name().to_string() ) ); 15 15 } 16 16 -
trunk/src/fmod/fmod_audio.cc
r395 r399 88 88 89 89 90 nv::sound fmod::audio::load_sound( const string_ ref& a_path )90 nv::sound fmod::audio::load_sound( const string_view& a_path ) 91 91 { 92 92 FMOD_SYSTEM* system = (FMOD_SYSTEM*)m_system; -
trunk/src/formats/assimp_loader.cc
r395 r399 237 237 aiMesh* mesh = scene->mMeshes[mc]; 238 238 239 NV_LOG_NOTICE( "Mesh #", mc, " - ", string_ ref( (char*)mesh->mName.data ) );239 NV_LOG_NOTICE( "Mesh #", mc, " - ", string_view( (char*)mesh->mName.data ) ); 240 240 NV_LOG_NOTICE( " bones - ", mesh->mNumBones ); 241 241 NV_LOG_NOTICE( " uvs - ", mesh->mNumUVComponents[0] ); -
trunk/src/formats/md3_loader.cc
r395 r399 284 284 } 285 285 286 nv::key_raw_channel* nv::md3_loader::load_tags( const string_ ref& tag )286 nv::key_raw_channel* nv::md3_loader::load_tags( const string_view& tag ) 287 287 { 288 288 md3_t* md3 = (md3_t*)m_md3; … … 294 294 { 295 295 const md3_tag_t& rtag = md3->tags[i + md3->header.num_tags * f]; 296 string_ refrname((char*)(rtag.name));296 string_view rname((char*)(rtag.name)); 297 297 if (rname == tag) 298 298 { … … 425 425 { 426 426 const md3_tag_t& rtag = md3->tags[i]; 427 string_ refname( (char*)(rtag.name) );427 string_view name( (char*)(rtag.name) ); 428 428 429 429 nodes[i].transform = mat4(); -
trunk/src/formats/md5_loader.cc
r398 r399 457 457 } 458 458 459 void md5_loader::build_frame_skeleton( mesh_node_data* nodes, uint32 index, const const_array_ref<md5_joint_info>& joint_infos, const const_array_ref<transform>& base_frames, const const_array_ref<float>& frame_data )459 void md5_loader::build_frame_skeleton( mesh_node_data* nodes, uint32 index, const array_view<md5_joint_info>& joint_infos, const array_view<transform>& base_frames, const array_view<float>& frame_data ) 460 460 { 461 461 assert( m_type == ANIMATION ); -
trunk/src/formats/nmd_loader.cc
r395 r399 162 162 static void nmd_dump_mesh( const mesh_data* mesh, stream& stream_out ) 163 163 { 164 const_array_ref< mesh_raw_channel* > data = mesh->get_raw_channels();164 array_view< mesh_raw_channel* > data = mesh->get_raw_channels(); 165 165 166 166 uint32 size = sizeof( nmd_element_header ); -
trunk/src/gfx/texture_font.cc
r398 r399 92 92 } 93 93 94 bool texture_font::load_glyphs( string_ refcodes )94 bool texture_font::load_glyphs( string_view codes ) 95 95 { 96 96 FT_Face face = (FT_Face)(m_rface); -
trunk/src/gl/gl_device.cc
r398 r399 24 24 } 25 25 26 program gl_device::create_program( string_ ref vs_source, string_reffs_source )26 program gl_device::create_program( string_view vs_source, string_view fs_source ) 27 27 { 28 28 program result = m_programs.create(); … … 41 41 // this is a temporary function that will be removed once we find a way to 42 42 // pass binary file data around 43 image_data* gl_device::create_image_data( string_ reffilename )43 image_data* gl_device::create_image_data( string_view filename ) 44 44 { 45 45 load_sdl_image_library(); … … 264 264 } 265 265 266 bool nv::gl_device::compile( gl_program_info* p, string_ ref vertex_program, string_reffragment_program )266 bool nv::gl_device::compile( gl_program_info* p, string_view vertex_program, string_view fragment_program ) 267 267 { 268 268 if (!compile( GL_VERTEX_SHADER, vertex_program, p->glidv )) { return false; } … … 407 407 } 408 408 409 bool nv::gl_device::compile( uint32 sh_type, string_ refshader_code, unsigned& glid )409 bool nv::gl_device::compile( uint32 sh_type, string_view shader_code, unsigned& glid ) 410 410 { 411 411 glid = glCreateShader( sh_type ); -
trunk/src/lua/lua_nova.cc
r395 r399 810 810 } 811 811 812 void nv::lua::register_storage( state* a_state, string_ ref name, string_refconstructor_name )812 void nv::lua::register_storage( state* a_state, string_view name, string_view constructor_name ) 813 813 { 814 814 // TODO: error checking -
trunk/src/lua/lua_path.cc
r395 r399 14 14 { 15 15 if ( m_elements[0].length == 0 || m_elements[0].str == nullptr ) return; 16 string_ refspath( m_elements[0].str, m_elements[0].length );16 string_view spath( m_elements[0].str, m_elements[0].length ); 17 17 m_count = 0; 18 18 size_t point = spath.find( '.' ); 19 19 20 while ( point != string_ ref::npos )20 while ( point != string_view::npos ) 21 21 { 22 22 m_elements[m_count].str = spath.data(); … … 39 39 } 40 40 41 void nv::lua::path::push( string_ refp )41 void nv::lua::path::push( string_view p ) 42 42 { 43 43 m_elements[ m_count ].str = p.data(); -
trunk/src/lua/lua_state.cc
r395 r399 80 80 } 81 81 82 void lua::state_wrapper::register_native_function( lfunction f, string_ refname )82 void lua::state_wrapper::register_native_function( lfunction f, string_view name ) 83 83 { 84 84 if ( m_global ) push_global_table(); … … 171 171 } 172 172 173 bool lua::table_guard::has_field( string_ refelement )173 bool lua::table_guard::has_field( string_view element ) 174 174 { 175 175 lua_getfield( m_state, -1, element.data() ); … … 179 179 } 180 180 181 std::string lua::table_guard::get_std_string( string_ ref element, string_ref defval /*= string_ref() */ )181 std::string lua::table_guard::get_std_string( string_view element, string_view defval /*= string_view() */ ) 182 182 { 183 183 lua_getfield( m_state, -1, element.data() ); … … 198 198 } 199 199 200 const_string lua::table_guard::get_string( string_ ref element, string_ref defval /*= string_ref() */ )200 const_string lua::table_guard::get_string( string_view element, string_view defval /*= string_view() */ ) 201 201 { 202 202 lua_getfield( m_state, -1, element.data() ); … … 217 217 } 218 218 219 char lua::table_guard::get_char( string_ refelement, char defval /*= "" */ )219 char lua::table_guard::get_char( string_view element, char defval /*= "" */ ) 220 220 { 221 221 lua_getfield( m_state, -1, element.data() ); … … 225 225 } 226 226 227 int lua::table_guard::get_integer( string_ refelement, int defval /*= "" */ )227 int lua::table_guard::get_integer( string_view element, int defval /*= "" */ ) 228 228 { 229 229 lua_getfield( m_state, -1, element.data() ); … … 233 233 } 234 234 235 unsigned lua::table_guard::get_unsigned( string_ refelement, unsigned defval /*= "" */ )235 unsigned lua::table_guard::get_unsigned( string_view element, unsigned defval /*= "" */ ) 236 236 { 237 237 lua_getfield( m_state, -1, element.data() ); … … 241 241 } 242 242 243 double lua::table_guard::get_double( string_ refelement, double defval /*= "" */ )243 double lua::table_guard::get_double( string_view element, double defval /*= "" */ ) 244 244 { 245 245 lua_getfield( m_state, -1, element.data() ); … … 250 250 251 251 252 float nv::lua::table_guard::get_float( string_ refelement, float defval /*= 0.0 */ )252 float nv::lua::table_guard::get_float( string_view element, float defval /*= 0.0 */ ) 253 253 { 254 254 lua_getfield( m_state, -1, element.data() ); … … 258 258 } 259 259 260 bool lua::table_guard::get_boolean( string_ refelement, bool defval /*= "" */ )260 bool lua::table_guard::get_boolean( string_view element, bool defval /*= "" */ ) 261 261 { 262 262 lua_getfield( m_state, -1, element.data() ); … … 266 266 } 267 267 268 bool nv::lua::table_guard::is_table( string_ refelement )268 bool nv::lua::table_guard::is_table( string_view element ) 269 269 { 270 270 lua_getfield( m_state, -1, element.data() ); … … 274 274 } 275 275 276 bool nv::lua::table_guard::is_number( string_ refelement )276 bool nv::lua::table_guard::is_number( string_view element ) 277 277 { 278 278 lua_getfield( m_state, -1, element.data() ); … … 282 282 } 283 283 284 bool nv::lua::table_guard::is_boolean( string_ refelement )284 bool nv::lua::table_guard::is_boolean( string_view element ) 285 285 { 286 286 lua_getfield( m_state, -1, element.data() ); … … 290 290 } 291 291 292 bool nv::lua::table_guard::is_string( string_ refelement )292 bool nv::lua::table_guard::is_string( string_view element ) 293 293 { 294 294 lua_getfield( m_state, -1, element.data() ); … … 350 350 } 351 351 352 int lua::state::load_string( string_ ref code, string_refname )352 int lua::state::load_string( string_view code, string_view name ) 353 353 { 354 354 NV_LOG_TRACE( "Loading Lua string '", name, "'"); … … 356 356 } 357 357 358 int lua::state::load_file( string_ reffilename )358 int lua::state::load_file( string_view filename ) 359 359 { 360 360 NV_LOG_NOTICE( "Loading Lua file '", filename, "'"); … … 362 362 } 363 363 364 bool lua::state::do_string( string_ ref code, string_refname, int rvalues )364 bool lua::state::do_string( string_view code, string_view name, int rvalues ) 365 365 { 366 366 lua::stack_guard( this ); … … 374 374 } 375 375 376 bool lua::state::do_file( string_ reffilename )376 bool lua::state::do_file( string_view filename ) 377 377 { 378 378 lua::stack_guard( this ); … … 386 386 } 387 387 388 int lua::state::do_current( string_ refname, int rvalues )388 int lua::state::do_current( string_view name, int rvalues ) 389 389 { 390 390 int result = lua_pcall(m_state, 0, rvalues, 0); … … 417 417 } 418 418 419 lua::ref lua::state::register_object( void* o, string_ reflua_name )419 lua::ref lua::state::register_object( void* o, string_view lua_name ) 420 420 { 421 421 if ( o == nullptr ) return lua::ref( lua::ref::none ); … … 430 430 } 431 431 432 lua::ref lua::state::register_proto( string_ ref id, string_refstorage )432 lua::ref lua::state::register_proto( string_view id, string_view storage ) 433 433 { 434 434 stack_guard guard( this ); … … 446 446 } 447 447 448 void lua::state::register_native_object_method( string_ ref lua_name, string_refname, lfunction f )448 void lua::state::register_native_object_method( string_view lua_name, string_view name, lfunction f ) 449 449 { 450 450 stack_guard guard( this ); … … 508 508 } 509 509 510 void nv::lua::state::store_metadata( ref object_index, string_ refmetaname, void* pointer )510 void nv::lua::state::store_metadata( ref object_index, string_view metaname, void* pointer ) 511 511 { 512 512 if ( !object_index.is_valid() ) return; … … 518 518 } 519 519 520 void nv::lua::state::register_enum( string_ refname, int value )520 void nv::lua::state::register_enum( string_view name, int value ) 521 521 { 522 522 lua_pushinteger( m_state, value ); … … 524 524 } 525 525 526 nv::lua::ref nv::lua::state::register_handle_component_impl( string_ refid, bool empty )526 nv::lua::ref nv::lua::state::register_handle_component_impl( string_view id, bool empty ) 527 527 { 528 528 int args = empty ? 1 : 2; … … 547 547 } 548 548 549 void nv::lua::state::unregister_handle_component_impl( string_ refid )549 void nv::lua::state::unregister_handle_component_impl( string_view id ) 550 550 { 551 551 NV_LUA_STACK_ASSERT( m_state, -1 ); … … 562 562 } 563 563 564 void nv::lua::state::register_singleton( string_ refname, void* o )564 void nv::lua::state::register_singleton( string_view name, void* o ) 565 565 { 566 566 if ( o == nullptr ) return; -
trunk/src/lua/lua_values.cc
r395 r399 75 75 } 76 76 77 void nv::lua::detail::push_string_ ref( lua_State *L, string_refs )77 void nv::lua::detail::push_string_view( lua_State *L, string_view s ) 78 78 { 79 79 lua_pushlstring( L, s.data(), s.size() ); … … 123 123 } 124 124 125 nv::string_ ref nv::lua::detail::to_string_ref( lua_State *L, int index )125 nv::string_view nv::lua::detail::to_string_view( lua_State *L, int index ) 126 126 { 127 127 size_t length = 0; 128 128 const char* result = lua_tolstring( L, index, &length ); 129 return string_ ref( result, length );129 return string_view( result, length ); 130 130 } 131 131 -
trunk/src/sdl/sdl_audio.cc
r397 r399 85 85 } 86 86 87 nv::sound nv::sdl::audio::load_sound( const string_ ref& a_path )87 nv::sound nv::sdl::audio::load_sound( const string_view& a_path ) 88 88 { 89 89 // TODO: this is a really weird error - if we remove this check, all hell gets loose
Note: See TracChangeset
for help on using the changeset viewer.