winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

AppFile.h (1790B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 
      4 #pragma once
      5 
      6 #include "ApplicabilityDetails.h"
      7 #include "File.h"
      8 
      9 #include <memory>
     10 #include <string>
     11 #include <unordered_map>
     12 #include <vector>
     13 
     14 namespace SFS
     15 {
     16 class AppFile : private File
     17 {
     18   public:
     19     [[nodiscard]] static Result Make(std::string fileId,
     20                                      std::string url,
     21                                      uint64_t sizeInBytes,
     22                                      std::unordered_map<HashType, std::string> hashes,
     23                                      std::vector<Architecture> architectures,
     24                                      std::vector<std::string> platformApplicabilityForPackage,
     25                                      std::string fileMoniker,
     26                                      std::unique_ptr<AppFile>& out) noexcept;
     27 
     28     AppFile(AppFile&&) noexcept;
     29 
     30     AppFile(const AppFile&) = delete;
     31     AppFile& operator=(const AppFile&) = delete;
     32 
     33     /// Getter methods from File class
     34     using File::GetFileId;
     35     using File::GetHashes;
     36     using File::GetSizeInBytes;
     37     using File::GetUrl;
     38 
     39     /**
     40      * @return Set of details related to applicability of the file
     41      */
     42     const ApplicabilityDetails& GetApplicabilityDetails() const noexcept;
     43 
     44     /**
     45      * @return Package Moniker of the file
     46      */
     47     const std::string& GetFileMoniker() const noexcept;
     48 
     49   private:
     50     AppFile(std::string&& fileId,
     51             std::string&& url,
     52             uint64_t sizeInBytes,
     53             std::unordered_map<HashType, std::string>&& hashes,
     54             std::string&& fileMoniker);
     55 
     56     std::unique_ptr<ApplicabilityDetails> m_applicabilityDetails;
     57     std::string m_fileMoniker;
     58 };
     59 } // namespace SFS