Changeset 368 for trunk/src


Ignore:
Timestamp:
05/22/15 10:28:08 (10 years ago)
Author:
epyon
Message:
  • massive restructuring
  • detail::data_base class for container/reference class base
Location:
trunk/src
Files:
1 added
14 edited
1 moved

Legend:

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

    r365 r368  
    142142void log_console_sink::log( log_level level, const string_ref& message )
    143143{
     144        char stamp[16];
     145        size_t ssize = timestamp( stamp );
     146
    144147#if NV_PLATFORM == NV_WINDOWS
    145148        if ( m_color ) SetConsoleTextAttribute( m_handle, FOREGROUND_INTENSITY );
    146         string_ref stamp( timestamp() );
    147         WriteConsole( m_handle, stamp.data(), stamp.size(), nullptr, nullptr );
     149        WriteConsole( m_handle, stamp, ssize, nullptr, nullptr );
    148150        WriteConsole( m_handle, " [", 2, nullptr, nullptr );
    149151        if (m_color) SetConsoleTextAttribute( m_handle, log_color[( level ) / 10] );
     
    156158#else
    157159        if ( m_color ) fwrite( "\33[30;1m", 7, 1, stdout );
    158         fwrite( stamp.data(), stamp.size(), 1, stdout );
     160        fwrite( stamp, ssize, 1, stdout );
    159161        fwrite( " [", 2, 1, stdout );
    160162        if ( m_color )
     
    176178void log_handle_sink::log( log_level level, const string_ref& message )
    177179{
    178         string_ref stamp( timestamp() );
     180        char stamp[16];
     181        size_t ssize = timestamp( stamp );
    179182#if 0 // NV_PLATFORM == NV_WINDOWS
    180183        // Turns out WriteFile on Windows is unbuffered and quite slower than fwrite
     
    182185        // If we want to get rid of C runtime, this would need a buffered I/O layer.
    183186        DWORD unused = 0;
    184         WriteFile( m_handle, stamp.data(), stamp.size(), &unused, nullptr );
     187        WriteFile( m_handle, stamp, ssize, &unused, nullptr );
    185188        WriteFile( m_handle, " [", 2, &unused, nullptr );
    186189        WriteFile( m_handle, NV_LOG_LEVEL_NAME_PAD( level ), 8, &unused, nullptr );
     
    190193        //if ( m_flush ) FlushFileBuffers( m_handle );
    191194#else
    192         fwrite( stamp.data(), stamp.size(), 1, (FILE*)m_handle );
     195        fwrite( stamp, ssize, 1, (FILE*)m_handle );
    193196        fwrite( " [", 2, 1, (FILE*)m_handle );
    194197        fwrite( NV_LOG_LEVEL_NAME_PAD( level ), 8, 1, (FILE*)m_handle );
     
    237240}
    238241
    239 string_ref nv::log_sink::timestamp() const
     242size_t nv::log_sink::timestamp( char* buffer ) const
    240243{
    241244        uint32 ms = get_system_ms();
     
    245248        unsigned int m    = (unsigned int)(secs / 60) % 60;
    246249        unsigned int s    = secs % 60;
    247         static char buffer[16];
    248250#if NV_PLATFORM == NV_WINDOWS
    249251        sprintf_s( buffer, 16, "%02d:%02d:%02d.%02d", h, m, s, mm );
     
    251253        snprintf( buffer, 16, "%02d:%02d:%02d.%02d", h, m, s, mm );
    252254#endif
    253         buffer[11] = '\0';
    254         return string_ref( buffer, 10 );
     255        return 11;
    255256}
    256257
  • trunk/src/engine/program_manager.cc

    r365 r368  
    66
    77#include "nv/engine/program_manager.hh"
    8 #include "nv/core/range.hh"
     8#include "nv/stl/range.hh"
    99#include "nv/core/logging.hh"
    1010#include "nv/lua/lua_nova.hh"
  • trunk/src/engine/resource_system.cc

    r364 r368  
    66
    77#include "nv/engine/resource_system.hh"
    8 #include "nv/core/range.hh"
     8#include "nv/stl/range.hh"
    99#include "nv/lua/lua_nova.hh"
    1010
  • trunk/src/formats/nmd_loader.cc

    r323 r368  
    77#include "nv/formats/nmd_loader.hh"
    88#include "nv/io/std_stream.hh"
    9 #include "nv/core/string.hh"
     9#include "nv/stl/string.hh"
    1010
    1111using namespace nv;
  • trunk/src/lib/gl.cc

    r365 r368  
    66
    77#include "nv/core/common.hh"
    8 #include "nv/core/range.hh"
     8#include "nv/stl/range.hh"
    99#include "nv/core/logging.hh"
    1010#include "nv/lib/gl.hh"
  • trunk/src/lua/lua_area.cc

    r335 r368  
    88
    99#include "nv/lua/lua_raw.hh"
    10 #include "nv/core/string.hh"
     10#include "nv/stl/string.hh"
    1111#include "nv/core/random.hh"
    1212
  • trunk/src/lua/lua_flags.cc

    r319 r368  
    88
    99#include "nv/lua/lua_raw.hh"
    10 #include "nv/core/string.hh"
     10#include "nv/stl/string.hh"
    1111
    1212
  • trunk/src/lua/lua_glm.cc

    r319 r368  
    88
    99#include "nv/lua/lua_raw.hh"
    10 #include "nv/core/string.hh"
     10#include "nv/stl/string.hh"
    1111#include "nv/core/random.hh"
    1212
  • trunk/src/lua/lua_map_area.cc

    r360 r368  
    66
    77#include "nv/lua/lua_map_area.hh"
    8 #include "nv/core/flags.hh"
     8#include "nv/stl/flags.hh"
    99#include "nv/lua/lua_area.hh"
    1010#include "nv/lua/lua_glm.hh"
  • trunk/src/lua/lua_map_tile.cc

    r323 r368  
    99#include <numeric>
    1010#include "nv/lua/lua_map_area.hh"
    11 #include "nv/core/flags.hh"
     11#include "nv/stl/flags.hh"
    1212#include "nv/core/random.hh"
    1313#include "nv/lua/lua_area.hh"
  • trunk/src/lua/lua_raw.cc

    r319 r368  
    77#include "nv/lua/lua_raw.hh"
    88
    9 #include "nv/core/string.hh"
     9#include "nv/stl/string.hh"
    1010
    1111std::string nlua_typecontent( lua_State* L, int idx )
  • trunk/src/lua/lua_state.cc

    r367 r368  
    1010#include "nv/lua/lua_nova.hh"
    1111#include "nv/core/logging.hh"
    12 #include "nv/core/string.hh"
     12#include "nv/stl/string.hh"
    1313
    1414using namespace nv;
  • trunk/src/rogue/fov_recursive_shadowcasting.cc

    r319 r368  
    77#include "nv/rogue/fov_recursive_shadowcasting.hh"
    88
    9 #include "nv/core/math.hh"
     9#include "nv/stl/math.hh"
    1010
    1111static int nv_rogue_rs_mult[4][8] = {
  • trunk/src/sdl/sdl_audio.cc

    r367 r368  
    77#include "nv/sdl/sdl_audio.hh"
    88
    9 #include "nv/core/math.hh"
     9#include "nv/stl/math.hh"
    1010#include "nv/lib/sdl_mixer.hh"
    1111#include "nv/core/logging.hh"
  • trunk/src/stl/string.cc

    r367 r368  
    77// TODO: speedup conversion by doing divisions by 100
    88
    9 #include "nv/core/string.hh"
     9#include "nv/stl/string.hh"
    1010
    1111#include <cstdio>
Note: See TracChangeset for help on using the changeset viewer.