From: Caisking <3449750381@qq.com> Date: Thu, 11 Jan 2024 02:09:31 +0000 (+0800) Subject: 增加函数注释 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=265556c5229457a8cbe0beb9a8ff34f0ffd06757;p=mirrors%2FFD230.git 增加函数注释 --- diff --git a/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp index 393ecdbc6..ef58e1a87 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp @@ -1,3 +1,13 @@ +/* + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-01-02 11:23:34 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-01-11 10:08:21 + * @FilePath: /1.FD230/FD230/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp + * @Description: + * + * Copyright (c) 2024 by Caisking , All Rights Reserved. + */ #include "dial/include/Digital_clockView.h" @@ -29,6 +39,11 @@ namespace OHOS { JosnfilePath = filePath; } + /** + * @description: 加载json文件 + * @param {string} &filePath + * @return {*} + */ bool loadJsonData(const std::string &filePath) { @@ -53,18 +68,22 @@ namespace OHOS SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); g_pDigital_clockView = this; } - Digital_clockView::~Digital_clockView() { DeInit(); g_pDigital_clockView = nullptr; } - Digital_clockView *Digital_clockView::GetInstance() { return g_pDigital_clockView; } - + /** + * @description: 生成动画的资源路径数组 + * @param {char} *basePath + * @param {char} *fileExtension + * @param {int} numImages + * @return {*} + */ const char **Digital_clockView::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages) { const char **imagePaths = new const char *[numImages + 1]; // 多分配一个元素用于存储数组大小 @@ -79,7 +98,11 @@ namespace OHOS imagePaths[numImages] = reinterpret_cast(numImages); // 将数组大小信息存储在最后一个元素中 return imagePaths; } - + /** + * @description: 释放动画路径数组 + * @param {char} * + * @return {*} + */ void Digital_clockView::FreeImagePathsArray(const char **imagePaths) { int numImages = reinterpret_cast(imagePaths[-1]); // 从最后一个元素中获取数组大小 @@ -89,7 +112,11 @@ namespace OHOS } delete[] imagePaths; } - + /** + * @description: 判断路径是否为文件夹 + * @param {string} &path + * @return {*} + */ bool isDirectory(const std::string &path) { if (!path.empty() && path.back() == '/') @@ -98,7 +125,10 @@ namespace OHOS } return false; // 其他情况 } - + /** + * @description: 初始化背景 + * @return {*} + */ void Digital_clockView::Initbackground() { // 初始化背景 @@ -153,8 +183,17 @@ namespace OHOS container_->Add(background); background->SetVisible(true); } - /*初始化表盘时钟*/ - // Function to create and add an image view + + /** + * @description: 初始化数字图片 + * @param {int} left + * @param {int} top + * @param {char} *imagePath + * @param {char} *viewId + * @param {int} offsetX + * @param {int} offsetY + * @return {*} + */ void Digital_clockView::addImageView(int left, int top, const char *imagePath, const char *viewId, int offsetX, int offsetY) { UIImageView *imageView = new UIImageView(); @@ -165,6 +204,10 @@ namespace OHOS container_->Add(imageView); imageView->SetVisible(true); } + /** + * @description: 初始化数字表盘 + * @return {*} + */ void Digital_clockView ::Initdigit() { cJSON *background_cjson = cJSON_GetObjectItem(cjson_json, "background"); @@ -232,6 +275,10 @@ namespace OHOS timeLableanimator_->Start(); } } + /** + * @description: 初始化指针表盘 + * @return {*} + */ void Digital_clockView::Initpointer() { cJSON *hands = cJSON_GetObjectItem(cjson_json, "hands"); @@ -295,7 +342,12 @@ namespace OHOS container_->Add(sweepClock1_); sweepClock1_->SetVisible(true); } - + /** + * @description: 获取格式化日期,根据不同的日期格式获取 + * @param {string} &dateStr + * @param {string} &displayformat + * @return {*} + */ std::string FormatDate(const std::string &dateStr, const std::string &displayformat) { // 定义默认返回值 @@ -322,6 +374,10 @@ namespace OHOS return formattedDate; } + /** + * @description: 初始化日期 + * @return {*} + */ void Digital_clockView ::Initdata() { // loadJsonData(JosnfilePath); @@ -359,6 +415,10 @@ namespace OHOS container_->Add(dateLable); dateLable->SetVisible(true); }; + /** + * @description: 初始化星期 + * @return {*} + */ void Digital_clockView ::Initweek() { // loadJsonData(JosnfilePath); @@ -401,6 +461,10 @@ namespace OHOS container_->Add(weekLable); weekLable->SetVisible(true); }; + /** + * @description: 初始化电量 + * @return {*} + */ void Digital_clockView ::Initbattery() { // loadJsonData(JosnfilePath); @@ -472,7 +536,10 @@ namespace OHOS progress1animator_ = new Animator(progress1callback_, progress, 10000, true); progress1animator_->Start(); }; - /* InitView:初始化界面*/ + /** + * @description: 初始化页面 + * @return {*} + */ bool Digital_clockView ::InitView() { container_ = new UIViewGroup();