diff options
| author | AL <26797547+Al12rs@users.noreply.github.com> | 2020-11-02 21:45:32 +0100 |
|---|---|---|
| committer | AL <26797547+Al12rs@users.noreply.github.com> | 2020-11-02 21:45:32 +0100 |
| commit | 4814ba626e80f5137076556b687e59e6bbd8be34 (patch) | |
| tree | 7497d6feec3aa864197680eac88bb616dcaf68db /src/shared/fileregisterfwd.h | |
| parent | b7935aedec70dd4f0c40dbe948dba9a80a56a75a (diff) | |
Convert FileAlternative and DataArchiveOrigin to classes
Diffstat (limited to 'src/shared/fileregisterfwd.h')
| -rw-r--r-- | src/shared/fileregisterfwd.h | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/shared/fileregisterfwd.h b/src/shared/fileregisterfwd.h index a3cf8132..57b3715a 100644 --- a/src/shared/fileregisterfwd.h +++ b/src/shared/fileregisterfwd.h @@ -46,29 +46,44 @@ constexpr OriginID InvalidOriginID = -1; // is the order of the associated plugin in the plugins list // is a file is not in an archive, archiveName is empty and order is usually // -1 -struct DataArchiveOrigin +class DataArchiveOrigin { - std::wstring name = L""; - int order = -1; + std::wstring name_ = L""; + int order_ = -1; + +public: + + int order() const { return order_; } + const std::wstring& name() const { return name_; } bool isValid() const { - return name.size() > 0; + return name_.size() > 0; } - DataArchiveOrigin(std::wstring pname, int porder) - : name(pname), order(porder) {} + DataArchiveOrigin(std::wstring name, int order) + : name_(std::move(name)), order_(order) {} - DataArchiveOrigin() {} + DataArchiveOrigin() = default; }; -struct FileAlternative +class FileAlternative { - OriginID originID = -1; - DataArchiveOrigin archive; + OriginID originID_ = -1; + DataArchiveOrigin archive_; + +public: + + OriginID originID() const { return originID_; } + const DataArchiveOrigin& archive() const { return archive_; } bool isFromArchive() const { - return archive.isValid(); + return archive_.isValid(); } + + FileAlternative() = default; + + FileAlternative(OriginID originID, DataArchiveOrigin archive) + : originID_(originID), archive_(std::move(archive)) {} }; using AlternativesVector = std::vector<FileAlternative>; |
