Changeset 368
- Timestamp:
- 05/22/15 10:28:08 (10 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 68 edited
- 14 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv.lua
r323 r368 4 4 kind "StaticLib" 5 5 includedirs { "." } 6 files { "nv/core/**.hh", "nv/ interface/**.hh", "nv/detail/**.inc", "src/core/**.cc"}6 files { "nv/core/**.hh", "nv/stl/**.hh", "nv/interface/**.hh", "nv/detail/**.inc", "src/core/**.cc", "src/stl/**.cc" } 7 7 8 8 project "nv-lib" -
trunk/nv/core/common.hh
r365 r368 137 137 #if NV_COMPILER == NV_MSVC 138 138 #define NV_DEPRECATED(func) __declspec(deprecated) func 139 #define NV_ALIGN(value) __declspec(align(value)) 140 #define NV_ALIGNED_STRUCT(value) __declspec(align(value)) struct 141 #define NV_RESTRICT __declspec(restrict) 142 #define NV_RESTRICT_VAR __restrict 143 //#define NV_CONSTEXPR 139 144 #elif NV_COMPILER == NV_GNUC || NV_COMPILER == NV_CLANG 140 145 #define NV_DEPRECATED(func) func __attribute__ ((deprecated)) 141 #else 146 #define NV_ALIGN(value) __attribute__((aligned(value))) 147 #define NV_ALIGNED_STRUCT(value) struct __attribute__((aligned(value))) 148 #define NV_RESTRICT __restrict__ 149 #define NV_RESTRICT_VAR __restrict__ 150 //#define NV_CONSTEXPR constexpr 151 #else 142 152 #define NV_DEPRECATED(func) func 153 #define NV_ALIGN(value) 154 #define NV_ALIGNED_STRUCT(value) struct 155 #define NV_RESTRICT 156 #define NV_RESTRICT_VAR 157 //#define NV_CONSTEXPR 143 158 #endif 144 159 -
trunk/nv/core/library.hh
r319 r368 14 14 #define NV_CORE_LIBRARY_HH 15 15 16 #include <nv/ core/exception.hh>17 #include <nv/ core/string.hh>16 #include <nv/stl/exception.hh> 17 #include <nv/stl/string.hh> 18 18 19 19 namespace nv -
trunk/nv/core/logger.hh
r366 r368 14 14 #define NV_CORE_LOGGER_HH 15 15 16 #include <nv/core/string.hh>17 16 #include <nv/core/logging.hh> 17 #include <nv/stl/string.hh> 18 18 19 19 namespace nv … … 35 35 virtual void log( log_level level, const string_ref& message ) = 0; 36 36 /** 37 * Optional timestamp string 38 */ 39 string_ref timestamp() const; 40 /** 41 * Log level name (unpadded) 42 */ 37 * Enforcement of virtual destructor. 38 */ 39 virtual ~log_sink() {} 40 protected: 41 /** 42 * Optional timestamp string 43 */ 44 size_t timestamp( char* buffer ) const; 45 /** 46 * Log level name (unpadded) 47 */ 43 48 string_ref level_name( log_level level ) const; 44 49 /** 45 46 50 * Log level name (padded) 51 */ 47 52 string_ref padded_level_name( log_level level ) const; 48 /**49 * Enforcement of virtual destructor.50 */51 virtual ~log_sink() {}52 53 }; 53 54 -
trunk/nv/core/logging.hh
r365 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/string.hh>18 #include <nv/ core/singleton.hh>17 #include <nv/stl/string.hh> 18 #include <nv/stl/singleton.hh> 19 19 #include <sstream> 20 20 -
trunk/nv/core/position.hh
r328 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/math.hh>18 #include <nv/ core/range.hh>17 #include <nv/stl/math.hh> 18 #include <nv/stl/range.hh> 19 19 #include <utility> 20 20 -
trunk/nv/core/profiler.hh
r322 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/singleton.hh>17 #include <nv/stl/singleton.hh> 18 18 #include <unordered_map> 19 19 -
trunk/nv/core/random.hh
r319 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/math.hh>11 #include <nv/stl/math.hh> 12 12 #include <random> 13 13 -
trunk/nv/core/transform.hh
r319 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/math.hh>11 #include <nv/stl/math.hh> 12 12 13 13 namespace nv -
trunk/nv/engine/particle_engine.hh
r353 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/math.hh>12 #include <nv/ core/array.hh>13 #include <nv/ core/handle.hh>11 #include <nv/stl/math.hh> 12 #include <nv/stl/array.hh> 13 #include <nv/stl/handle.hh> 14 14 #include <nv/lua/lua_state.hh> 15 15 #include <nv/gfx/texture_atlas.hh> -
trunk/nv/formats/md2_loader.hh
r319 r368 16 16 #include <nv/core/common.hh> 17 17 #include <unordered_map> 18 #include <nv/ core/array.hh>18 #include <nv/stl/array.hh> 19 19 #include <nv/interface/mesh_loader.hh> 20 20 -
trunk/nv/formats/md3_loader.hh
r319 r368 16 16 #include <nv/core/common.hh> 17 17 #include <unordered_map> 18 #include <nv/ core/array.hh>18 #include <nv/stl/array.hh> 19 19 #include <nv/core/transform.hh> 20 20 #include <nv/interface/mesh_data.hh> -
trunk/nv/formats/md5_loader.hh
r323 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/array.hh>17 #include <nv/stl/array.hh> 18 18 #include <nv/interface/mesh_loader.hh> 19 19 -
trunk/nv/gfx/animation.hh
r367 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/array.hh>11 #include <nv/stl/array.hh> 12 12 #include <nv/interface/stream.hh> 13 #include <nv/ core/math.hh>13 #include <nv/stl/math.hh> 14 14 #include <nv/interface/animation_key.hh> 15 15 #include <nv/interface/interpolation_raw.hh> -
trunk/nv/gfx/debug_draw.hh
r319 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/math.hh>11 #include <nv/stl/math.hh> 12 12 #include <nv/interface/context.hh> 13 13 -
trunk/nv/gfx/image.hh
r319 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/math.hh>11 #include <nv/stl/math.hh> 12 12 #include <nv/interface/image_data.hh> 13 13 -
trunk/nv/gfx/mesh_creator.hh
r319 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/math.hh>11 #include <nv/stl/math.hh> 12 12 #include <nv/interface/mesh_data.hh> 13 13 -
trunk/nv/gfx/sliced_buffer.hh
r323 r368 12 12 13 13 #include <nv/core/common.hh> 14 #include <nv/ core/math.hh>14 #include <nv/stl/math.hh> 15 15 16 16 namespace nv -
trunk/nv/gfx/texture_atlas.hh
r319 r368 11 11 12 12 #include <nv/core/common.hh> 13 #include <nv/ core/math.hh>13 #include <nv/stl/math.hh> 14 14 #include <nv/gfx/image.hh> 15 15 #include <vector> -
trunk/nv/gfx/texture_font.hh
r319 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/string.hh>11 #include <nv/stl/string.hh> 12 12 #include <unordered_map> 13 #include <nv/ core/math.hh>13 #include <nv/stl/math.hh> 14 14 #include <nv/gfx/texture_atlas.hh> 15 15 -
trunk/nv/gl/gl_enum.hh
r331 r368 13 13 #define NV_GL_ENUM_HH 14 14 15 #include <nv/ core/math.hh>15 #include <nv/stl/math.hh> 16 16 #include <nv/interface/clear_state.hh> 17 17 #include <nv/interface/render_state.hh> -
trunk/nv/gui/gui_ascii_renderer.hh
r355 r368 15 15 16 16 #include <nv/core/position.hh> 17 #include <nv/ core/math.hh>17 #include <nv/stl/math.hh> 18 18 #include <nv/interface/terminal.hh> 19 19 #include <nv/gui/gui_renderer.hh> -
trunk/nv/gui/gui_common.hh
r351 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/handle.hh>18 #include <nv/ core/flags.hh>17 #include <nv/stl/handle.hh> 18 #include <nv/stl/flags.hh> 19 19 20 20 namespace nv -
trunk/nv/gui/gui_element.hh
r351 r368 17 17 #include <nv/core/position.hh> 18 18 #include <nv/core/io_event.hh> 19 #include <nv/ core/string.hh>19 #include <nv/stl/string.hh> 20 20 #include <nv/gui/gui_common.hh> 21 21 #include <list> -
trunk/nv/gui/gui_environment.hh
r354 r368 19 19 #include <nv/core/io_event.hh> 20 20 #include <nv/interface/window.hh> 21 #include <nv/ core/array.hh>21 #include <nv/stl/array.hh> 22 22 23 23 namespace nv -
trunk/nv/gui/gui_renderer.hh
r354 r368 15 15 16 16 #include <nv/core/position.hh> 17 #include <nv/ core/math.hh>17 #include <nv/stl/math.hh> 18 18 #include <nv/gui/gui_common.hh> 19 19 #include <nv/gui/gui_style.hh> -
trunk/nv/interface/animated_mesh.hh
r319 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/math.hh>17 #include <nv/stl/math.hh> 18 18 #include <nv/core/transform.hh> 19 19 #include <nv/interface/context.hh> -
trunk/nv/interface/animation_key.hh
r323 r368 12 12 #include <nv/core/common.hh> 13 13 #include <nv/core/transform.hh> 14 #include <nv/ core/math.hh>14 #include <nv/stl/math.hh> 15 15 16 16 namespace nv -
trunk/nv/interface/audio.hh
r330 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/ core/math.hh>17 #include <nv/ core/handle.hh>16 #include <nv/stl/math.hh> 17 #include <nv/stl/handle.hh> 18 18 19 19 namespace nv -
trunk/nv/interface/camera.hh
r342 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/ core/math.hh>16 #include <nv/stl/math.hh> 17 17 18 18 namespace nv -
trunk/nv/interface/clear_state.hh
r342 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/math.hh>17 #include <nv/stl/math.hh> 18 18 19 19 namespace nv -
trunk/nv/interface/device.hh
r361 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/ core/string.hh>17 #include <nv/ core/handle.hh>16 #include <nv/stl/string.hh> 17 #include <nv/stl/handle.hh> 18 18 #include <nv/interface/uniform.hh> 19 19 #include <nv/interface/mesh_data.hh> -
trunk/nv/interface/image_data.hh
r351 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/math.hh>17 #include <nv/stl/math.hh> 18 18 #include <algorithm> 19 19 -
trunk/nv/interface/interpolation_raw.hh
r319 r368 12 12 #include <nv/core/common.hh> 13 13 #include <nv/core/transform.hh> 14 #include <nv/ core/math.hh>14 #include <nv/stl/math.hh> 15 15 #include <nv/interface/animation_key.hh> 16 16 -
trunk/nv/interface/interpolation_template.hh
r323 r368 12 12 #include <nv/core/common.hh> 13 13 #include <nv/core/transform.hh> 14 #include <nv/ core/math.hh>14 #include <nv/stl/math.hh> 15 15 #include <nv/interface/animation_key.hh> 16 16 -
trunk/nv/interface/map_area.hh
r323 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/core/string.hh>17 #include <nv/core/array.hh>18 16 #include <nv/core/position.hh> 17 #include <nv/stl/string.hh> 18 #include <nv/stl/array.hh> 19 19 20 20 namespace nv -
trunk/nv/interface/mesh_data.hh
r323 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/math.hh>12 #include <nv/ core/string.hh>13 #include <nv/ core/array.hh>11 #include <nv/stl/math.hh> 12 #include <nv/stl/string.hh> 13 #include <nv/stl/array.hh> 14 14 #include <nv/gfx/animation.hh> 15 15 #include <nv/interface/vertex.hh> -
trunk/nv/interface/mesh_loader.hh
r319 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/array.hh>17 #include <nv/stl/array.hh> 18 18 #include <unordered_map> 19 19 #include <nv/core/transform.hh> 20 #include <nv/ core/string.hh>20 #include <nv/stl/string.hh> 21 21 #include <nv/gfx/animation.hh> 22 22 #include <nv/interface/mesh_data.hh> -
trunk/nv/interface/render_state.hh
r322 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/math.hh>17 #include <nv/stl/math.hh> 18 18 #include <nv/interface/clear_state.hh> 19 #include <nv/ core/string.hh>19 #include <nv/stl/string.hh> 20 20 21 21 namespace nv -
trunk/nv/interface/scene_node.hh
r319 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/ core/array.hh>16 #include <nv/stl/array.hh> 17 17 #include <nv/core/transform.hh> 18 #include <nv/ core/math.hh>18 #include <nv/stl/math.hh> 19 19 #include <nv/interface/render_state.hh> 20 20 -
trunk/nv/interface/uniform.hh
r342 r368 15 15 #include <nv/interface/camera.hh> 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/string.hh>17 #include <nv/stl/string.hh> 18 18 #include <unordered_map> 19 19 -
trunk/nv/interface/vertex.hh
r323 r368 12 12 #include <nv/core/common.hh> 13 13 #include <nv/core/transform.hh> 14 #include <nv/ core/math.hh>14 #include <nv/stl/math.hh> 15 15 16 16 namespace nv -
trunk/nv/interface/window.hh
r343 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/core/string.hh>17 16 #include <nv/core/io_event.hh> 17 #include <nv/stl/string.hh> 18 18 19 19 namespace nv -
trunk/nv/interface/window_manager.hh
r364 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/ core/string.hh>16 #include <nv/stl/string.hh> 17 17 18 18 namespace nv -
trunk/nv/io/string_table.hh
r323 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/ core/array.hh>16 #include <nv/stl/array.hh> 17 17 #include <unordered_map> 18 18 #include <nv/interface/stream.hh> -
trunk/nv/lib/assimp.hh
r365 r368 10 10 #include <nv/core/common.hh> 11 11 #include <nv/core/logging.hh> 12 #include <nv/ core/string.hh>13 #include <nv/ core/math.hh>12 #include <nv/stl/string.hh> 13 #include <nv/stl/math.hh> 14 14 15 15 #define NV_ASSIMP_DYNAMIC -
trunk/nv/lua/lua_dispatch.hh
r348 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/string.hh>17 #include <nv/stl/string.hh> 18 18 #include <nv/lua/lua_values.hh> 19 19 #include <nv/lua/lua_path.hh> -
trunk/nv/lua/lua_flags.hh
r319 r368 8 8 9 9 #include <nv/core/common.hh> 10 #include <nv/ core/flags.hh>10 #include <nv/stl/flags.hh> 11 11 #include <nv/lua/lua_state.hh> 12 12 #include <nv/lua/lua_values.hh> -
trunk/nv/lua/lua_glm.hh
r319 r368 9 9 #include <new> 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/math.hh>11 #include <nv/stl/math.hh> 12 12 #include <nv/lua/lua_values.hh> 13 13 -
trunk/nv/lua/lua_handle.hh
r364 r368 8 8 9 9 #include <nv/core/common.hh> 10 #include <nv/ core/handle.hh>10 #include <nv/stl/handle.hh> 11 11 #include <nv/lua/lua_values.hh> 12 12 -
trunk/nv/lua/lua_path.hh
r360 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/string.hh>17 #include <nv/stl/string.hh> 18 18 #include <cstring> 19 19 -
trunk/nv/lua/lua_raw.hh
r367 r368 8 8 9 9 #include <nv/core/common.hh> 10 #include <nv/ core/array.hh>10 #include <nv/stl/array.hh> 11 11 #include <nv/lib/lua.hh> 12 12 -
trunk/nv/lua/lua_state.hh
r367 r368 13 13 14 14 #include <nv/core/common.hh> 15 #include <nv/ core/flags.hh>16 #include <nv/ core/handle.hh>15 #include <nv/stl/flags.hh> 16 #include <nv/stl/handle.hh> 17 17 18 18 #include <nv/lua/lua_handle.hh> -
trunk/nv/lua/lua_values.hh
r360 r368 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/ core/type_traits.hh>12 #include <nv/ core/string.hh>11 #include <nv/stl/type_traits.hh> 12 #include <nv/stl/string.hh> 13 13 14 14 struct lua_State; -
trunk/nv/stl/array.hh
r364 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/stl/memory.hh> 17 18 #include <vector> 18 19 #include <algorithm> … … 25 26 26 27 template< class T, std::size_t N > 27 class static_array 28 class static_array : public detail::data_base< T, false, N > 28 29 { 29 30 public: … … 39 40 typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 40 41 41 iterator begin() { return m_data; }42 const_iterator begin() const { return m_data; }43 const_iterator cbegin() const { return m_data; }44 45 iterator end() { return m_data+N; }46 const_iterator end() const { return m_data+N; }47 const_iterator cend() const { return m_data+N; }48 49 reverse_iterator rbegin() { return reverse_iterator( end() ); }50 const_reverse_iterator rbegin() const { return const_reverse_iterator( end() ); }51 const_reverse_iterator crbegin() const { return const_reverse_iterator( end() ); }52 53 reverse_iterator rend() { return reverse_iterator( begin() ); }54 const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }55 const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); }42 // iterator begin() { return m_data; } 43 // const_iterator begin() const { return m_data; } 44 // const_iterator cbegin() const { return m_data; } 45 // 46 // iterator end() { return m_data+N; } 47 // const_iterator end() const { return m_data+N; } 48 // const_iterator cend() const { return m_data+N; } 49 // 50 // reverse_iterator rbegin() { return reverse_iterator( end() ); } 51 // const_reverse_iterator rbegin() const { return const_reverse_iterator( end() ); } 52 // const_reverse_iterator crbegin() const { return const_reverse_iterator( end() ); } 53 // 54 // reverse_iterator rend() { return reverse_iterator( begin() ); } 55 // const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); } 56 // const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); } 56 57 57 58 reference operator[]( size_type i ) 58 59 { 59 60 NV_ASSERT( i < N, "Out of range" ); 60 return m_data[i];61 return this->m_data[i]; 61 62 } 62 63 … … 64 65 { 65 66 NV_ASSERT( i < N, "Out of range" ); 66 return m_data[i];67 return this->m_data[i]; 67 68 } 68 69 69 reference front() { return m_data[0]; } 70 const_reference front() const { return m_data[0]; } 71 reference back() { return m_data[N-1]; } 72 const_reference back() const { return m_data[N-1]; } 70 // reference front() { return m_data[0]; } 71 // const_reference front() const { return m_data[0]; } 72 // reference back() { return m_data[N-1]; } 73 // const_reference back() const { return m_data[N-1]; } 74 // 75 // static size_type size() { return N; } 76 // static bool empty() { return false; } 77 // static size_type max_size() { return N; } 78 // 79 // const value_type* data() const { return m_data; } 80 // value_type* data() { return m_data; } 81 // 82 // size_type raw_size() const { return N * ELEMENT_SIZE; } 83 // const char* raw_data() const { return (const char*)m_data; } 84 // char* raw_data() { return (char*)m_data; } 73 85 74 static size_type size() { return N; } 75 static bool empty() { return false; } 76 static size_type max_size() { return N; } 77 78 const value_type* data() const { return m_data; } 79 value_type* data() { return m_data; } 80 81 size_type raw_size() const { return N * ELEMENT_SIZE; } 82 const char* raw_data() const { return (const char*)m_data; } 83 char* raw_data() { return (char*)m_data; } 84 85 void assign( const value_type& value ) { std::fill_n( begin(), size(), value ); } 86 void assign( const value_type& value ) { std::fill_n( this->begin(), this->size(), value ); } 86 87 87 88 static const size_type SIZE = N; 88 89 static const size_type ELEMENT_SIZE = sizeof(T); 89 public:90 value_type m_data[N];91 90 }; 92 91 93 92 template< class T > 94 class dynamic_array 93 class dynamic_array : public detail::data_base< T, false, 0 > 95 94 { 96 95 public: … … 106 105 typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 107 106 108 dynamic_array() 109 : m_data( nullptr ), m_size(0) {} 110 explicit dynamic_array( size_type new_size ) 111 : m_data( new value_type[ new_size ] ), m_size( new_size ) {} 112 dynamic_array( const value_type& value, size_type size ) 113 : m_data( nullptr ), m_size(0) { assign( value, size ); } 114 dynamic_array( const_iterator values, size_type size ) 115 : m_data( nullptr ), m_size(0) { assign( values, size ); } 107 dynamic_array() : detail::data_base< T, false, 0 >() {} 108 // : m_data( nullptr ), m_size(0) {} 109 explicit dynamic_array( size_type new_size ) : detail::data_base< T, false, 0 >( new value_type[new_size], new_size ) {} 110 // : m_data( new value_type[ new_size ] ), m_size( new_size ) {} 111 dynamic_array( const value_type& value, size_type size ) : detail::data_base< T, false, 0 >() 112 // : m_data( nullptr ), m_size(0) 113 { assign( value, size ); } 114 dynamic_array( const_iterator values, size_type size ) : detail::data_base< T, false, 0 >() 115 // : m_data( nullptr ), m_size(0) 116 { assign( values, size ); } 116 117 117 118 void resize( size_type new_size ) 118 119 { 119 if ( new_size != m_size )120 if ( new_size != this->m_size ) 120 121 { 121 value_type* old_data = m_data;122 m_data = new_size > 0 ? new value_type[ new_size] : nullptr;123 if ( old_data && m_data )122 value_type* old_data = this->m_data; 123 this->m_data = new_size > 0 ? new value_type[new_size] : nullptr; 124 if ( old_data && this->m_data ) 124 125 { 125 std::copy_n( old_data, new_size > m_size ? m_size : new_size,m_data );126 std::copy_n( old_data, new_size > this->m_size ? this->m_size : new_size, this->m_data ); 126 127 } 127 128 delete[] old_data; 128 m_size = new_size;129 this->m_size = new_size; 129 130 } 130 131 } 131 132 132 iterator begin() { return m_data; }133 const_iterator begin() const { return m_data; }134 const_iterator cbegin() const { return m_data; }135 136 iterator end() { return m_data+m_size; }137 const_iterator end() const { return m_data+m_size; }138 const_iterator cend() const { return m_data+m_size; }139 140 reverse_iterator rbegin() { return reverse_iterator( end() ); }141 const_reverse_iterator rbegin() const { return const_reverse_iterator( end() ); }142 const_reverse_iterator crbegin() const { return const_reverse_iterator( end() ); }143 144 reverse_iterator rend() { return reverse_iterator( begin() ); }145 const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }146 const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); }133 // iterator begin() { return m_data; } 134 // const_iterator begin() const { return m_data; } 135 // const_iterator cbegin() const { return m_data; } 136 // 137 // iterator end() { return m_data+m_size; } 138 // const_iterator end() const { return m_data+m_size; } 139 // const_iterator cend() const { return m_data+m_size; } 140 // 141 // reverse_iterator rbegin() { return reverse_iterator( end() ); } 142 // const_reverse_iterator rbegin() const { return const_reverse_iterator( end() ); } 143 // const_reverse_iterator crbegin() const { return const_reverse_iterator( end() ); } 144 // 145 // reverse_iterator rend() { return reverse_iterator( begin() ); } 146 // const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); } 147 // const_reverse_iterator crend() const { return const_reverse_iterator( begin() ); } 147 148 148 149 reference operator[]( size_type i ) 149 150 { 150 NV_ASSERT( i < m_size, "Out of range" );151 return m_data[i];151 NV_ASSERT( i < this->m_size, "Out of range" ); 152 return this->m_data[i]; 152 153 } 153 154 154 155 const_reference operator[]( size_type i ) const 155 156 { 156 NV_ASSERT( i < m_size, "Out of range" );157 return m_data[i];157 NV_ASSERT( i < this->m_size, "Out of range" ); 158 return this->m_data[i]; 158 159 } 159 160 160 reference front() { return m_data[0]; } 161 const_reference front() const { return m_data[0]; } 162 reference back() { return m_data[m_size-1]; } 163 const_reference back() const { return m_data[m_size-1]; } 161 // reference front() { return m_data[0]; } 162 // const_reference front() const { return m_data[0]; } 163 // reference back() { return m_data[m_size-1]; } 164 // const_reference back() const { return m_data[m_size-1]; } 165 // 166 // size_type size() const { return m_size; } 167 // bool empty() const { return m_size == 0; } 168 // static size_type max_size() { return std::numeric_limits< size_type >::max(); } 169 // const value_type* data() const { return m_data; } 170 // value_type* data() { return m_data; } 171 // 172 // size_type raw_size() const { return m_size * ELEMENT_SIZE; } 173 // const char* raw_data() const { return (const char*)m_data; } 174 // char* raw_data() { return (char*)m_data; } 164 175 165 size_type size() const { return m_size; } 166 bool empty() const { return m_size == 0; } 167 static size_type max_size() { return std::numeric_limits< size_type >::max(); } 168 const value_type* data() const { return m_data; } 169 value_type* data() { return m_data; } 170 171 size_type raw_size() const { return m_size * ELEMENT_SIZE; } 172 const char* raw_data() const { return (const char*)m_data; } 173 char* raw_data() { return (char*)m_data; } 174 175 void assign( const value_type& value ) { std::fill_n( begin(), size(), value ); } 176 void assign( const value_type& value ) { std::fill_n( this->begin(), this->size(), value ); } 176 177 void assign( const value_type& value, size_type new_size ) 177 178 { 178 179 resize( new_size ); 179 std::fill_n( begin(),size(), value );180 std::fill_n( this->begin(), this->size(), value ); 180 181 } 181 182 void assign( const_iterator values, size_type new_size ) 182 183 { 183 184 resize( new_size ); 184 std::copy_n( values, size(),m_data );185 std::copy_n( values, this->size(), this->m_data ); 185 186 } 186 187 187 ~dynamic_array() { delete[] m_data; }188 ~dynamic_array() { delete[] this->m_data; } 188 189 189 190 static const size_type ELEMENT_SIZE = sizeof(T); 190 public:191 value_type* m_data;192 size_type m_size;193 191 }; 194 192 -
trunk/nv/stl/array2d.hh
r367 r368 17 17 18 18 #include <nv/core/common.hh> 19 #include <nv/ core/math.hh>20 #include <nv/ core/range.hh>19 #include <nv/stl/math.hh> 20 #include <nv/stl/range.hh> 21 21 22 22 namespace nv -
trunk/nv/stl/flags.hh
r364 r368 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/ core/type_traits.hh>18 #include <nv/ core/array.hh>17 #include <nv/stl/type_traits.hh> 18 #include <nv/stl/array.hh> 19 19 20 20 namespace nv -
trunk/nv/stl/handle.hh
r364 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/ core/array.hh>16 #include <nv/stl/array.hh> 17 17 18 18 namespace nv -
trunk/nv/stl/range.hh
r364 r368 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/ core/math.hh>17 #include <nv/ core/type_traits.hh>16 #include <nv/stl/math.hh> 17 #include <nv/stl/type_traits.hh> 18 18 #include <iterator> 19 19 -
trunk/nv/stl/string.hh
r367 r368 27 27 #include <fstream> 28 28 #include <nv/core/common.hh> 29 #include <nv/core/exception.hh> 29 #include <nv/stl/memory.hh> 30 #include <nv/stl/exception.hh> 30 31 31 32 namespace nv … … 296 297 297 298 // string base class - will become a base for a string class later 298 class string_base 299 class string_base : public detail::data_base< char, true, 0 > 299 300 { 300 301 public: … … 308 309 typedef std::ptrdiff_t difference_type; 309 310 310 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;311 typedef const_reverse_iterator reverse_iterator;312 313 311 static NV_CONSTEXPR_CONST size_type npos = size_type( -1 ); 314 312 … … 319 317 } 320 318 321 // iterators322 inline NV_CONSTEXPR const_iterator cbegin() const { return m_data; }323 inline NV_CONSTEXPR const_iterator cend() const { return m_data + m_size; }324 inline const_reverse_iterator crbegin() const { return const_reverse_iterator( cend() ); }325 inline const_reverse_iterator crend() const { return const_reverse_iterator( cbegin() ); }326 327 inline NV_CONSTEXPR size_type size() const { return m_size; }328 319 inline NV_CONSTEXPR size_type length() const { return m_size; } 329 inline NV_CONSTEXPR size_type max_size() const { return m_size; }330 inline NV_CONSTEXPR bool empty() const { return m_size == 0; }331 320 332 321 // access … … 340 329 inline NV_CONSTEXPR char front() const { return m_data[0]; } 341 330 inline NV_CONSTEXPR char back() const { return m_data[m_size - 1]; } 342 inline NV_CONSTEXPR const char* data() const { return m_data; }343 331 344 332 // string operations … … 442 430 443 431 protected: 444 inline NV_CONSTEXPR string_base() : m_data( nullptr ), m_size( 0) {}432 inline NV_CONSTEXPR string_base() : detail::data_base< char, true, 0 >() {} 445 433 inline NV_CONSTEXPR string_base( pointer a_data, size_type a_lenght ) 446 : m_data( a_data ), m_size( a_lenght ) {} 447 448 protected: 449 pointer m_data; 450 size_type m_size; 434 : detail::data_base< char, true, 0 >( a_data, a_lenght ) {} 451 435 }; 452 436 … … 494 478 return *this; 495 479 } 496 497 // iterators498 inline NV_CONSTEXPR const_iterator begin() const { return m_data; }499 inline NV_CONSTEXPR const_iterator end() const { return m_data + m_size; }500 inline const_reverse_iterator rbegin() const { return const_reverse_iterator( end() ); }501 inline const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }502 480 503 481 // modifiers -
trunk/src/core/logger.cc
r365 r368 142 142 void log_console_sink::log( log_level level, const string_ref& message ) 143 143 { 144 char stamp[16]; 145 size_t ssize = timestamp( stamp ); 146 144 147 #if NV_PLATFORM == NV_WINDOWS 145 148 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 ); 148 150 WriteConsole( m_handle, " [", 2, nullptr, nullptr ); 149 151 if (m_color) SetConsoleTextAttribute( m_handle, log_color[( level ) / 10] ); … … 156 158 #else 157 159 if ( m_color ) fwrite( "\33[30;1m", 7, 1, stdout ); 158 fwrite( stamp .data(), stamp.size(), 1, stdout );160 fwrite( stamp, ssize, 1, stdout ); 159 161 fwrite( " [", 2, 1, stdout ); 160 162 if ( m_color ) … … 176 178 void log_handle_sink::log( log_level level, const string_ref& message ) 177 179 { 178 string_ref stamp( timestamp() ); 180 char stamp[16]; 181 size_t ssize = timestamp( stamp ); 179 182 #if 0 // NV_PLATFORM == NV_WINDOWS 180 183 // Turns out WriteFile on Windows is unbuffered and quite slower than fwrite … … 182 185 // If we want to get rid of C runtime, this would need a buffered I/O layer. 183 186 DWORD unused = 0; 184 WriteFile( m_handle, stamp .data(), stamp.size(), &unused, nullptr );187 WriteFile( m_handle, stamp, ssize, &unused, nullptr ); 185 188 WriteFile( m_handle, " [", 2, &unused, nullptr ); 186 189 WriteFile( m_handle, NV_LOG_LEVEL_NAME_PAD( level ), 8, &unused, nullptr ); … … 190 193 //if ( m_flush ) FlushFileBuffers( m_handle ); 191 194 #else 192 fwrite( stamp .data(), stamp.size(), 1, (FILE*)m_handle );195 fwrite( stamp, ssize, 1, (FILE*)m_handle ); 193 196 fwrite( " [", 2, 1, (FILE*)m_handle ); 194 197 fwrite( NV_LOG_LEVEL_NAME_PAD( level ), 8, 1, (FILE*)m_handle ); … … 237 240 } 238 241 239 s tring_ref nv::log_sink::timestamp() const242 size_t nv::log_sink::timestamp( char* buffer ) const 240 243 { 241 244 uint32 ms = get_system_ms(); … … 245 248 unsigned int m = (unsigned int)(secs / 60) % 60; 246 249 unsigned int s = secs % 60; 247 static char buffer[16];248 250 #if NV_PLATFORM == NV_WINDOWS 249 251 sprintf_s( buffer, 16, "%02d:%02d:%02d.%02d", h, m, s, mm ); … … 251 253 snprintf( buffer, 16, "%02d:%02d:%02d.%02d", h, m, s, mm ); 252 254 #endif 253 buffer[11] = '\0'; 254 return string_ref( buffer, 10 ); 255 return 11; 255 256 } 256 257 -
trunk/src/engine/program_manager.cc
r365 r368 6 6 7 7 #include "nv/engine/program_manager.hh" 8 #include "nv/ core/range.hh"8 #include "nv/stl/range.hh" 9 9 #include "nv/core/logging.hh" 10 10 #include "nv/lua/lua_nova.hh" -
trunk/src/engine/resource_system.cc
r364 r368 6 6 7 7 #include "nv/engine/resource_system.hh" 8 #include "nv/ core/range.hh"8 #include "nv/stl/range.hh" 9 9 #include "nv/lua/lua_nova.hh" 10 10 -
trunk/src/formats/nmd_loader.cc
r323 r368 7 7 #include "nv/formats/nmd_loader.hh" 8 8 #include "nv/io/std_stream.hh" 9 #include "nv/ core/string.hh"9 #include "nv/stl/string.hh" 10 10 11 11 using namespace nv; -
trunk/src/lib/gl.cc
r365 r368 6 6 7 7 #include "nv/core/common.hh" 8 #include "nv/ core/range.hh"8 #include "nv/stl/range.hh" 9 9 #include "nv/core/logging.hh" 10 10 #include "nv/lib/gl.hh" -
trunk/src/lua/lua_area.cc
r335 r368 8 8 9 9 #include "nv/lua/lua_raw.hh" 10 #include "nv/ core/string.hh"10 #include "nv/stl/string.hh" 11 11 #include "nv/core/random.hh" 12 12 -
trunk/src/lua/lua_flags.cc
r319 r368 8 8 9 9 #include "nv/lua/lua_raw.hh" 10 #include "nv/ core/string.hh"10 #include "nv/stl/string.hh" 11 11 12 12 -
trunk/src/lua/lua_glm.cc
r319 r368 8 8 9 9 #include "nv/lua/lua_raw.hh" 10 #include "nv/ core/string.hh"10 #include "nv/stl/string.hh" 11 11 #include "nv/core/random.hh" 12 12 -
trunk/src/lua/lua_map_area.cc
r360 r368 6 6 7 7 #include "nv/lua/lua_map_area.hh" 8 #include "nv/ core/flags.hh"8 #include "nv/stl/flags.hh" 9 9 #include "nv/lua/lua_area.hh" 10 10 #include "nv/lua/lua_glm.hh" -
trunk/src/lua/lua_map_tile.cc
r323 r368 9 9 #include <numeric> 10 10 #include "nv/lua/lua_map_area.hh" 11 #include "nv/ core/flags.hh"11 #include "nv/stl/flags.hh" 12 12 #include "nv/core/random.hh" 13 13 #include "nv/lua/lua_area.hh" -
trunk/src/lua/lua_raw.cc
r319 r368 7 7 #include "nv/lua/lua_raw.hh" 8 8 9 #include "nv/ core/string.hh"9 #include "nv/stl/string.hh" 10 10 11 11 std::string nlua_typecontent( lua_State* L, int idx ) -
trunk/src/lua/lua_state.cc
r367 r368 10 10 #include "nv/lua/lua_nova.hh" 11 11 #include "nv/core/logging.hh" 12 #include "nv/ core/string.hh"12 #include "nv/stl/string.hh" 13 13 14 14 using namespace nv; -
trunk/src/rogue/fov_recursive_shadowcasting.cc
r319 r368 7 7 #include "nv/rogue/fov_recursive_shadowcasting.hh" 8 8 9 #include "nv/ core/math.hh"9 #include "nv/stl/math.hh" 10 10 11 11 static int nv_rogue_rs_mult[4][8] = { -
trunk/src/sdl/sdl_audio.cc
r367 r368 7 7 #include "nv/sdl/sdl_audio.hh" 8 8 9 #include "nv/ core/math.hh"9 #include "nv/stl/math.hh" 10 10 #include "nv/lib/sdl_mixer.hh" 11 11 #include "nv/core/logging.hh" -
trunk/src/stl/string.cc
r367 r368 7 7 // TODO: speedup conversion by doing divisions by 100 8 8 9 #include "nv/ core/string.hh"9 #include "nv/stl/string.hh" 10 10 11 11 #include <cstdio>
Note: See TracChangeset
for help on using the changeset viewer.