diff --git a/OTA.xml b/OTA.xml
new file mode 100644
index 0000000..29f7b9f
--- /dev/null
+++ b/OTA.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.en.md b/README.en.md
index 446e80c..f0826a6 100644
--- a/README.en.md
+++ b/README.en.md
@@ -7,9 +7,9 @@ OpenHarmony resource compile tool
>developtools/
>>----global_resource_tool
>>>----include
->>>----src
->>>----third_party denpence third patry lib make script
->>>----CMakeLists.txt
+>>>----src
+>>>----third_party denpence third patry lib make script
+>>>----CMakeLists.txt
>>>----win32.cmake windows cross compile script
#### Installation
@@ -26,20 +26,3 @@ OpenHarmony resource compile tool
1. restool -v show version.
2. restool show help.
-
-#### Contribution
-
-1. Fork the repository
-2. Create Feat_xxx branch
-3. Commit your code
-4. Create Pull Request
-
-
-#### Gitee Feature
-
-1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
-2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
-3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
-4. The most valuable open source project [GVP](https://gitee.com/gvp)
-5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
-6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/README.md b/README.md
index 77f5475..7a8022b 100644
--- a/README.md
+++ b/README.md
@@ -7,9 +7,9 @@ OpenHarmony 资源编译编译工具
>developtools/
>>----global_resource_tool
>>>----include
->>>----src
->>>----third_party 依赖三方库编译脚本
->>>----CMakeLists.txt
+>>>----src
+>>>----third_party 依赖三方库编译脚本
+>>>----CMakeLists.txt
>>>----win32.cmake windows交叉编译脚本
@@ -27,20 +27,3 @@ OpenHarmony 资源编译编译工具
1. restool -v 显示版本信息
2. restool 显示帮助信息
-
-#### 参与贡献
-
-1. Fork 本仓库
-2. 新建 Feat_xxx 分支
-3. 提交代码
-4. 新建 Pull Request
-
-
-#### 特技
-
-1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
-2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
-3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
-4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
-5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
-6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/include/key_parser.h b/include/key_parser.h
index dcf99f4..a4cedaa 100644
--- a/include/key_parser.h
+++ b/include/key_parser.h
@@ -28,8 +28,10 @@ public:
private:
typedef bool (*parse_key_founction)(const std::string &folderName, std::vector &keyparams);
- static bool ParseMatch(const std::vector &keys, std::vector &keyparams, const std::vector &founctions);
- static bool ParseMatchBySeq(const std::vector &keys, std::vector &keyparams, const std::vector &founctions);
+ static bool ParseMatch(const std::vector &keys,
+ std::vector &keyparams, const std::vector &founctions);
+ static bool ParseMatchBySeq(const std::vector &keys,
+ std::vector &keyparams, const std::vector &founctions);
static bool ParseMccMnc(const std::string &folderName, std::vector &keyparams);
static bool ParseMcc(const std::string &folderName, std::vector &keyparams);
diff --git a/include/resource_util.h b/include/resource_util.h
index b5698f6..73e775c 100644
--- a/include/resource_util.h
+++ b/include/resource_util.h
@@ -24,7 +24,6 @@
namespace OHOS {
namespace Global {
namespace Restool {
-
class ResourceUtil {
public:
/**
diff --git a/include/task_handle.h b/include/task_handle.h
index 8100e96..72daadf 100644
--- a/include/task_handle.h
+++ b/include/task_handle.h
@@ -21,7 +21,6 @@
namespace OHOS {
namespace Global {
namespace Restool {
-
class TaskHandle {
public:
TaskHandle() {};
diff --git a/src/cmd_parser.cpp b/src/cmd_parser.cpp
index 3cfc29b..9cc94d4 100644
--- a/src/cmd_parser.cpp
+++ b/src/cmd_parser.cpp
@@ -302,7 +302,7 @@ uint32_t PackageParser::ParseCommand(int argc, char *argv[])
restoolPath_ = string(argv[0]);
while (true) {
int optIndex = 0;
- int c = getopt_long(argc, argv, CMD_PARAMS.c_str(), CMD_OPTS,&optIndex);
+ int c = getopt_long(argc, argv, CMD_PARAMS.c_str(), CMD_OPTS, &optIndex);
if (c == -1) {
break;
}
diff --git a/src/config_parser.cpp b/src/config_parser.cpp
index 15e5f00..da29d9b 100644
--- a/src/config_parser.cpp
+++ b/src/config_parser.cpp
@@ -45,12 +45,12 @@ const map ConfigParser::JSON_ARRAY_IDS = {
bool ConfigParser::useModule_ = false;
ConfigParser::ConfigParser()
- : filePath_("") ,packageName_("") ,moduleName_(""), moduleType_(ModuleType::NONE)
+ : filePath_(""), packageName_(""), moduleName_(""), moduleType_(ModuleType::NONE)
{
}
ConfigParser::ConfigParser(const string &filePath)
- : filePath_(filePath) ,packageName_("") ,moduleName_(""), moduleType_(ModuleType::NONE)
+ : filePath_(filePath), packageName_(""), moduleName_(""), moduleType_(ModuleType::NONE)
{
}
diff --git a/src/file_manager.cpp b/src/file_manager.cpp
index 0d02214..c8f0fbf 100644
--- a/src/file_manager.cpp
+++ b/src/file_manager.cpp
@@ -52,7 +52,7 @@ uint32_t FileManager::ScanIncrement(const string &output)
return ParseReference(output, sxmlFolders);
}
-//below private founction
+// below private founction
uint32_t FileManager::ScanModule(const string &input, const string &output,
map> &resTypeOfDirs)
{
diff --git a/src/generic_compiler.cpp b/src/generic_compiler.cpp
index 727c72d..96f1646 100644
--- a/src/generic_compiler.cpp
+++ b/src/generic_compiler.cpp
@@ -16,8 +16,8 @@
#include "generic_compiler.h"
#include
#include
-#include "restool_errors.h"
#include "resource_util.h"
+#include "restool_errors.h"
namespace OHOS {
namespace Global {
diff --git a/src/header.cpp b/src/header.cpp
index d86de9c..5a99bb5 100644
--- a/src/header.cpp
+++ b/src/header.cpp
@@ -16,8 +16,8 @@
#include "header.h"
#include
#include
-#include
#include
+#include
namespace OHOS {
namespace Global {
diff --git a/src/id_worker.cpp b/src/id_worker.cpp
index 4bc0827..45c4d46 100644
--- a/src/id_worker.cpp
+++ b/src/id_worker.cpp
@@ -173,11 +173,11 @@ uint32_t IdWorker::InitIdDefined()
string idDefinedPath;
if (type_ == ResourceIdCluster::RES_ID_SYS) {
for (const auto &inputPath : packageParser.GetInputs()) {
- idDefinedPath = filesystem::path(inputPath).append(RESOURCES_DIR)
- .append("base").append("element").append(ID_DEFINED_FILE).string();
- if (InitIdDefined(idDefinedPath) != RESTOOL_SUCCESS) {
- return RESTOOL_ERROR;
- }
+ idDefinedPath = filesystem::path(inputPath).append(RESOURCES_DIR)
+ .append("base").append("element").append(ID_DEFINED_FILE).string();
+ if (InitIdDefined(idDefinedPath) != RESTOOL_SUCCESS) {
+ return RESTOOL_ERROR;
+ }
}
return RESTOOL_SUCCESS;
}
diff --git a/src/json_compiler.cpp b/src/json_compiler.cpp
index 0b69b9a..2b40172 100644
--- a/src/json_compiler.cpp
+++ b/src/json_compiler.cpp
@@ -76,7 +76,7 @@ uint32_t JsonCompiler::CompileSingleFile(const FileInfo &fileInfo)
return RESTOOL_SUCCESS;
}
-//below private
+// below private
void JsonCompiler::InitParser()
{
using namespace placeholders;
@@ -169,12 +169,12 @@ bool JsonCompiler::HandleBoolean(const Json::Value &objectNode, ResourceItem &re
{
Json::Value valueNode = objectNode[TAG_VALUE];
if (valueNode.isString()) {
- regex ref("^\\$boolean:.*");
- if (!regex_match(valueNode.asString(), ref)) {
- cerr << "Error: '" << valueNode.asString() << "' only refer '$boolean:xxx',";
- cerr << resourceItem.GetFilePath() << endl;
- return false;
- }
+ regex ref("^\\$boolean:.*");
+ if (!regex_match(valueNode.asString(), ref)) {
+ cerr << "Error: '" << valueNode.asString() << "' only refer '$boolean:xxx',";
+ cerr << resourceItem.GetFilePath() << endl;
+ return false;
+ }
} else if (!valueNode.isBool()) {
cerr << "Error: '" << resourceItem.GetName() << "' value not boolean," << resourceItem.GetFilePath() << endl;
return false;
diff --git a/src/key_parser.cpp b/src/key_parser.cpp
index 3368d73..cb04113 100644
--- a/src/key_parser.cpp
+++ b/src/key_parser.cpp
@@ -51,7 +51,8 @@ bool KeyParser::Parse(const string &folderName, vector &keyparams)
return true;
}
-bool KeyParser::ParseMatch(const vector &keys, vector &keyparams, const vector &founctions)
+bool KeyParser::ParseMatch(const vector &keys,
+ vector &keyparams, const vector &founctions)
{
size_t next = 0;
for (const auto &key : keys) {
@@ -71,7 +72,8 @@ bool KeyParser::ParseMatch(const vector &keys, vector &keypara
return true;
}
-bool KeyParser::ParseMatchBySeq(const vector &keys, vector &keyparams, const vector &founctions)
+bool KeyParser::ParseMatchBySeq(const vector &keys,
+ vector &keyparams, const vector &founctions)
{
for (size_t i = 0; i < keys.size(); i++) {
if (!founctions[i](keys[i], keyparams)) {
diff --git a/src/reference_parser.cpp b/src/reference_parser.cpp
index 530c944..3c00532 100644
--- a/src/reference_parser.cpp
+++ b/src/reference_parser.cpp
@@ -24,35 +24,35 @@ namespace Global {
namespace Restool {
using namespace std;
const map ReferenceParser::ID_REFS = {
- { "^\\$id:", ResType::ID },
- { "^\\$boolean:", ResType::BOOLEAN },
- { "^\\$color:", ResType::COLOR },
- { "^\\$float:", ResType::FLOAT },
- { "^\\$media:", ResType::MEDIA },
- { "^\\$profile:", ResType::PROF },
- { "^\\$integer:", ResType::INTEGER },
- { "^\\$string:", ResType::STRING },
- { "^\\$layout:", ResType::LAYOUT },
- { "^\\$pattern:", ResType::PATTERN },
- { "^\\$plural:", ResType::PLURAL },
- { "^\\$graphic:", ResType::GRAPHIC },
- { "^\\$theme:", ResType::THEME }
+ { "^\\$id:", ResType::ID },
+ { "^\\$boolean:", ResType::BOOLEAN },
+ { "^\\$color:", ResType::COLOR },
+ { "^\\$float:", ResType::FLOAT },
+ { "^\\$media:", ResType::MEDIA },
+ { "^\\$profile:", ResType::PROF },
+ { "^\\$integer:", ResType::INTEGER },
+ { "^\\$string:", ResType::STRING },
+ { "^\\$layout:", ResType::LAYOUT },
+ { "^\\$pattern:", ResType::PATTERN },
+ { "^\\$plural:", ResType::PLURAL },
+ { "^\\$graphic:", ResType::GRAPHIC },
+ { "^\\$theme:", ResType::THEME }
};
const map ReferenceParser::ID_OHOS_REFS = {
- { "^\\$ohos:id:", ResType::ID },
- { "^\\$ohos:boolean:", ResType::BOOLEAN },
- { "^\\$ohos:color:", ResType::COLOR },
- { "^\\$ohos:float:", ResType::FLOAT },
- { "^\\$ohos:media:", ResType::MEDIA },
- { "^\\$ohos:profile:", ResType::PROF },
- { "^\\$ohos:integer:", ResType::INTEGER },
- { "^\\$ohos:string:", ResType::STRING },
- { "^\\$ohos:layout:", ResType::LAYOUT },
- { "^\\$ohos:pattern:", ResType::PATTERN },
- { "^\\$ohos:plural:", ResType::PLURAL },
- { "^\\$ohos:graphic:", ResType::GRAPHIC },
- { "^\\$ohos:theme:", ResType::THEME }
+ { "^\\$ohos:id:", ResType::ID },
+ { "^\\$ohos:boolean:", ResType::BOOLEAN },
+ { "^\\$ohos:color:", ResType::COLOR },
+ { "^\\$ohos:float:", ResType::FLOAT },
+ { "^\\$ohos:media:", ResType::MEDIA },
+ { "^\\$ohos:profile:", ResType::PROF },
+ { "^\\$ohos:integer:", ResType::INTEGER },
+ { "^\\$ohos:string:", ResType::STRING },
+ { "^\\$ohos:layout:", ResType::LAYOUT },
+ { "^\\$ohos:pattern:", ResType::PATTERN },
+ { "^\\$ohos:plural:", ResType::PLURAL },
+ { "^\\$ohos:graphic:", ResType::GRAPHIC },
+ { "^\\$ohos:theme:", ResType::THEME }
};
ReferenceParser::ReferenceParser() : idWorker_(IdWorker::GetInstance())
@@ -75,7 +75,7 @@ uint32_t ReferenceParser::ParseRefInSolidXml(const vector &solidXmlFolde
XmlKeyNode xmlKeyNode;
if (!xmlKeyNode.LoadFromFile(filePath, [this](auto &key) -> bool {
return ParseRefString(key);
- })) {
+ })) {
return RESTOOL_ERROR;
}
@@ -103,10 +103,10 @@ uint32_t ReferenceParser::ParseRefInElement(map> &
uint32_t ReferenceParser::ParseRefInString(string &value, bool &update) const
{
- if (ParseRefString(value, update)) {
- return RESTOOL_SUCCESS;
- }
- return RESTOOL_ERROR;
+ if (ParseRefString(value, update)) {
+ return RESTOOL_SUCCESS;
+ }
+ return RESTOOL_ERROR;
}
uint32_t ReferenceParser::ParseRefInProfile(const string &output) const
@@ -156,7 +156,7 @@ bool ReferenceParser::ParseRefResourceItem(ResourceItem &resourceItem) const
string data;
bool update = false;
if (IsStringOfResourceItem(resType)) {
- data= string(reinterpret_cast(resourceItem.GetData()), resourceItem.GetDataLength());
+ data = string(reinterpret_cast(resourceItem.GetData()), resourceItem.GetDataLength());
if (!ParseRefString(data, update)) {
cerr << "Error: in " << resourceItem.GetFilePath() << endl;
return false;
diff --git a/src/resource_item.cpp b/src/resource_item.cpp
index d11b6d0..c84a5f9 100644
--- a/src/resource_item.cpp
+++ b/src/resource_item.cpp
@@ -31,7 +31,7 @@ ResourceItem::ResourceItem(const ResourceItem &other)
}
ResourceItem::ResourceItem(const string &name, const vector &keyparams, ResType type)
- :data_(nullptr), dataLen_(0), name_(name),keyparams_(keyparams), type_(type)
+ : data_(nullptr), dataLen_(0), name_(name), keyparams_(keyparams), type_(type)
{
}
@@ -118,7 +118,7 @@ ResourceItem &ResourceItem::operator=(const ResourceItem &other)
return *this;
}
-//below private founction
+// below private founction
void ResourceItem::ReleaseData()
{
if (data_ != nullptr) {
diff --git a/src/resource_pack.cpp b/src/resource_pack.cpp
index 94792d0..eeb22e7 100644
--- a/src/resource_pack.cpp
+++ b/src/resource_pack.cpp
@@ -71,7 +71,7 @@ uint32_t ResourcePack::Package()
return RESTOOL_SUCCESS;
}
-//below private founction
+// below private founction
uint32_t ResourcePack::Init()
{
InitHeaderCreater();
@@ -185,7 +185,7 @@ uint32_t ResourcePack::InitConfigJson()
{
string config = packageParser_.GetConfig();
if (config.empty()) {
- if( packageParser_.GetInputs().size() > 1) {
+ if (packageParser_.GetInputs().size() > 1) {
cerr << "Error: more input path, -j config.json empty" << endl;
return RESTOOL_ERROR;
}
@@ -234,8 +234,7 @@ uint32_t ResourcePack::GenerateCplusHeader(const string &headerPath) const
buffer << "#define RESOURCE_TABLE_H\n\n";
buffer << "#include\n\n";
buffer << "namespace OHOS {\n";
- },
- [](stringstream &buffer, const IdWorker::ResourceId& resourceId) {
+ }, [](stringstream &buffer, const IdWorker::ResourceId& resourceId) {
string name = resourceId.type + "_" + resourceId.name;
transform(name.begin(), name.end(), name.begin(), ::toupper);
buffer << "const int32_t " << name << " = ";
@@ -254,8 +253,7 @@ uint32_t ResourcePack::GenerateJsHeader(const std::string &headerPath) const
uint32_t result = JsHeader.Create([](stringstream &buffer) {
buffer << Header::LICENSE_HEADER << "\n";
buffer << "export default {\n";
- },
- [&itemType](stringstream &buffer, const IdWorker::ResourceId& resourceId) {
+ }, [&itemType](stringstream &buffer, const IdWorker::ResourceId& resourceId) {
if (itemType != resourceId.type) {
if (!itemType.empty()) {
buffer << "\n" << " " << "},\n";
diff --git a/src/resource_table.cpp b/src/resource_table.cpp
index abfa1b7..813ee8c 100644
--- a/src/resource_table.cpp
+++ b/src/resource_table.cpp
@@ -15,10 +15,10 @@
#include "resource_table.h"
#include
-#include "securec.h"
#include "cmd_parser.h"
#include "file_manager.h"
#include "resource_util.h"
+#include "securec.h"
namespace OHOS {
namespace Global {
diff --git a/src/resource_util.cpp b/src/resource_util.cpp
index 530fabe..81f3cb4 100644
--- a/src/resource_util.cpp
+++ b/src/resource_util.cpp
@@ -34,7 +34,7 @@ const map ResourceUtil::IGNORE_FILE_REGEX = {
{ "desktop\\.ini", IgnoreType::IGNORE_ALL },
{ "picasa\\.ini", IgnoreType::IGNORE_ALL },
{ "\\..+", IgnoreType::IGNORE_ALL },
- { "_.+",IgnoreType::IGNORE_DIR },
+ { "_.+", IgnoreType::IGNORE_DIR },
{ "cvs", IgnoreType::IGNORE_ALL },
{ "thumbs\\.db", IgnoreType::IGNORE_ALL },
{ ".+~", IgnoreType::IGNORE_ALL }
@@ -88,7 +88,7 @@ bool ResourceUtil::OpenJsonFile(const string &path, Json::Value &root)
readBuilder["collectComments"] = false;
readBuilder["failIfExtra"] = true;
JSONCPP_STRING errs;
- if(!parseFromStream(readBuilder, ifs, &root, &errs)) {
+ if (!parseFromStream(readBuilder, ifs, &root, &errs)) {
cerr << "Error: parseFromStream '" << path;
cerr << "\n" << errs << endl;
ifs.close();
@@ -144,7 +144,7 @@ string ResourceUtil::ResTypeToString(ResType type)
string ResourceUtil::GetIdName(const string &name, ResType type)
{
if (type != ResType::MEDIA && type != ResType::LAYOUT && type != ResType::PROF &&
- type != ResType::ANIMATION && type != ResType::GRAPHIC ) {
+ type != ResType::ANIMATION && type != ResType::GRAPHIC) {
return name;
}
diff --git a/src/restool.cpp b/src/restool.cpp
index 979e288..3da2fca 100644
--- a/src/restool.cpp
+++ b/src/restool.cpp
@@ -19,7 +19,8 @@
using namespace std;
using namespace OHOS::Global::Restool;
-uint32_t ProccssHap(PackageParser &packageParser) {
+uint32_t ProccssHap(PackageParser &packageParser)
+{
TaskHandle taskHandle;
return taskHandle.HandlePackage(packageParser);
}
diff --git a/src/solid_xml_compiler.cpp b/src/solid_xml_compiler.cpp
index 8efbbde..fd2c2d8 100644
--- a/src/solid_xml_compiler.cpp
+++ b/src/solid_xml_compiler.cpp
@@ -17,8 +17,8 @@
#include
#include
#include
-#include "restool_errors.h"
#include "resource_util.h"
+#include "restool_errors.h"
namespace OHOS {
namespace Global {
diff --git a/src/xml/solid_xml.cpp b/src/xml/solid_xml.cpp
index 26cfe5c..50645b0 100644
--- a/src/xml/solid_xml.cpp
+++ b/src/xml/solid_xml.cpp
@@ -78,7 +78,7 @@ bool SolidXml::FlushNodeKeys(const string &filePath, map &node)
{
if (nodePtr->type == XML_COMMENT_NODE) {
@@ -119,7 +119,7 @@ void SolidXml::CompileAttr(const xmlAttrPtr attrPtr, shared_ptr &node)
return;
}
- xmlChar * xmlValue = xmlNodeListGetString(attrPtr->doc, attrPtr->children, 1);
+ xmlChar *xmlValue = xmlNodeListGetString(attrPtr->doc, attrPtr->children, 1);
string value(reinterpret_cast(xmlValue));
PretreatmentAttr(value);
xmlFree(xmlValue);
diff --git a/src/xml/xml_key_node.cpp b/src/xml/xml_key_node.cpp
index f77638a..3b59a5f 100644
--- a/src/xml/xml_key_node.cpp
+++ b/src/xml/xml_key_node.cpp
@@ -56,7 +56,7 @@ bool XmlKeyNode::SaveToFile(const string &filePath) const
}
vector> sets(keyMap_.begin(), keyMap_.end());
- sort(sets.begin(), sets.end(),[](const auto &a, const auto &b) {
+ sort(sets.begin(), sets.end(), [](const auto &a, const auto &b) {
return a.second < b.second;
});