C++17ification.
C++17ification! - Filesystem interaction now uses std::filesystem::path. - Usage of const char*, std::string have been changed to std::string_view where appropriate. - Usage of printf-style functions changed to use fmt.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2014 Ben Vanik. All rights reserved. *
|
||||
* Copyright 2020 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef XENIA_BASE_MAPPED_MEMORY_H_
|
||||
#define XENIA_BASE_MAPPED_MEMORY_H_
|
||||
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -22,13 +23,14 @@ class MappedMemory {
|
||||
kReadWrite,
|
||||
};
|
||||
|
||||
static std::unique_ptr<MappedMemory> Open(const std::wstring& path, Mode mode,
|
||||
size_t offset = 0,
|
||||
static std::unique_ptr<MappedMemory> Open(const std::filesystem::path& path,
|
||||
Mode mode, size_t offset = 0,
|
||||
size_t length = 0);
|
||||
|
||||
MappedMemory(const std::wstring& path, Mode mode)
|
||||
MappedMemory(const std::filesystem::path& path, Mode mode)
|
||||
: path_(path), mode_(mode), data_(nullptr), size_(0) {}
|
||||
MappedMemory(const std::wstring& path, Mode mode, void* data, size_t size)
|
||||
MappedMemory(const std::filesystem::path& path, Mode mode, void* data,
|
||||
size_t size)
|
||||
: path_(path), mode_(mode), data_(data), size_(size) {}
|
||||
virtual ~MappedMemory() = default;
|
||||
|
||||
@@ -48,7 +50,7 @@ class MappedMemory {
|
||||
virtual bool Remap(size_t offset, size_t length) { return false; }
|
||||
|
||||
protected:
|
||||
std::wstring path_;
|
||||
std::filesystem::path path_;
|
||||
Mode mode_;
|
||||
void* data_;
|
||||
size_t size_;
|
||||
@@ -59,7 +61,7 @@ class ChunkedMappedMemoryWriter {
|
||||
virtual ~ChunkedMappedMemoryWriter() = default;
|
||||
|
||||
static std::unique_ptr<ChunkedMappedMemoryWriter> Open(
|
||||
const std::wstring& path, size_t chunk_size,
|
||||
const std::filesystem::path& path, size_t chunk_size,
|
||||
bool low_address_space = false);
|
||||
|
||||
virtual uint8_t* Allocate(size_t length) = 0;
|
||||
@@ -67,13 +69,13 @@ class ChunkedMappedMemoryWriter {
|
||||
virtual void FlushNew() = 0;
|
||||
|
||||
protected:
|
||||
ChunkedMappedMemoryWriter(const std::wstring& path, size_t chunk_size,
|
||||
bool low_address_space)
|
||||
ChunkedMappedMemoryWriter(const std::filesystem::path& path,
|
||||
size_t chunk_size, bool low_address_space)
|
||||
: path_(path),
|
||||
chunk_size_(chunk_size),
|
||||
low_address_space_(low_address_space) {}
|
||||
|
||||
std::wstring path_;
|
||||
std::filesystem::path path_;
|
||||
size_t chunk_size_;
|
||||
bool low_address_space_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user