winget-cli

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

Manifest.h (2554B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include <AppInstallerStrings.h>
      5 #include <AppInstallerSHA256.h>
      6 #include <AppInstallerVersions.h>
      7 #include <winget/ManifestInstaller.h>
      8 #include <winget/ManifestLocalization.h>
      9 
     10 #include <vector>
     11 
     12 namespace AppInstaller::Manifest
     13 {
     14     // Representation of the parsed manifest file.
     15     struct Manifest
     16     {
     17         using string_t = Utility::NormalizedString;
     18 
     19         string_t Id;
     20 
     21         string_t Version;
     22 
     23         string_t Channel;
     24 
     25         string_t Moniker;
     26 
     27         ManifestVer ManifestVersion;
     28 
     29         ManifestInstaller DefaultInstallerInfo;
     30 
     31         std::vector<ManifestInstaller> Installers;
     32 
     33         ManifestLocalization DefaultLocalization;
     34 
     35         std::vector<ManifestLocalization> Localizations;
     36 
     37         ManifestLocalization CurrentLocalization;
     38 
     39         // ApplyLocale will update the CurrentLocalization according to the specified locale
     40         // If locale is empty, user setting locale will be used
     41         void ApplyLocale(const std::string& locale = {});
     42 
     43         // Get all tags across localizations
     44         std::vector<string_t> GetAggregatedTags() const;
     45 
     46         // Get all commands across installers
     47         std::vector<string_t> GetAggregatedCommands() const;
     48 
     49         // Gets ARP version range if declared, otherwise an empty range is returned
     50         Utility::VersionRange GetArpVersionRange() const;
     51 
     52         // Get package family names across installers, Case folded.
     53         std::vector<string_t> GetPackageFamilyNames() const;
     54 
     55         // Get product codes across installers, Case folded.
     56         std::vector<string_t> GetProductCodes() const;
     57 
     58         // Get upgrade codes across installers, Case folded.
     59         std::vector<string_t> GetUpgradeCodes() const;
     60 
     61         // Get package names across localizations and installers, Case folded.
     62         std::vector<string_t> GetPackageNames() const;
     63 
     64         // Get publishers across localizations and installers, Case folded.
     65         std::vector<string_t> GetPublishers() const;
     66 
     67         // If not empty, the SHA256 hash of the manifest stream itself.
     68         Utility::SHA256::HashBuffer StreamSha256;
     69 
     70     private:
     71         std::vector<string_t> GetSystemReferenceStrings(
     72             std::function<const string_t& (const ManifestInstaller&)> extractStringFromInstaller = {},
     73             std::function<const string_t& (const AppsAndFeaturesEntry&)> extractStringFromAppsAndFeaturesEntry = {}) const;
     74     };
     75 }