winget-cli

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

Content.h (2000B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 
      4 #pragma once
      5 
      6 #include "ContentId.h"
      7 #include "File.h"
      8 #include "Result.h"
      9 
     10 #include <memory>
     11 #include <string>
     12 #include <vector>
     13 
     14 namespace SFS
     15 {
     16 class Content
     17 {
     18   public:
     19     /**
     20      * @brief This Make() method should be used when the caller wants the @param files to be cloned
     21      */
     22     [[nodiscard]] static Result Make(std::string contentNameSpace,
     23                                      std::string contentName,
     24                                      std::string contentVersion,
     25                                      const std::vector<File>& files,
     26                                      std::unique_ptr<Content>& out) noexcept;
     27 
     28     /**
     29      * @brief This Make() method should be used when the caller wants the @param files to be moved
     30      */
     31     [[nodiscard]] static Result Make(std::string contentNameSpace,
     32                                      std::string contentName,
     33                                      std::string contentVersion,
     34                                      std::vector<File>&& files,
     35                                      std::unique_ptr<Content>& out) noexcept;
     36 
     37     /**
     38      * @brief This Make() method should be used when the caller wants the @param contentId and @param files to be moved
     39      */
     40     [[nodiscard]] static Result Make(std::unique_ptr<ContentId>&& contentId,
     41                                      std::vector<File>&& files,
     42                                      std::unique_ptr<Content>& out) noexcept;
     43 
     44     Content(Content&&) noexcept;
     45 
     46     Content(const Content&) = delete;
     47     Content& operator=(const Content&) = delete;
     48 
     49     /**
     50      * @return Unique content identifier
     51      */
     52     const ContentId& GetContentId() const noexcept;
     53 
     54     const std::vector<File>& GetFiles() const noexcept;
     55 
     56   private:
     57     Content() = default;
     58 
     59     std::unique_ptr<ContentId> m_contentId;
     60     std::vector<File> m_files;
     61 };
     62 } // namespace SFS