• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <refbase.h>
20 #include "xml_config_base.h"
21 #include "libxml/parser.h"
22 
23 namespace OHOS::Rosen {
24 class DisplayManagerConfig : public RefBase, public XmlConfigBase {
25 public:
26     DisplayManagerConfig() = delete;
27     ~DisplayManagerConfig() = default;
28 
29     static bool LoadConfigXml();
30     static const std::map<std::string, bool>& GetEnableConfig();
31     static const std::map<std::string, std::vector<int>>& GetIntNumbersConfig();
32     static const std::map<std::string, std::string>& GetStringConfig();
33     static void DumpConfig();
34 
35 private:
36     static std::map<std::string, bool> enableConfig_;
37     static std::map<std::string, std::vector<int>> intNumbersConfig_;
38     static std::map<std::string, std::string> stringConfig_;
39 
40     static bool IsValidNode(const xmlNode& currNode);
41     static void ReadEnableConfigInfo(const xmlNodePtr& currNode);
42     static void ReadIntNumbersConfigInfo(const xmlNodePtr& currNode);
43     static void ReadStringConfigInfo(const xmlNodePtr& currNode);
44     static std::string GetConfigPath(const std::string& configFileName);
45 
46     static std::vector<std::string> Split(std::string str, std::string pattern);
47     static inline bool IsNumber(std::string str);
48 };
49 } // namespace OHOS::Rosen
50 #endif // OHOS_ROSEN_DISPLAY_MANAGER_CONFIG_H
51