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_path.cc

    r435 r440  
    7474}
    7575
    76 std::string nv::lua::path::to_string() const
     76string128 nv::lua::path::to_string() const
    7777{
    78         char buffer[64];
    79         char* start   = buffer;
    80         char* current = buffer;
     78        string128 buffer;
    8179        bool dot = false;
    82         bool oos = false;
    8380        for ( const element& e : m_elements )
    8481        {
    85                 if ( current - start > 48 ) { oos = true; break; }
    86                 if ( dot ) *current++ = '.';
     82                if ( dot ) buffer.append( "." );
    8783                if ( e.length == 0 )
    8884                {
    89                         *current++ = '[';
    90                         current += uint32_to_buffer( array_ref< char >( current, current - start ), e.value );
    91                         *current++ = ']';
     85                        buffer.append( "["_ls + e.value + "]"_ls );
    9286                        dot = false;
    9387                }
    9488                else
    9589                {
    96                         if ( size_t(current - start) + e.length > 60 ) { oos = true; break; }
    97                         nvmemcpy( current, e.str, e.length );
    98                         current += e.length;
     90                        buffer.append( e.str, e.length );
    9991                        dot = true;
    10092                }
    10193        }
    102         if (oos)
    103         {
    104                 *current++ = '.';
    105                 *current++ = '.';
    106                 *current++ = '.';
    107         }
    108         *current++ = '\0';
    109         return std::string( buffer, size_t(current - start - 1) );
     94        return buffer;
    11095}
Note: See TracChangeset for help on using the changeset viewer.