Daniele Bartolini 3 лет назад
Родитель
Сommit
b09bf0100d

+ 12 - 12
src/core/filesystem/file_buffer.inl

@@ -29,55 +29,55 @@ struct FileBuffer : public File
 		CE_NOOP();
 	}
 
-	virtual void open(const char *path, FileOpenMode::Enum mode)
+	virtual void open(const char *path, FileOpenMode::Enum mode) override
 	{
 		CE_UNUSED(path);
 		CE_UNUSED(mode);
 		CE_NOOP();
 	}
 
-	virtual void close()
+	virtual void close() override
 	{
 		_buffer = NULL;
 		_position = 0;
 	}
 
-	virtual bool is_open()
+	virtual bool is_open() override
 	{
 		return _buffer != NULL;
 	}
 
-	virtual u32 size()
+	virtual u32 size() override
 	{
 		return array::size(*_buffer);
 	}
 
-	virtual u32 position()
+	virtual u32 position() override
 	{
 		return _position;
 	}
 
-	virtual bool end_of_file()
+	virtual bool end_of_file() override
 	{
 		return _position == array::size(*_buffer);
 	}
 
-	virtual void seek(u32 position)
+	virtual void seek(u32 position) override
 	{
 		_position = min(array::size(*_buffer), position);
 	}
 
-	virtual void seek_to_end()
+	virtual void seek_to_end() override
 	{
 		_position = array::size(*_buffer);
 	}
 
-	virtual void skip(u32 bytes)
+	virtual void skip(u32 bytes) override
 	{
 		seek(_position + bytes);
 	}
 
-	virtual u32 read(void *data, u32 size)
+	virtual u32 read(void *data, u32 size) override
 	{
 		const u32 rest = array::size(*_buffer) - _position;
 		const u32 num = min(size, rest);
@@ -86,7 +86,7 @@ struct FileBuffer : public File
 		return num;
 	}
 
-	virtual u32 write(const void *data, u32 size)
+	virtual u32 write(const void *data, u32 size) override
 	{
 		_buffer->_size = _position;
 		array::push(*_buffer, (const char *)data, size);
@@ -94,7 +94,7 @@ struct FileBuffer : public File
 		return size;
 	}
 
-	virtual void flush()
+	virtual void flush() override
 	{
 		CE_NOOP();
 	}

+ 12 - 12
src/core/filesystem/filesystem_disk.cpp

@@ -49,7 +49,7 @@ struct FileDisk : public File
 		close();
 	}
 
