diff options
| author | Jan Sucan <jan@jansucan.com> | 2025-01-27 10:46:40 +0100 |
|---|---|---|
| committer | Ján Sučan <jan@jansucan.com> | 2025-01-27 15:22:36 +0100 |
| commit | 2f14c18ff51356c93b2f0b2aeecc84de6398cc0a (patch) | |
| tree | f12f40a34ea8b8747db86b0005a1b8316e4eedfe | |
| parent | 1cf9fb80b56d40596a7239c567bcd2aab2458ba5 (diff) | |
Remove use of inheritance for Options classes
| -rw-r--r-- | src/options.cpp | 12 | ||||
| -rw-r--r-- | src/options.h | 28 |
2 files changed, 19 insertions, 21 deletions
diff --git a/src/options.cpp b/src/options.cpp index a836b53..9b85962 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -35,10 +35,10 @@ */ #include "program_info.h" -Options::Options() : buffer_size{Options::DEFAULT_BUFFER_SIZE} {} +OptionsCreate::OptionsCreate() : buffer_size{OPTIONS_DEFAULT_BUFFER_SIZE} {} uint32_t -Options::getBufferSize() const +OptionsCreate::getBufferSize() const { return buffer_size; } @@ -61,6 +61,14 @@ OptionsCreate::getOutFilePath() const return out_file_path; } +OptionsRestore::OptionsRestore() : buffer_size{OPTIONS_DEFAULT_BUFFER_SIZE} {} + +uint32_t +OptionsRestore::getBufferSize() const +{ + return buffer_size; +} + std::filesystem::path OptionsRestore::getDiffFilePath() const { diff --git a/src/options.h b/src/options.h index ec1906b..f30f253 100644 --- a/src/options.h +++ b/src/options.h @@ -37,50 +37,40 @@ class OptionError : public DiffddError explicit OptionError(const std::string &message) : DiffddError(message) {} }; -class Options -{ - friend class OptionParser; - - public: - static const int DEFAULT_BUFFER_SIZE{4 * 1024 * 1024}; +const inline int OPTIONS_DEFAULT_BUFFER_SIZE{4 * 1024 * 1024}; - Options(); - virtual ~Options() = default; - - uint32_t getBufferSize() const; - - private: - uint32_t buffer_size; -}; - -class OptionsCreate : public Options +class OptionsCreate { friend class OptionParser; public: - virtual ~OptionsCreate() override = default; + OptionsCreate(); + uint32_t getBufferSize() const; std::filesystem::path getInFilePath() const; std::filesystem::path getBaseFilePath() const; std::filesystem::path getOutFilePath() const; private: + uint32_t buffer_size; std::filesystem::path in_file_path; std::filesystem::path base_file_path; std::filesystem::path out_file_path; }; -class OptionsRestore : public Options +class OptionsRestore { friend class OptionParser; public: - virtual ~OptionsRestore() override = default; + OptionsRestore(); + uint32_t getBufferSize() const; std::filesystem::path getDiffFilePath() const; std::filesystem::path getOutFilePath() const; private: + uint32_t buffer_size; std::filesystem::path diff_file_path; std::filesystem::path out_file_path; }; |
