diff options
| author | Seth Riley <17361645+Qudix@users.noreply.github.com> | 2020-11-03 18:38:45 -0600 |
|---|---|---|
| committer | Seth Riley <17361645+Qudix@users.noreply.github.com> | 2020-11-03 18:38:45 -0600 |
| commit | 34e1d05c28bf4676ed8d3e97e969187a05d215b6 (patch) | |
| tree | 285a418b970ba5daacf0c307cb98ed59fd31cda1 /src/shared/fileregisterfwd.h | |
| parent | 68750575d2f28c873b0d68391a7940e61c2ad2d4 (diff) | |
| parent | a7d4f2a0c40d35d547e93994be3f92b6d43a0833 (diff) | |
Merge branch 'master' of https://github.com/ModOrganizer2/modorganizer into master
Diffstat (limited to 'src/shared/fileregisterfwd.h')
| -rw-r--r-- | src/shared/fileregisterfwd.h | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/src/shared/fileregisterfwd.h b/src/shared/fileregisterfwd.h index 720e6e30..57b3715a 100644 --- a/src/shared/fileregisterfwd.h +++ b/src/shared/fileregisterfwd.h @@ -42,15 +42,51 @@ using OriginID = int; constexpr FileIndex InvalidFileIndex = UINT_MAX; constexpr OriginID InvalidOriginID = -1; - -// a vector of {originId, {archiveName, order}} -// -// if a file is in an archive, archiveName is the name of the bsa and order +// if a file is in an archive, name is the name of the bsa and order // 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 -using AlternativesVector = std::vector<std::pair<OriginID, std::pair<std::wstring, int>>>; +class DataArchiveOrigin +{ + 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; + } + + DataArchiveOrigin(std::wstring name, int order) + : name_(std::move(name)), order_(order) {} + + DataArchiveOrigin() = default; +}; + +class FileAlternative +{ + OriginID originID_ = -1; + DataArchiveOrigin archive_; + +public: + + OriginID originID() const { return originID_; } + const DataArchiveOrigin& archive() const { return archive_; } + + bool isFromArchive() const { + return archive_.isValid(); + } + + FileAlternative() = default; + + FileAlternative(OriginID originID, DataArchiveOrigin archive) + : originID_(originID), archive_(std::move(archive)) {} +}; + +using AlternativesVector = std::vector<FileAlternative>; struct DirectoryStats { |