-	void open(const char *path, FileOpenMode::Enum mode)
+	void open(const char *path, FileOpenMode::Enum mode) override
 	{
 #if CROWN_PLATFORM_WINDOWS
 		_file = CreateFile(path
@@ -65,7 +65,7 @@ struct FileDisk : public File
 #endif
 	}
 
-	void close()
+	void close() override
 	{
 		if (is_open()) {
 #if CROWN_PLATFORM_WINDOWS
@@ -78,7 +78,7 @@ struct FileDisk : public File
 		}
 	}
 
-	bool is_open()
+	bool is_open() override
 	{
 #if CROWN_PLATFORM_WINDOWS
 		return _file != INVALID_HANDLE_VALUE;
@@ -87,7 +87,7 @@ struct FileDisk : public File
 #endif
 	}
 
-	u32 size()
+	u32 size() override
 	{
 		CE_ASSERT(is_open(), "File is not open");
 #if CROWN_PLATFORM_WINDOWS
@@ -99,7 +99,7 @@ struct FileDisk : public File
 #endif
 	}
 
-	u32 position()
+	u32 position() override
 	{
 		CE_ASSERT(is_open(), "File is not open");
 #if CROWN_PLATFORM_WINDOWS
@@ -116,7 +116,7 @@ struct FileDisk : public File
 #endif
 	}
 
-	bool end_of_file()
+	bool end_of_file() override
 	{
 		CE_ASSERT(is_open(), "File is not open");
 #if CROWN_PLATFORM_WINDOWS
@@ -126,7 +126,7 @@ struct FileDisk : public File
 #endif
 	}
 
-	void seek(u32 position)
+	void seek(u32 position) override
 	{
 		CE_ASSERT(is_open(), "File is not open");
 #if CROWN_PLATFORM_WINDOWS
@@ -142,7 +142,7 @@ struct FileDisk : public File
 		CE_UNUSED(err);
 	}
 
-	void seek_to_end()
+	void seek_to_end() override
 	{
 		CE_ASSERT(is_open(), "File is not open");
 #if CROWN_PLATFORM_WINDOWS
@@ -158,7 +158,7 @@ struct FileDisk : public File
 		CE_UNUSED(err);
 	}
 
-	void skip(u32 bytes)
+	void skip(u32 bytes) override
 	{
 		CE_ASSERT(is_open(), "File is not open");
 #if CROWN_PLATFORM_WINDOWS
@@ -174,7 +174,7 @@ struct FileDisk : public File
 		CE_UNUSED(err);
 	}
 
-	u32 read(void *data, u32 size)
+	u32 read(void *data, u32 size) override
 	{
 		CE_ASSERT(is_open(), "File is not open");
 		CE_ASSERT(data != NULL, "Data must be != NULL");
@@ -191,7 +191,7 @@ struct FileDisk : public File
 #endif
 	}
 
-	u32 write(const void *data, u32 size)
+	u32 write(const void *data, u32 size) override
 	{
 		CE_ASSERT(is_open(), "File is not open");
 		CE_ASSERT(data != NULL, "Data must be != NULL");
@@ -210,7 +210,7 @@ struct FileDisk : public File
 #endif
 	}
 
-	void flush()
+	void flush() override
 	{
 		CE_ASSERT(is_open(), "File is not open");
 #if CROWN_PLATFORM_WINDOWS

+ 12 - 12
src/core/filesystem/filesystem_disk.h

@@ -32,40 +32,40 @@ struct FilesystemDisk : public Filesystem
 	void set_prefix(const char *prefix);
 
 	/// @copydoc Filesystem::open()
-	File *open(const char *path, FileOpenMode::Enum mode);
+	File *open(const char *path, FileOpenMode::Enum mode) override;
 
 	/// @copydoc Filesystem::close()
-	void close(File &file);
+	void close(File &file) override;
 
 	/// @copydoc Filesystem::stat()
-	Stat stat(const char *path);
+	Stat stat(const char *path) override;
 
 	/// @copydoc Filesystem::exists()
-	bool exists(const char *path);
+	bool exists(const char *path) override;
 
 	/// @copydoc Filesystem::is_directory()
-	bool is_directory(const char *path);
+	bool is_directory(const char *path) override;
 
 	/// @copydoc Filesystem::is_file()
-	bool is_file(const char *path);
+	bool is_file(const char *path) override;
 
 	/// @copydoc Filesystem::last_modified_time()
-	u64 last_modified_time(const char *path);
+	u64 last_modified_time(const char *path) override;
 
 	/// @copydoc Filesystem::create_directory()
-	CreateResult create_directory(const char *path);
+	CreateResult create_directory(const char *path) override;
 
 	/// @copydoc Filesystem::delete_directory()
-	DeleteResult delete_directory(const char *path);
+	DeleteResult delete_directory(const char *path) override;
 
 	/// @copydoc Filesystem::delete_file()
-	DeleteResult delete_file(const char *path);
+	DeleteResult delete_file(const char *path) override;
 
 	/// @copydoc Filesystem::list_files()
-	void list_files(const char *path, Vector<DynamicString> &files);
+	void list_files(const char *path, Vector<DynamicString> &files) override;
 
 	/// @copydoc Filesystem::absolute_path()
-	void absolute_path(DynamicString &os_path, const char *path);
+	void absolute_path(DynamicString &os_path, const char *path) override;
 };
 
 } // namespace crown

+ 9 - 9
src/core/memory/globals.cpp

@@ -123,7 +123,7 @@ namespace memory
 		}
 
 		/// @copydoc Allocator::allocate()
-		void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN)
+		void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN) override
 		{
 			ScopedMutex sm(_mutex);
 
@@ -143,7 +143,7 @@ namespace memory
 		}
 
 		/// @copydoc Allocator::deallocate()
