Ignore:
Timestamp:
07/23/15 21:16:01 (10 years ago)
Author:
epyon
Message:
  • massive std::string removal
  • no header depends on std::string anymore (or any other STL header)
  • still some code files do (WIP)
  • massive refactoring where std::string was used
  • lua still messy (grep for string128 - used everywhere)
  • string_twine added
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lua/lua_state.cc

    r437 r440  
    116116        if ( !p.resolve( m_state, global ) )
    117117        {
    118                 NV_LOG_ERROR( "Lua error : not a valid path - ", p.to_string().c_str() );
     118                NV_LOG_ERROR( "Lua error : not a valid path - ", p.to_string() );
    119119                return false;
    120120        }
     
    123123        {
    124124                lua_pop( m_state, 1 );
    125                 NV_LOG_ERROR( "Lua error : not a valid function - ", p.to_string().c_str() );
     125                NV_LOG_ERROR( "Lua error : not a valid function - ", p.to_string() );
    126126                return false;
    127127        }
     
    212212        lua_pop( m_state, 1 );
    213213        return shash64( result );
    214 }
    215 
    216 std::string lua::table_guard::get_std_string( string_view element, string_view defval /*= string_view() */ )
    217 {
    218         lua_getfield( m_state, -1, element.data() );
    219         size_t l = 0;
    220         const char* str = nullptr;
    221         if ( lua_type( m_state, -1 ) == LUA_TSTRING )
    222         {
    223                 str = lua_tolstring( m_state, -1, &l );
    224         }
    225         else
    226         {
    227                 l = defval.size();
    228                 str = defval.data();
    229         }
    230         std::string result( str, l );
    231         lua_pop( m_state, 1 );
    232         return result;
    233214}
    234215
     
    250231        lua_pop( m_state, 1 );
    251232        return result;
     233}
     234
     235string128 lua::table_guard::get_string128( string_view element, string_view defval )
     236{
     237        lua_getfield( m_state, -1, element.data() );
     238        size_t l = 0;
     239        const char* str = nullptr;
     240        if ( lua_type( m_state, -1 ) == LUA_TSTRING )
     241        {
     242                str = lua_tolstring( m_state, -1, &l );
     243        }
     244        else
     245        {
     246                l = defval.size();
     247                str = defval.data();
     248        }
     249        string128 result( str, l );
     250        lua_pop( m_state, 1 );
     251        return result;
    252252}
    253253
Note: See TracChangeset for help on using the changeset viewer.