1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_ROSEN_DISPLAY_MANAGER_CONFIG_H 17 #define OHOS_ROSEN_DISPLAY_MANAGER_CONFIG_H 18 19 20 #include <refbase.h> 21 #include "xml_config_base.h" 22 #include "libxml/parser.h" 23 24 namespace OHOS::Rosen { 25 class DisplayManagerConfig : public RefBase, public XmlConfigBase { 26 public: 27 DisplayManagerConfig() = delete; 28 ~DisplayManagerConfig() = default; 29 30 static bool LoadConfigXml(); 31 static const std::map<std::string, bool>& GetEnableConfig(); 32 static const std::map<std::string, std::vector<int>>& GetIntNumbersConfig(); 33 static const std::map<std::string, std::string>& GetStringConfig(); 34 static void DumpConfig(); 35 36 private: 37 static std::map<std::string, bool> enableConfig_; 38 static std::map<std::string, std::vector<int>> intNumbersConfig_; 39 static std::map<std::string, std::string> stringConfig_; 40 41 static bool IsValidNode(const xmlNode& currNode); 42 static void ReadEnableConfigInfo(const xmlNodePtr& currNode); 43 static void ReadIntNumbersConfigInfo(const xmlNodePtr& currNode); 44 static void ReadStringConfigInfo(const xmlNodePtr& currNode); 45 static std::string GetConfigPath(const std::string& configFileName); 46 47 static std::vector<std::string> Split(std::string str, std::string pattern); 48 static inline bool IsNumber(std::string str); 49 }; 50 } // namespace OHOS::Rosen 51 #endif // OHOS_ROSEN_DISPLAY_MANAGER_CONFIG_H 52