-		void deallocate(void *data)
+		void deallocate(void *data) override
 		{
 			ScopedMutex sm(_mutex);
 
@@ -158,7 +158,7 @@ namespace memory
 			free(h);
 		}
 
-		void *reallocate(void *data, u32 size, u32 align)
+		void *reallocate(void *data, u32 size, u32 align) override
 		{
 			if (!data)
 				return allocate((u32)size, (u32)align == 0 ? 16 : (u32)align);
@@ -181,13 +181,13 @@ namespace memory
 		}
 
 		/// @copydoc Allocator::allocated_size()
-		u32 allocated_size(const void *ptr)
+		u32 allocated_size(const void *ptr) override
 		{
 			return get_size(ptr);
 		}
 
 		/// @copydoc Allocator::total_allocated()
-		u32 total_allocated()
+		u32 total_allocated() override
 		{
 			ScopedMutex sm(_mutex);
 			return _allocated_size;
@@ -260,7 +260,7 @@ namespace memory
 			return p >= _free || p < _allocate;
 		}
 
-		void *allocate(u32 size, u32 align)
+		void *allocate(u32 size, u32 align) override
 		{
 			ScopedMutex sm(_mutex);
 
@@ -291,7 +291,7 @@ namespace memory
 			return data;
 		}
 
-		void deallocate(void *p)
+		void deallocate(void *p) override
 		{
 			ScopedMutex sm(_mutex);
 
@@ -320,14 +320,14 @@ namespace memory
 			}
 		}
 
-		u32 allocated_size(const void *p)
+		u32 allocated_size(const void *p) override
 		{
 			ScopedMutex sm(_mutex);
 			Header *h = header(p);
 			return h->size - u32((char *)p - (char *)h);
 		}
 
-		u32 total_allocated()
+		u32 total_allocated() override
 		{
 			ScopedMutex sm(_mutex);
 			return u32(_end - _begin);

+ 6 - 4
src/core/memory/linear_allocator.h

@@ -25,29 +25,31 @@ struct LinearAllocator : public Allocator
 
 	/// Uses @a size bytes of memory from @a start.
 	LinearAllocator(void *start, u32 size);
+
+	///
 	~LinearAllocator();
 
 	/// @copydoc Allocator::allocate()
-	void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN);
+	void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN) override;
 
 	/// @copydoc Allocator::deallocate()
 	/// @note
 	/// The linear allocator does not support deallocating
 	/// individual allocations, rather you have to call
 	/// clear() to free all allocated memory at once.
-	void deallocate(void *data);
+	void deallocate(void *data) override;
 
 	/// Frees all the allocations made by allocate()
 	void clear();
 
 	/// @copydoc Allocator::allocated_size()
-	u32 allocated_size(const void * /*ptr*/)
+	u32 allocated_size(const void * /*ptr*/) override
 	{
 		return SIZE_NOT_TRACKED;
 	}
 
 	/// @copydoc Allocator::total_allocated()
-	u32 total_allocated()
+	u32 total_allocated() override
 	{
 		return _offset;
 	}

+ 6 - 4
src/core/memory/pool_allocator.h

@@ -28,24 +28,26 @@ struct PoolAllocator : public Allocator
 	/// Uses @a backing to allocate the memory pool for containing exactly
 	/// @a num_blocks blocks of @a block_size size each aligned to @a block_align.
 	PoolAllocator(Allocator &backing, u32 num_blocks, u32 block_size, u32 block_align = Allocator::DEFAULT_ALIGN);
+
+	///
 	~PoolAllocator();
 
 	/// Allocates a block of memory from the memory pool.
 	/// @note
 	/// The @a size and @a align must match those passed to PoolAllocator::PoolAllocator()
-	void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN);
+	void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN) override;
 
 	/// @copydoc Allocator::deallocate()
-	void deallocate(void *data);
+	void deallocate(void *data) override;
 
 	/// @copydoc Allocator::allocated_size()
-	u32 allocated_size(const void * /*ptr*/)
+	u32 allocated_size(const void * /*ptr*/) override
 	{
 		return SIZE_NOT_TRACKED;
 	}
 
 	/// @copydoc Allocator::total_allocated()
