mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-18 17:24:42 -04:00
@@ -53,6 +53,8 @@ public:
|
||||
const std::string &GetIdDefinedOutput() const;
|
||||
const std::string &GetIdDefinedInputPath() const;
|
||||
bool GetIconCheck() const;
|
||||
const TargetConfig &GetTargetConfigValues() const;
|
||||
bool IsTargetConfig() const;
|
||||
|
||||
private:
|
||||
void InitCommand();
|
||||
@@ -79,6 +81,7 @@ private:
|
||||
bool IsAscii(const std::string& argValue) const;
|
||||
bool IsLongOpt(char *argv[]) const;
|
||||
uint32_t IconCheck();
|
||||
uint32_t ParseTargetConfig(const std::string& argValue);
|
||||
|
||||
static const struct option CMD_OPTS[];
|
||||
static const std::string CMD_PARAMS;
|
||||
@@ -100,6 +103,8 @@ private:
|
||||
std::string idDefinedOutput_;
|
||||
std::string idDefinedInputPath_;
|
||||
bool isIconCheck_ = false;
|
||||
TargetConfig targetConfig_;
|
||||
bool isTtargetConfig_;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@@ -140,6 +145,7 @@ void CmdParser<T>::ShowUseage()
|
||||
std::cout << " --dependEntry Build result directory of the specified entry module when the feature";
|
||||
std::cout << " module resources are independently built in the FA model.\n";
|
||||
std::cout << " --icon-check Enable the PNG image verification function for icons and startwindows.\n";
|
||||
std::cout << " --target-config When used with '-i', selective compilation is supported.\n";
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace Restool {
|
||||
class KeyParser {
|
||||
public:
|
||||
static bool Parse(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseLimit(const std::string &func, std::vector<std::string> &limitValues,
|
||||
TargetConfig &targetConfig);
|
||||
|
||||
private:
|
||||
typedef bool (*parse_key_founction)(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
|
||||
+54
-1
@@ -39,7 +39,7 @@ const static std::string LONG_PATH_HEAD = "\\\\?\\";
|
||||
const static std::string ID_DEFINED_INDENTATION = " ";
|
||||
const static int32_t VERSION_MAX_LEN = 128;
|
||||
const static int32_t INT_TO_BYTES = sizeof(uint32_t);
|
||||
static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 4.103" };
|
||||
static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 4.104" };
|
||||
const static int32_t TAG_LEN = 4;
|
||||
|
||||
enum class KeyType {
|
||||
@@ -55,6 +55,7 @@ enum class KeyType {
|
||||
// RESERVER 9
|
||||
INPUTDEVICE = 10,
|
||||
KEY_TYPE_MAX,
|
||||
OTHER,
|
||||
};
|
||||
|
||||
enum class ResType {
|
||||
@@ -117,6 +118,7 @@ enum Option {
|
||||
DEFINED_IDS = 2,
|
||||
DEPENDENTRY = 3,
|
||||
ICON_CHECK = 4,
|
||||
TARGET_CONFIG = 5,
|
||||
STARTID = 'e',
|
||||
FORCEWRITE = 'f',
|
||||
HELP = 'h',
|
||||
@@ -169,6 +171,10 @@ const std::map<std::string, InputDevice> g_inputDeviceMap = {
|
||||
struct KeyParam {
|
||||
KeyType keyType;
|
||||
uint32_t value;
|
||||
bool operator == (const KeyParam &other)
|
||||
{
|
||||
return keyType == other.keyType && value == other.value;
|
||||
}
|
||||
};
|
||||
|
||||
struct IdData {
|
||||
@@ -250,6 +256,53 @@ struct FileInfo : DirectoryInfo {
|
||||
std::string filename;
|
||||
ResType fileType;
|
||||
};
|
||||
|
||||
struct TargetConfig {
|
||||
std::vector<KeyParam> mccmnc;
|
||||
std::vector<KeyParam> locale;
|
||||
std::vector<KeyParam> orientation;
|
||||
std::vector<KeyParam> device;
|
||||
std::vector<KeyParam> colormode;
|
||||
std::vector<KeyParam> density;
|
||||
};
|
||||
|
||||
struct Mccmnc {
|
||||
KeyParam mcc;
|
||||
KeyParam mnc;
|
||||
bool operator == (const Mccmnc &other)
|
||||
{
|
||||
if (mcc.value != other.mcc.value) {
|
||||
return false;
|
||||
}
|
||||
if (mnc.keyType != KeyType::OTHER && other.mnc.keyType != KeyType::OTHER &&
|
||||
mnc.value != other.mnc.value) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct Locale {
|
||||
KeyParam language;
|
||||
KeyParam script;
|
||||
KeyParam region;
|
||||
bool operator == (const Locale &other)
|
||||
{
|
||||
if (language.value != other.language.value) {
|
||||
return false;
|
||||
}
|
||||
if (script.keyType != KeyType::OTHER && other.script.keyType != KeyType::OTHER &&
|
||||
script.value != other.script.value) {
|
||||
return false;
|
||||
}
|
||||
if (region.keyType != KeyType::OTHER && other.region.keyType != KeyType::OTHER &&
|
||||
region.value != other.region.value) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +216,12 @@ public:
|
||||
*/
|
||||
static bool isUnicodeInPlane15or16(int unicode);
|
||||
|
||||
/**
|
||||
* @brief Remove spaces before and after strings
|
||||
* @param str input string
|
||||
*/
|
||||
static void RemoveSpaces(std::string &str);
|
||||
|
||||
private:
|
||||
enum class IgnoreType {
|
||||
IGNORE_FILE,
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_RESTOOL_SELECT_COMPILE_PARSE_H
|
||||
#define OHOS_RESTOOL_SELECT_COMPILE_PARSE_H
|
||||
|
||||
#include "resource_data.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class SelectCompileParse {
|
||||
public:
|
||||
static bool ParseTargetConfig(const std::string &limitParams, TargetConfig &targetConfig);
|
||||
static bool IsSelectCompile(std::vector<KeyParam> &keyParams);
|
||||
|
||||
private:
|
||||
static bool IsSelectableMccmnc(std::vector<KeyParam> &keyParams, size_t &index, std::vector<KeyParam> &limit);
|
||||
static bool IsSelectableLocale(std::vector<KeyParam> &keyParams, size_t &index, std::vector<KeyParam> &limit);
|
||||
static bool IsSelectableOther(std::vector<KeyParam> &keyParams, size_t &index, std::vector<KeyParam> &limit);
|
||||
static void InitMccmnc(std::vector<KeyParam> &limit);
|
||||
static void InitLocale(std::vector<KeyParam> &limit);
|
||||
static std::vector<Mccmnc> mccmncArray_;
|
||||
static std::vector<Locale> localeArray_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user