Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
common/config/ | 12-May-2024 | - | 25 | 22 | ||
figures/ | 12-May-2024 | - | ||||
frameworks/ | 12-May-2024 | - | 771 | 630 | ||
interfaces/ | 12-May-2024 | - | 838 | 637 | ||
test/ | 12-May-2024 | - | 862 | 536 | ||
BUILD.gn | D | 12-May-2024 | 936 | 26 | 23 | |
LICENSE | D | 12-May-2024 | 9.9 KiB | 177 | 150 | |
README.md | D | 12-May-2024 | 2.3 KiB | 60 | 39 | |
README_zh.md | D | 12-May-2024 | 1.8 KiB | 61 | 39 | |
bundle.json | D | 12-May-2024 | 1.6 KiB | 56 | 55 | |
config_policy.gni | D | 12-May-2024 | 859 | 23 | 20 |
README.md
1# Configuration Policy Component 2 3## Introduction 4 5The configuration policy component, namely, customization_config_policy, provides APIs for each service module to obtain the configuration directories at different levels or the configuration file paths. 6 7## System Architecture 8 9**Figure 1** Architecture of the configuration policy component 10 11 12 13The architecture is described as follows: 14 15- **interfaces** provides the path of the file with the highest priority and all-level paths of the specified file. 16- **frameworks** initializes the configuration directory and queries the file path. 17 18## Directory Structure 19 20The code directory structure of the configuration policy component is as follows: 21 22``` 23/base/customization/ 24├── config_policy # Code repository for the configuration policy component 25│ ├── frameworks # Core code of the configuration policy component 26│ │ ├── config_policy # Configuration policy module 27│ │ │ └── src # Implementation code 28│ ├── interfaces # APIs of the configuration policy component 29│ │ ├── inner_api # APIs for internal subsystems 30│ │ └── kits # JavaScript APIs of the configurationpolicy component 31│ └── test # Test code 32``` 33 34## Usage 35 36Call the APIs of the configuration policy component to obtain the configuration directories at different levels or the configuration file paths. 37 38``` 39#include "config_policy_utils.h" 40 41CfgDir *cfgDir = GetCfgDirList(); // Obtain the configuration directory list. 42FreeCfgDirList(cfgDir); // Release the memory after the list is obtained. 43 44const char *cfgPath = "etc/xml/cfg.xml"; // Set the relative path and name of the configuration file. 45CfgFiles *cfgFiles = GetCfgFiles(cfgPath); // Obtain the configuration file paths of all configuration levels. 46FreeCfgFiles(cfgFiles); // Release the memory after the information is obtained. 47 48const char *userPath = "etc/xml/user.xml"; // Set the relative path and name of the configuration file. 49char buf[MAX_PATH_LEN] = {0}; 50char *filePath = GetOneCfgFile(userPath, buf, MAX_PATH_LEN); // Obtain the path of the configuration file with the highest priority. 51``` 52 53## Constraints 54 55**Programming language**: C/C++ 56 57## Repositories Involved 58 59**customization\_config\_policy** 60
README_zh.md
1# 配置策略组件介绍 2 3## 简介 4 5配置策略组件为各业务模块提供获取各配置层级的配置目录或配置文件路径的接口。 6 7## 系统架构 8 9**图 1** 配置策略组件架构图 10 11 12 13配置策略组件架构图说明: 14 15- interfaces对外提供指定文件的最高优先级文件路径以及指定文件所有层级路径。 16- frameworks实现配置层级目录的初始化与文件路径查询。 17 18## 目录 19 20配置策略组件源代码目录结构如下所示: 21 22``` 23/base/customization/ 24├── config_policy # 配置策略代码仓 25│ ├── frameworks # 配置策略核心代码 26│ │ ├── config_policy # 配置策略模块 27│ │ │ └── src # 实现代码 28│ ├── interfaces # 配置策略接口 29│ │ ├── inner_api # 子系统间接口 30│ │ └── kits # 配置策略JavaScript接口 31│ └── test # 测试代码 32``` 33 34## 说明 35 36调用该组件中的接口获取各配置层级的配置目录或配置文件路径。 37 38``` 39#include "config_policy_utils.h" 40 41CfgDir *cfgDir = GetCfgDirList(); // 获取配置层级目录列表 42FreeCfgDirList(cfgDir); // 获取完成后需要释放内存 43 44const char *cfgPath = "etc/xml/cfg.xml"; // 设置配置文件相对路径及文件名 45CfgFiles *cfgFiles = GetCfgFiles(cfgPath); // 获取所有配置层级的配置文件路径 46FreeCfgFiles(cfgFiles); // 获取完成后需要释放内存 47 48const char *userPath = "etc/xml/user.xml"; // 设置配置文件相对路径及文件名 49char buf[MAX_PATH_LEN] = {0}; 50char *filePath = GetOneCfgFile(userPath, buf, MAX_PATH_LEN); // 获取最高优先级的配置文件路径 51``` 52 53## 约束 54 55**语言限制**:C/C++语言 56 57## 相关仓 58 59**customization\_config\_policy** 60 61