-	u32 total_allocated();
+	u32 total_allocated() override;
 };
 
 } // namespace crown

+ 5 - 5
src/core/memory/proxy_allocator.h

@@ -21,22 +21,22 @@ struct ProxyAllocator : public Allocator
 	ProxyAllocator(Allocator &allocator, const char *name);
 
 	/// @copydoc Allocator::allocate()
-	void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN);
+	void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN) override;
 
 	/// @copydoc Allocator::deallocate()
-	void deallocate(void *data);
+	void deallocate(void *data) override;
 
 	/// @copydoc Allocator::reallocate().
-	virtual void *reallocate(void *data, u32 size, u32 align = DEFAULT_ALIGN);
+	virtual void *reallocate(void *data, u32 size, u32 align = DEFAULT_ALIGN) override;
 
 	/// @copydoc Allocator::allocated_size()
-	u32 allocated_size(const void *ptr)
+	u32 allocated_size(const void *ptr) override
 	{
 		return _allocator.allocated_size(ptr);
 	}
 
 	/// @copydoc Allocator::total_allocated()
-	u32 total_allocated()
+	u32 total_allocated() override
 	{
 		return _allocator.total_allocated();
 	}

+ 7 - 4
src/core/memory/stack_allocator.h

@@ -27,26 +27,29 @@ struct StackAllocator : public Allocator
 	u32 _total_size;
 	u32 _allocation_count;
 
+	///
 	StackAllocator(char *begin, u32 size);
+
+	///
 	~StackAllocator();
 
 	/// @copydoc Allocator::allocate()
-	void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN);
+	void *allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN) override;
 
 	/// @copydoc Allocator::deallocate()
 	/// @note
 	/// Deallocations must occur in LIFO order i.e. the
 	/// last allocation must be freed for first.
-	void deallocate(void *data);
+	void deallocate(void *data) override;
 
 	/// @copydoc Allocator::allocated_size()
-	u32 allocated_size(const void * /*ptr*/)
+	u32 allocated_size(const void * /*ptr*/) override
 	{
 		return SIZE_NOT_TRACKED;
 	}
 
 	/// @copydoc Allocator::total_allocated()
-	u32 total_allocated();
+	u32 total_allocated() override;
 };
 
 } // namespace crown

+ 5 - 4
src/core/memory/temp_allocator.inl

@@ -40,22 +40,23 @@ struct TempAllocator : public Allocator
 	///
 	virtual ~TempAllocator();
 
-	virtual void *allocate(u32 size, u32 align = DEFAULT_ALIGN);
+	///
+	virtual void *allocate(u32 size, u32 align = DEFAULT_ALIGN) override;
 
 	/// Deallocation is a NOP for the TempAllocator. The memory is automatically
 	/// deallocated when the TempAllocator is destroyed.
-	virtual void deallocate(void *)
+	virtual void deallocate(void *) override
 	{
 	}
 
 	/// Returns SIZE_NOT_TRACKED.
-	virtual u32 allocated_size(const void *)
+	virtual u32 allocated_size(const void *) override
 	{
 		return SIZE_NOT_TRACKED;
 	}
 
 	/// Returns SIZE_NOT_TRACKED.
-	virtual u32 total_allocated()
+	virtual u32 total_allocated() override
 	{
 		return SIZE_NOT_TRACKED;
 	}

+ 4 - 4
src/device/device.cpp

@@ -98,15 +98,15 @@ struct BgfxCallback : public bgfx::CallbackI
 		vlogi(DEVICE, buf, _argList);
 	}
 
-	virtual void profilerBegin(const char * /*_name*/, uint32_t /*_abgr*/, const char * /*_filePath*/, uint16_t /*_line*/)
+	virtual void profilerBegin(const char * /*_name*/, uint32_t /*_abgr*/, const char * /*_filePath*/, uint16_t /*_line*/) override
 	{
 	}
 
-	virtual void profilerBeginLiteral(const char * /*_name*/, uint32_t /*_abgr*/, const char * /*_filePath*/, uint16_t /*_line*/)
+	virtual void profilerBeginLiteral(const char * /*_name*/, uint32_t /*_abgr*/, const char * /*_filePath*/, uint16_t /*_line*/) override
 	{
 	}
 
