1 /* 2 * Copyright (C) 2018-2021 Intel Corporation 3 * 4 * SPDX-License-Identifier: MIT 5 * 6 */ 7 8 #pragma once 9 #include <fstream> 10 #include <stdint.h> 11 #include <string> 12 13 namespace NEO { 14 15 class SettingsReader { 16 public: ~SettingsReader()17 virtual ~SettingsReader() {} create(const std::string & regKey)18 static SettingsReader *create(const std::string ®Key) { 19 SettingsReader *readerImpl = createFileReader(); 20 if (readerImpl != nullptr) 21 return readerImpl; 22 23 return createOsReader(false, regKey); 24 } 25 static SettingsReader *createOsReader(bool userScope, const std::string ®Key); 26 static SettingsReader *createFileReader(); 27 virtual int32_t getSetting(const char *settingName, int32_t defaultValue) = 0; 28 virtual int64_t getSetting(const char *settingName, int64_t defaultValue) = 0; 29 virtual bool getSetting(const char *settingName, bool defaultValue) = 0; 30 virtual std::string getSetting(const char *settingName, const std::string &value) = 0; 31 virtual const char *appSpecificLocation(const std::string &name) = 0; 32 static const char *settingsFileName; 33 MOCKABLE_VIRTUAL char *getenv(const char *settingName); 34 }; 35 }; // namespace NEO 36