Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
base/ | 12-May-2024 | - | 28,848 | 18,247 | ||
docs/ | 12-May-2024 | - | 2,674 | 2,041 | ||
.gitattributes | D | 12-May-2024 | 631 | 16 | 15 | |
.gitignore | D | 12-May-2024 | 6 | 2 | 1 | |
LICENSE | D | 12-May-2024 | 9.9 KiB | 177 | 150 | |
README.md | D | 12-May-2024 | 2.6 KiB | 83 | 64 | |
README_zh.md | D | 12-May-2024 | 5.6 KiB | 124 | 96 | |
bundle.json | D | 12-May-2024 | 3.1 KiB | 118 | 117 |
README.md
1# commonlibrary/c_utils<a name="EN-US_TOPIC_0000001148676553"></a> 2 3## Introduction<a name="section11660541593"></a> 4 5The **commonlibrary/c_utils** repository provides the following commonly used C++ utility classes for standard system: 6 7- Enhanced APIs for operations related to files, paths, and strings 8- APIs related to the read-write lock, semaphore, timer, thread, and thread pool 9- APIs related to the security data container and data serialization 10- Error codes for each subsystem 11 12## Directory Structure<a name="section17271017133915"></a> 13 14``` 15commonlibrary/c_utils 16├─ base 17│ ├── include # Header files of APIs open to other subsystems 18│ ├── src # Source files 19│ └── test # Test code 20├─ Docs 21 ├── en # Documents in English 22 └── zh-cn # Documents in Chinese 23``` 24## Condition 25Suitable for standard system. 26 27## Build 28### Build Component 29``` 30./build.sh --product-name rk3568 --build-target c_utils 31``` 32 33### Build Shared Library 34``` 35./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base:utils 36``` 37 38### Build Static Library 39``` 40./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base:utilsbase 41``` 42 43### How to Add Dependency of c_utils 441. Open the corresponding BUILD.gn file of the related module. 452. Add dependency to the corresponding block as follows: 46```gn 47 48ohos_shared_library("xxxxx") { 49 ... 50 51 external_deps = [ 52 ... 53 # Dependency of shared library(Optional) 54 "c_utils:utils", 55 # Dependency of static library(Optional) 56 "c_utils:utilsbase", 57 ] 58 59 ... 60} 61``` 62## Coding Directions 63 64### [Timer](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/en/c_utils_timer.md) 65### [Thread Pool](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/en/c_utils_thread_pool.md) 66 67## Changelog 68**2023/01/31** 691. Add docs directory,provide development guidelines for main functionalities in c_utils. 702. Add comments in header files. 713. Modify README in which the guidelines can be accessed by links in section "Coding Directions". 72 73**2022/10/10** 741. Move this repository from utils/native to commonlibrary/c_utils. 752. Switch component name from utils_base to c_utils. 763. Securec is not in this repository any more. Please use [third_party_bounds_checking_function](https://gitee.com/openharmony/third_party_bounds_checking_function). 77## Repositories Involved<a name="section1249817110914"></a> 78 79**[commonlibrary\_c\_utils](https://gitee.com/openharmony/commonlibrary_c_utils)** 80 81[commonlibrary\_utils\_lite](https://gitee.com/openharmony/commonlibrary_utils_lite) 82 83
README_zh.md
1# C++公共基础库<a name="ZH-CN_TOPIC_0000001148676553"></a> 2 3 4## 简介<a name="section11660541593"></a> 5 6C++公共基础类库为标准系统提供了一些常用的C++开发工具类,包括: 7 8- 文件、路径、字符串相关操作的能力增强接口 9- 读写锁、信号量、定时器、线程增强及线程池等接口 10- 安全数据容器、数据序列化等接口 11- 各子系统的错误码相关定义 12 13## 目录<a name="section17271017133915"></a> 14 15``` 16commonlibrary/c_utils 17├─ base 18│ ├── include # 对各子系统开放的接口头文件 19│ ├── src # 源文件 20│ └── test # 测试代码 21├─ Docs 22 ├── en # 英文文档 23 └── zh-cn # 中文文档 24``` 25 26## 约束 27 28适用于标准系统。 29## 编译构建 30### 编译部件 31``` 32./build.sh --product-name rk3568 --build-target c_utils 33``` 34 35### 编译动态库 36``` 37./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base:utils 38``` 39 40### 编译Rust动态库 41``` 42./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base:utils_rust 43``` 44 45### 编译静态库 46``` 47./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base:utilsbase 48``` 49### 如何依赖c_utils 501. 进入相关模块对应BUILD.gn文件 512. 在该模块对应位置中的`external_deps`字段内添加依赖,如下: 52```gn 53 54ohos_shared_library("xxxxx") { 55 ... 56 57 external_deps = [ 58 ... 59 # 动态库依赖(可选) 60 "c_utils:utils", 61 # 静态库依赖(可选) 62 "c_utils:utilsbase", 63 # Rust动态库依赖(可选) 64 "c_utils:utils_rust", 65 ] 66 67 ... 68} 69``` 70 71## 使用说明 72 73### [Rust-匿名共享内存](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c_utils_guide_rust_ashmem.md) 74### [Rust-文件与目录](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c_utils_guide_rust_directory.md) 75### [Rust-读写文件](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c_utils_guide_rust_file.md) 76 77### [使用匿名共享内存](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-ashmem.md) 78### [使用智能指针管理动态分配内存对象](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-refbase.md) 79### [使用Parcel作为数据容器](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-parcel.md) 80### [定时器](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c_utils_timer.md) 81### [文件映射](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c_utils_guide_mapped_file.md) 82### [事件处理系统](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c_utils_guide_event.md) 83### [读写锁](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-rwlock.md) 84### [增强信号量功能](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-semaphore.md) 85### [强化线程能力](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-thread.md) 86### [线程池](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c_utils_thread_pool.md) 87 88 89### [线程安全Map](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-safeMap.md) 90### [有序Vector](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-sortedVector.md) 91### [线程安全阻塞队列](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-safe_block_queue.md) 92### [线程安全栈与队列](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-safe_queue.md) 93 94### [单例模式](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-singleton.md) 95### [观察者模式](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-observer.md) 96 97### [日期与时间](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-datetime.md) 98### [文件与目录](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-directory.md) 99### [字符串处理](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-string.md) 100### [读写文件](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-file.md) 101### [管理、传递文件描述符](https://gitee.com/openharmony/commonlibrary_c_utils/blob/master/docs/zh-cn/c-utils-guide-uniquefd.md) 102 103## Changelog 104**2023/06/14** 1051. 添加文件映射、事件处理系统的开发指导文档。 1062. Refbase维测增强部分已更新至文档。 1073. 添加Rust相关功能的开发指导文档并提供编译命令。 108 109**2023/01/31** 1101. 添加docs目录,提供c_utils内各主要功能的开发指导文档。 1112. 在源码头文件中添加注释。 1123. 修改Readme文档,开发指导文档可通过Readme中的"使用说明"章节跳转查看。 113 114**2022/10/10** 1151. 路径变更。由utils/native移动至commonlibrary/c_utils; 1162. 部件名变更。由utils_base变更为c_utils; 1173. 不再提供安全C库能力。请使用[third_party_bounds_checking_function](https://gitee.com/openharmony/third_party_bounds_checking_function)。 118## 相关仓<a name="section1249817110914"></a> 119 120**[commonlibrary\_c\_utils](https://gitee.com/openharmony/commonlibrary_c_utils)** 121 122[commonlibrary\_utils\_lite](https://gitee.com/openharmony/commonlibrary_utils_lite) 123 124