-	virtual void profilerEnd()
+	virtual void profilerEnd() override
 	{
 	}
 
@@ -132,7 +132,7 @@ struct BgfxCallback : public bgfx::CallbackI
 	{
 	}
 
-	virtual void captureEnd()
+	virtual void captureEnd() override
 	{
 	}
 

+ 19 - 19
src/device/main_windows.cpp

@@ -629,17 +629,17 @@ struct WindowWin : public Window
 	{
 	}
 
-	void open(u16 x, u16 y, u16 width, u16 height, u32 /*parent*/)
+	void open(u16 x, u16 y, u16 width, u16 height, u32 /*parent*/) override
 	{
 		move(x, y);
 		resize(width, height);
 	}
 
-	void close()
+	void close() override
 	{
 	}
 
-	void bgfx_setup()
+	void bgfx_setup() override
 	{
 		bgfx::PlatformData pd;
 		memset(&pd, 0, sizeof(pd));
@@ -647,17 +647,17 @@ struct WindowWin : public Window
 		bgfx::setPlatformData(pd);
 	}
 
-	void show()
+	void show() override
 	{
 		ShowWindow(s_windows_device->_hwnd, SW_SHOW);
 	}
 
-	void hide()
+	void hide() override
 	{
 		ShowWindow(s_windows_device->_hwnd, SW_HIDE);
 	}
 
-	void resize(u16 width, u16 height)
+	void resize(u16 width, u16 height) override
 	{
 		_width = width;
 		_height = height;
@@ -679,29 +679,29 @@ struct WindowWin : public Window
 			);
 	}
 
-	void move(u16 x, u16 y)
+	void move(u16 x, u16 y) override
 	{
 		_x = x;
 		_y = y;
 		resize(_width, _height);
 	}
 
-	void minimize()
+	void minimize() override
 	{
 		ShowWindow(s_windows_device->_hwnd, SW_MINIMIZE);
 	}
 
-	void maximize()
+	void maximize() override
 	{
 		ShowWindow(s_windows_device->_hwnd, SW_MAXIMIZE);
 	}
 
-	void restore()
+	void restore() override
 	{
 		ShowWindow(s_windows_device->_hwnd, SW_RESTORE);
 	}
 
-	const char *title()
+	const char *title() override
 	{
 		static char buf[512];
 		memset(buf, 0, sizeof(buf));
@@ -709,28 +709,28 @@ struct WindowWin : public Window
 		return buf;
 	}
 
-	void set_title(const char *title)
+	void set_title(const char *title) override
 	{
 		SetWindowText(s_windows_device->_hwnd, title);
 	}
 
-	void show_cursor(bool show)
+	void show_cursor(bool show) override
 	{
 		s_windows_device->_hcursor = show ? LoadCursorA(NULL, IDC_ARROW) : NULL;
 		SetCursor(s_windows_device->_hcursor);
 	}
 
-	void set_fullscreen(bool /*fullscreen*/)
+	void set_fullscreen(bool /*fullscreen*/) override
 	{
 	}
 
-	void set_cursor(MouseCursor::Enum cursor)
+	void set_cursor(MouseCursor::Enum cursor) override
 	{
 		s_windows_device->_hcursor = _win_cursors[cursor];
 		SetCursor(s_windows_device->_hcursor);
 	}
 
-	void set_cursor_mode(CursorMode::Enum mode)
+	void set_cursor_mode(CursorMode::Enum mode) override
 	{
 		if (mode == s_windows_device->_cursor_mode)
 			return;
@@ -756,7 +756,7 @@ struct WindowWin : public Window
 		}
 	}
 
-	void *handle()
+	void *handle() override
 	{
 		return (void *)(uintptr_t)s_windows_device->_hwnd;
 	}
@@ -778,11 +778,11 @@ namespace window
 
 struct DisplayWin : public Display
 {
-	void modes(Array<DisplayMode> & /*modes*/)
+	void modes(Array<DisplayMode> & /*modes*/) override
 	{
 	}
 
-	void set_mode(u32 /*id*/)
+	void set_mode(u32 /*id*/) override
 	{
 	}
 };