diff options
| author | 2021-06-13 07:52:02 -0400 | |
|---|---|---|
| committer | 2021-06-13 11:05:58 -0400 | |
| commit | 8150c65c07c39ab842f8c3249464ece1af4db9b4 (patch) | |
| tree | 8526f7bac5febb719665c3be957d93be6784f9ed /src/common/logging/backend.h | |
| parent | Merge pull request #6452 from german77/sixaxis_firmware_stub (diff) | |
| download | yuzu-8150c65c07c39ab842f8c3249464ece1af4db9b4.tar.gz yuzu-8150c65c07c39ab842f8c3249464ece1af4db9b4.tar.xz yuzu-8150c65c07c39ab842f8c3249464ece1af4db9b4.zip | |
common: logging: backend: Wrap IOFile in a unique_ptr
Allows us to forward declare Common::FS::IOFile.
Diffstat (limited to 'src/common/logging/backend.h')
| -rw-r--r-- | src/common/logging/backend.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h index eb629a33f..826bde694 100644 --- a/src/common/logging/backend.h +++ b/src/common/logging/backend.h | |||
| @@ -8,10 +8,13 @@ | |||
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <string> | 9 | #include <string> |
| 10 | #include <string_view> | 10 | #include <string_view> |
| 11 | #include "common/fs/file.h" | ||
| 12 | #include "common/logging/filter.h" | 11 | #include "common/logging/filter.h" |
| 13 | #include "common/logging/log.h" | 12 | #include "common/logging/log.h" |
| 14 | 13 | ||
| 14 | namespace Common::FS { | ||
| 15 | class IOFile; | ||
| 16 | } | ||
| 17 | |||
| 15 | namespace Common::Log { | 18 | namespace Common::Log { |
| 16 | 19 | ||
| 17 | class Filter; | 20 | class Filter; |
| @@ -38,6 +41,7 @@ struct Entry { | |||
| 38 | class Backend { | 41 | class Backend { |
| 39 | public: | 42 | public: |
| 40 | virtual ~Backend() = default; | 43 | virtual ~Backend() = default; |
| 44 | |||
| 41 | virtual void SetFilter(const Filter& new_filter) { | 45 | virtual void SetFilter(const Filter& new_filter) { |
| 42 | filter = new_filter; | 46 | filter = new_filter; |
| 43 | } | 47 | } |
| @@ -53,6 +57,8 @@ private: | |||
| 53 | */ | 57 | */ |
| 54 | class ConsoleBackend : public Backend { | 58 | class ConsoleBackend : public Backend { |
| 55 | public: | 59 | public: |
| 60 | ~ConsoleBackend() override; | ||
| 61 | |||
| 56 | static const char* Name() { | 62 | static const char* Name() { |
| 57 | return "console"; | 63 | return "console"; |
| 58 | } | 64 | } |
| @@ -67,6 +73,8 @@ public: | |||
| 67 | */ | 73 | */ |
| 68 | class ColorConsoleBackend : public Backend { | 74 | class ColorConsoleBackend : public Backend { |
| 69 | public: | 75 | public: |
| 76 | ~ColorConsoleBackend() override; | ||
| 77 | |||
| 70 | static const char* Name() { | 78 | static const char* Name() { |
| 71 | return "color_console"; | 79 | return "color_console"; |
| 72 | } | 80 | } |
| @@ -83,6 +91,7 @@ public: | |||
| 83 | class FileBackend : public Backend { | 91 | class FileBackend : public Backend { |
| 84 | public: | 92 | public: |
| 85 | explicit FileBackend(const std::filesystem::path& filename); | 93 | explicit FileBackend(const std::filesystem::path& filename); |
| 94 | ~FileBackend() override; | ||
| 86 | 95 | ||
| 87 | static const char* Name() { | 96 | static const char* Name() { |
| 88 | return "file"; | 97 | return "file"; |
| @@ -95,7 +104,7 @@ public: | |||
| 95 | void Write(const Entry& entry) override; | 104 | void Write(const Entry& entry) override; |
| 96 | 105 | ||
| 97 | private: | 106 | private: |
| 98 | FS::IOFile file; | 107 | std::unique_ptr<FS::IOFile> file; |
| 99 | std::size_t bytes_written = 0; | 108 | std::size_t bytes_written = 0; |
| 100 | }; | 109 | }; |
| 101 | 110 | ||
| @@ -104,6 +113,8 @@ private: | |||
| 104 | */ | 113 | */ |
| 105 | class DebuggerBackend : public Backend { | 114 | class DebuggerBackend : public Backend { |
| 106 | public: | 115 | public: |
| 116 | ~DebuggerBackend() override; | ||
| 117 | |||
| 107 | static const char* Name() { | 118 | static const char* Name() { |
| 108 | return "debugger"; | 119 | return "debugger"; |
| 109 | } | 120 | } |