winget-cli

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

ConfigurationEnvironment.h (2562B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include "ConfigurationEnvironment.g.h"
      5 #include <winrt/Windows.Foundation.Collections.h>
      6 #include <winget/ModuleCountBase.h>
      7 
      8 namespace winrt::Microsoft::Management::Configuration::implementation
      9 {
     10     struct ConfigurationEnvironment : ConfigurationEnvironmentT<ConfigurationEnvironment>, AppInstaller::WinRT::ModuleCountBase
     11     {
     12         ConfigurationEnvironment();
     13         ConfigurationEnvironment(SecurityContext context, const std::wstring& processorIdentifier, std::map<hstring, hstring>&& processorProperties);
     14         ConfigurationEnvironment(const implementation::ConfigurationEnvironment& toDeepCopy);
     15         ConfigurationEnvironment(const Configuration::ConfigurationEnvironment& toDeepCopy);
     16 
     17         SecurityContext Context() const;
     18         void Context(SecurityContext value);
     19 
     20         hstring ProcessorIdentifier() const;
     21         void ProcessorIdentifier(const hstring& value);
     22 
     23         Windows::Foundation::Collections::IMap<hstring, hstring> ProcessorProperties() const;
     24 
     25 #if !defined(INCLUDE_ONLY_INTERFACE_METHODS)
     26         // Copies the values from the given environment, including making a new map of the properties.
     27         void DeepCopy(const implementation::ConfigurationEnvironment& toDeepCopy);
     28 
     29         // Copies the properties from the given map.
     30         void ProcessorProperties(const Windows::Foundation::Collections::IMap<hstring, hstring>& values);
     31 
     32         // Copies the scalar properties from the given ValueSet.
     33         // Ignores all values that cannot be converted to a string.
     34         void ProcessorProperties(const Windows::Foundation::Collections::ValueSet& values);
     35 
     36         // Determines if this environment represents the default environment.
     37         bool IsDefault() const;
     38 
     39         // Creates an environment, setting only fields that are identical between all given environments.
     40         static com_ptr<ConfigurationEnvironment> CalculateCommonEnvironment(const std::vector<Configuration::ConfigurationEnvironment>& environments);
     41 
     42         // Checks if the two given properties maps are equal.
     43         static bool AreEqual(const Windows::Foundation::Collections::IMap<hstring, hstring>& a, const Windows::Foundation::Collections::IMap<hstring, hstring>& b);
     44 
     45     private:
     46         SecurityContext m_context = SecurityContext::Current;
     47         hstring m_processorIdentifier;
     48         Windows::Foundation::Collections::IMap<hstring, hstring> m_processorProperties;
     49 #endif
     50     };
     51 }