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