Changeset 399 for trunk/src/core


Ignore:
Timestamp:
06/13/15 11:47:09 (10 years ago)
Author:
epyon
Message:
  • naming cleanup
  • string_ref -> string_view (compatible with C++17 standard!)
  • *_ref and const_*_ref, renamed to _ref and _view for consistency
Location:
trunk/src/core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/library.cc

    r395 r399  
    4141}
    4242
    43 void library::open( string_ref name )
     43void library::open( string_view name )
    4444{
    4545        m_name.assign( name.data(), name.size() );
     
    5151}
    5252
    53 bool nv::library::try_open( string_ref name )
     53bool nv::library::try_open( string_view name )
    5454{
    5555        m_name.assign( name.data(), name.size() );
     
    6262}
    6363
    64 string_ref library::get_name() const
     64string_view library::get_name() const
    6565{
    66     return string_ref( m_name );
     66    return string_view( m_name );
    6767}
    6868
     
    7676
    7777        std::string name = m_name;
    78         string_ref ext( NV_LIB_EXT );
     78        string_view ext( NV_LIB_EXT );
    7979
    8080        if ( name.length() < ext.length() || name.substr( name.length() - ext.length(), ext.length() ) != ext )
     
    9494}
    9595
    96 void* library::get( string_ref symbol )
     96void* library::get( string_view symbol )
    9797{
    9898        void* result = (void*) NV_LIB_GET( (NV_LIB_HANDLE) m_handle, symbol.data() );
     
    104104}
    105105
    106 void* nv::library::try_get( string_ref symbol )
     106void* nv::library::try_get( string_view symbol )
    107107{
    108108        return (void*) NV_LIB_GET( (NV_LIB_HANDLE) m_handle, symbol.data() );
  • trunk/src/core/logger.cc

    r395 r399  
    8585
    8686// log function
    87 void logger::log( log_level level, const string_ref& message )
     87void logger::log( log_level level, const string_view& message )
    8888{
    8989        for ( auto& sink_info : m_log_sinks )
     
    141141
    142142// console logging
    143 void log_console_sink::log( log_level level, const string_ref& message )
     143void log_console_sink::log( log_level level, const string_view& message )
    144144{
    145145        char stamp[16];
     
    177177
    178178// handle logging
    179 void log_handle_sink::log( log_level level, const string_ref& message )
     179void log_handle_sink::log( log_level level, const string_view& message )
    180180{
    181181        char stamp[16];
     
    204204}
    205205
    206 nv::log_file_sink::log_file_sink( const string_ref& file_name, bool flush_always /*= true */ )
     206nv::log_file_sink::log_file_sink( const string_view& file_name, bool flush_always /*= true */ )
    207207        : log_handle_sink( nullptr, flush_always )
    208208{
     
    257257}
    258258
    259 string_ref nv::log_sink::level_name( log_level level ) const
     259string_view nv::log_sink::level_name( log_level level ) const
    260260{
    261261        return NV_LOG_LEVEL_NAME( level );
    262262}
    263263
    264 string_ref nv::log_sink::padded_level_name( log_level level ) const
    265 {
    266         return string_ref( NV_LOG_LEVEL_NAME_PAD( level ), 8 );
    267 }
    268 
     264string_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  
    3030}
    3131
    32 void profiler::start_profile( const string_ref& tag )
     32void profiler::start_profile( const string_view& tag )
    3333{
    3434        if ( tag != m_current->m_tag )
     
    4747}
    4848
    49 profiler::node::node( const string_ref& tag, node* parent )
     49profiler::node::node( const string_view& tag, node* parent )
    5050        : m_tag( tag.to_string() )
    5151        , m_parent( parent )
     
    5858}
    5959
    60 profiler::node* profiler::node::request_child( const string_ref& tag )
     60profiler::node* profiler::node::request_child( const string_view& tag )
    6161{
    6262        std::string stag( tag.to_string() );
     
    110110        char buffer[128];
    111111        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 ) ) );
    113113        log_node_children( 0, m_root );
    114114        NV_LOG_INFO( "-- PROFILER REPORT END ---------------------------------" );
     
    131131                        snprintf( buffer + indent, 128 - indent, "%*.*s %6.2f %6d %9.2f %6.2f", indent - 23, 23 - indent,
    132132                                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 ) ) );
    134134                        if ( c->m_children.size() > 0 )
    135135                        {
Note: See TracChangeset for help on using the changeset viewer.