diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-03-07 22:26:44 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-03-07 22:26:44 +0100 |
commit | ead4c17d0abd25e61e23a9324a29f2ef9bbd222e (patch) | |
tree | aca73eba6a4798c890b9043f53f705d3c75481b3 /logic/minecraft/MojangDownloadInfo.h | |
parent | d4eacb56b30baaef801f42545398a4f29755fadf (diff) | |
download | MultiMC-ead4c17d0abd25e61e23a9324a29f2ef9bbd222e.tar MultiMC-ead4c17d0abd25e61e23a9324a29f2ef9bbd222e.tar.gz MultiMC-ead4c17d0abd25e61e23a9324a29f2ef9bbd222e.tar.lz MultiMC-ead4c17d0abd25e61e23a9324a29f2ef9bbd222e.tar.xz MultiMC-ead4c17d0abd25e61e23a9324a29f2ef9bbd222e.zip |
NOISSUE hide mojang structs inside the mojang format entirely
Diffstat (limited to 'logic/minecraft/MojangDownloadInfo.h')
-rw-r--r-- | logic/minecraft/MojangDownloadInfo.h | 87 |
1 files changed, 31 insertions, 56 deletions
diff --git a/logic/minecraft/MojangDownloadInfo.h b/logic/minecraft/MojangDownloadInfo.h index 780318b8..d8cd2e6d 100644 --- a/logic/minecraft/MojangDownloadInfo.h +++ b/logic/minecraft/MojangDownloadInfo.h @@ -2,42 +2,30 @@ #include <QString> #include <memory> -class MojangDownloadInfo +struct MojangDownloadInfo { - friend class MojangVersionFormat; -public: - QString getUrl() - { - return m_url; - } - - QString getSha1() - { - return m_sha1; - } + // types + typedef std::shared_ptr<MojangDownloadInfo> Ptr; - int getSize() - { - return m_size; - } - -protected: + // data /// Local filesystem path. WARNING: not used, only here so we can pass through mojang files unmolested! - QString m_path; + QString path; /// absolute URL of this file - QString m_url; + QString url; /// sha-1 checksum of the file - QString m_sha1; + QString sha1; /// size of the file in bytes - int m_size; + int size; }; -typedef std::shared_ptr<MojangDownloadInfo> MojangDownloadInfoPtr; -class MojangLibraryDownloadInfo + +struct MojangLibraryDownloadInfo { - friend class MojangVersionFormat; -public: + // types + typedef std::shared_ptr<MojangLibraryDownloadInfo> Ptr; + + // methods MojangDownloadInfo *getDownloadInfo(QString classifier) { if (classifier.isNull()) @@ -47,46 +35,33 @@ public: return classifiers[classifier].get(); } -private: - MojangDownloadInfoPtr artifact; - QMap<QString, MojangDownloadInfoPtr> classifiers; + + // data + MojangDownloadInfo::Ptr artifact; + QMap<QString, MojangDownloadInfo::Ptr> classifiers; }; -typedef std::shared_ptr<MojangLibraryDownloadInfo> MojangLibraryDownloadInfoPtr; -class MojangAssetIndexInfo : public MojangDownloadInfo + +struct MojangAssetIndexInfo : public MojangDownloadInfo { - friend class MojangVersionFormat; -public: + // types + typedef std::shared_ptr<MojangAssetIndexInfo> Ptr; + + // methods MojangAssetIndexInfo() { } MojangAssetIndexInfo(QString id) { - m_id = id; - m_url = "https://s3.amazonaws.com/Minecraft.Download/indexes/" + id + ".json"; - m_known = false; - } - - int getTotalSize() - { - return m_totalSize; - } - - QString getId() - { - return m_id; - } - - bool sizeAndHashKnown() - { - return m_known; + this->id = id; + url = "https://s3.amazonaws.com/Minecraft.Download/indexes/" + id + ".json"; + known = false; } -protected: - int m_totalSize; - QString m_id; - bool m_known = true; + // data + int totalSize; + QString id; + bool known = true; }; -typedef std::shared_ptr<MojangAssetIndexInfo> MojangAssetIndexInfoPtr; |