diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-03-03 01:23:10 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-03-03 01:23:10 +0100 |
commit | 29cdc9364b0153d04a211adf3eab86076174c0a1 (patch) | |
tree | 9bb741e8c2291a31f0d210303550fec08df2cdd8 /logic/VersionFile.h | |
parent | 28ad9befdcac246eb69a434be970abc29a80bc80 (diff) | |
download | MultiMC-29cdc9364b0153d04a211adf3eab86076174c0a1.tar MultiMC-29cdc9364b0153d04a211adf3eab86076174c0a1.tar.gz MultiMC-29cdc9364b0153d04a211adf3eab86076174c0a1.tar.lz MultiMC-29cdc9364b0153d04a211adf3eab86076174c0a1.tar.xz MultiMC-29cdc9364b0153d04a211adf3eab86076174c0a1.zip |
More code butchery related to version files. No end in sight.
Diffstat (limited to 'logic/VersionFile.h')
-rw-r--r-- | logic/VersionFile.h | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/logic/VersionFile.h b/logic/VersionFile.h index 37c8c415..0f183ae8 100644 --- a/logic/VersionFile.h +++ b/logic/VersionFile.h @@ -20,8 +20,50 @@ public: virtual ~VersionBuildError() {}; }; +struct RawLibrary +{ + QString name; + QString url; + QString hint; + QString absoluteUrl; + bool applyExcludes = false; + QStringList excludes; + bool applyNatives = false; + QList<QPair<OpSys, QString>> natives; + bool applyRules = false; + QList<std::shared_ptr<Rule>> rules; + + // user for '+' libraries + enum InsertType + { + Apply, + Append, + Prepend, + Replace + }; + InsertType insertType = Append; + QString insertData; + enum DependType + { + Soft, + Hard + }; + DependType dependType = Soft; + + static RawLibrary fromJson(const QJsonObject &libObj, const QString &filename); +}; + struct VersionFile { +public: /* methods */ + static VersionFile fromJson(const QJsonDocument &doc, const QString &filename, + const bool requireOrder, const bool isFTB = false); + + static std::shared_ptr<OneSixLibrary> createLibrary(const RawLibrary &lib); + int findLibrary(QList<std::shared_ptr<OneSixLibrary>> haystack, const QString &needle); + void applyTo(VersionFinal *version); + +public: /* data */ int order; QString name; QString fileId; @@ -48,47 +90,8 @@ struct VersionFile QStringList addTweakers; QStringList removeTweakers; - struct Library - { - QString name; - QString url; - QString hint; - QString absoluteUrl; - bool applyExcludes = false; - QStringList excludes; - bool applyNatives = false; - QList<QPair<OpSys, QString>> natives; - bool applyRules = false; - QList<std::shared_ptr<Rule>> rules; - - // user for '+' libraries - enum InsertType - { - Apply, - Append, - Prepend, - Replace - }; - InsertType insertType = Append; - QString insertData; - enum DependType - { - Soft, - Hard - }; - DependType dependType = Soft; - - static Library fromJson(const QJsonObject &libObj, const QString &filename); - }; bool shouldOverwriteLibs = false; - QList<Library> overwriteLibs; - QList<Library> addLibs; + QList<RawLibrary> overwriteLibs; + QList<RawLibrary> addLibs; QList<QString> removeLibs; - - static VersionFile fromJson(const QJsonDocument &doc, const QString &filename, - const bool requireOrder, const bool isFTB = false); - - static std::shared_ptr<OneSixLibrary> createLibrary(const Library &lib); - int findLibrary(QList<std::shared_ptr<OneSixLibrary>> haystack, const QString &needle); - void applyTo(VersionFinal *version); };
\ No newline at end of file |