PredefinedInstalledSourceFactory.h (1600B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include "ISource.h" 5 #include "SourceFactory.h" 6 7 #include <string_view> 8 9 namespace AppInstaller::Repository::Microsoft 10 { 11 using namespace std::string_view_literals; 12 13 // A source of installed packages on the local system. 14 // Arg :: A value indicating how the list is to be filtered. 15 // Data :: Not used. 16 struct PredefinedInstalledSourceFactory 17 { 18 // Get the type string for this source. 19 static constexpr std::string_view Type() 20 { 21 return "Microsoft.Predefined.Installed"sv; 22 } 23 24 // The filtering level for the source. 25 enum class Filter 26 { 27 // Contains user ARP, machine ARP and user MSIX 28 None, 29 // Contains user ARP and machine ARP 30 ARP, 31 // Contains user MSIX 32 MSIX, 33 // Contains user ARP and user MSIX 34 User, 35 // Contains machine ARP and machine MSIX 36 Machine, 37 // Same as None but creating the source reference causes the next Open to always update the cache 38 NoneWithForcedCacheUpdate, 39 }; 40 41 // Converts a filter to its string. 42 static std::string_view FilterToString(Filter filter); 43 44 // Converts a string to its filter value. 45 static Filter StringToFilter(std::string_view filter); 46 47 // Creates a source factory for this type. 48 static std::unique_ptr<ISourceFactory> Create(); 49 }; 50 }