winget-cli

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

AppInstallerArchitecture.h (1910B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include <optional>
      5 #include <vector>
      6 #include <winget/LocIndependent.h>
      7 #include <winrt/Windows.System.h>
      8 
      9 namespace AppInstaller::Utility
     10 {
     11     static const int InapplicableArchitecture = -1;
     12 
     13     enum class Architecture
     14     {
     15         Unknown = -1,
     16         Neutral,
     17         X86,
     18         X64,
     19         Arm,
     20         Arm64
     21     };
     22 
     23     // Converts a string to corresponding enum
     24     Architecture ConvertToArchitectureEnum(std::string_view archStr);
     25 
     26     // Converts an ProcessorArchitecture to an Architecture
     27     std::optional<Architecture> ConvertToArchitectureEnum(winrt::Windows::System::ProcessorArchitecture architecture);
     28 
     29     // Converts an Architecture to a string_view
     30     LocIndView ToString(Architecture architecture);
     31 
     32     // Gets the system's architecture as Architecture enum
     33     AppInstaller::Utility::Architecture GetSystemArchitecture();
     34 
     35     // Gets the set of architectures that are applicable to the current system
     36     const std::vector<Architecture>& GetApplicableArchitectures();
     37 
     38     // Gets the set of architectures that are supported by winget
     39     const std::vector<Architecture>& GetAllArchitectures();
     40 
     41     // Gets if an architecture is applicable to the system
     42     // Returns the priority in the applicable architecture list if the architecture is applicable. 0 has lowest priority.
     43     // Returns -1 if the architecture is not applicable.
     44     int IsApplicableArchitecture(Architecture arch);
     45 
     46     // Gets if an architecture is applicable to the given list
     47     // Returns the priority in the applicable architecture list if the architecture is applicable. 0 has lowest priority.
     48     // Returns -1 if the architecture is not applicable.
     49     int IsApplicableArchitecture(Architecture arch, const std::vector<Architecture>& allowedArchitectures);
     50 }