mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-19 19:33:46 -04:00
@@ -53,6 +53,8 @@ public:
|
||||
const std::vector<std::string> &GetAppend() const;
|
||||
bool GetCombine() const;
|
||||
const std::string &GetDependEntry() const;
|
||||
const std::string &GetIdDefinedOutput() const;
|
||||
const std::string &GetIdDefinedInputPath() const;
|
||||
|
||||
private:
|
||||
void InitCommand();
|
||||
@@ -76,6 +78,8 @@ private:
|
||||
uint32_t SetCombine();
|
||||
uint32_t AddDependEntry(const std::string& argValue);
|
||||
uint32_t ShowHelp() const;
|
||||
uint32_t SetIdDefinedOutput(const std::string& argValue);
|
||||
uint32_t SetIdDefinedInputPath(const std::string& argValue);
|
||||
bool IsAscii(const std::string& argValue) const;
|
||||
|
||||
static const struct option CMD_OPTS[];
|
||||
@@ -98,6 +102,8 @@ private:
|
||||
std::vector<std::string> append_;
|
||||
bool combine_ = false;
|
||||
std::string dependEntry_;
|
||||
std::string idDefinedOutput_;
|
||||
std::string idDefinedInputPath_;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@@ -130,6 +136,8 @@ void CmdParser<T>::ShowUseage()
|
||||
std::cout << " -x resources folder path\n";
|
||||
std::cout << " -z flag for incremental compilation\n";
|
||||
std::cout << " -h Displays this help menu\n";
|
||||
std::cout << " --ids save id_defined.json direcory\n";
|
||||
std::cout << " --defined-ids input id_defined.json path\n";
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
||||
+8
-3
@@ -53,21 +53,26 @@ private:
|
||||
int32_t GenerateAppId(ResType resType, const std::string &name);
|
||||
int32_t GenerateSysId(ResType resType, const std::string &name);
|
||||
uint32_t InitIdDefined();
|
||||
uint32_t InitIdDefined(const std::string &filePath);
|
||||
uint32_t InitIdDefined(const std::string &filePath, bool isSystem);
|
||||
uint32_t IdDefinedToResourceIds(const Json::Value &record, bool isSystem, const int32_t strtSysId = 0);
|
||||
using ParseFunction = std::function<bool(const Json::Value&, ResourceId&)>;
|
||||
void InitParser();
|
||||
bool ParseType(const Json::Value &type, ResourceId &resourceId);
|
||||
bool ParseName(const Json::Value &name, ResourceId &resourceId);
|
||||
bool ParseOrder(const Json::Value &order, ResourceId &resourceId);
|
||||
bool PushResourceId(const ResourceId &resourceId);
|
||||
bool ParseId(const Json::Value &id, ResourceId &resourceId);
|
||||
bool PushResourceId(const ResourceId &resourceId, bool isSystem);
|
||||
bool IsValidSystemName(const std::string &name) const;
|
||||
int32_t GetStartId(const Json::Value &root) const;
|
||||
int32_t GetMaxId(int32_t startId) const;
|
||||
int32_t GetCurId();
|
||||
int32_t appId_;
|
||||
int32_t maxId_;
|
||||
ResourceIdCluster type_;
|
||||
std::map<std::pair<ResType, std::string>, int32_t> ids_;
|
||||
std::map<std::pair<ResType, std::string>, ResourceId> definedIds_;
|
||||
std::map<std::pair<ResType, std::string>, ResourceId> sysDefinedIds_;
|
||||
std::map<std::pair<ResType, std::string>, ResourceId> appDefinedIds_;
|
||||
std::map<int32_t, ResourceId> idDefineds_;
|
||||
std::map<std::string, ParseFunction> handles_;
|
||||
std::vector<int32_t> delIds_;
|
||||
std::map<std::pair<ResType, std::string>, int32_t> cacheIds_;
|
||||
|
||||
@@ -57,6 +57,7 @@ private:
|
||||
int32_t ParseInt32(const char buffer[], int32_t length, int32_t &offset) const;
|
||||
bool ParseRef();
|
||||
bool CheckModuleResourceItem(const std::shared_ptr<ResourceItem> &resourceItem, int32_t id);
|
||||
bool IsBaseIdDefined(const FileInfo &fileInfo);
|
||||
#ifdef __WIN32
|
||||
bool LoadResourceItemWin(const std::string &filePath);
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,7 @@ const static std::string RESOURCE_INDEX_FILE = "resources.index";
|
||||
const static std::string SEPARATOR = "/";
|
||||
const static std::string WIN_SEPARATOR = "\\";
|
||||
const static std::string NEW_LINE_PATH = "\r\nat ";
|
||||
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 2.010" };
|
||||
|
||||
@@ -62,6 +62,7 @@ private:
|
||||
int32_t id;
|
||||
};
|
||||
uint32_t SaveToResouorceIndex(const std::map<std::string, std::vector<TableData>> &configs) const;
|
||||
uint32_t CreateIdDefined(const std::map<int32_t, std::vector<ResourceItem>> &allResource) const;
|
||||
bool InitIndexHeader(IndexHeader &indexHeader, uint32_t count) const;
|
||||
bool Prepare(const std::map<std::string, std::vector<TableData>> &configs,
|
||||
std::map<std::string, LimitKeyConfig> &limitKeyConfigs,
|
||||
@@ -83,6 +84,7 @@ private:
|
||||
const std::map<int32_t, std::pair<int32_t, int32_t>> &datas,
|
||||
std::map<int32_t, std::vector<ResourceItem>> &resInfos) const;
|
||||
std::string indexFilePath_;
|
||||
std::string idDefinedPath_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,6 +172,26 @@ public:
|
||||
* @return limitkey
|
||||
*/
|
||||
static std::string PaserKeyParam(const std::vector<KeyParam> &keyParams);
|
||||
|
||||
/**
|
||||
* @brief Decimal to hexadecimal string
|
||||
* @param int32_t Decimal
|
||||
* @return Hexadecimal string
|
||||
*/
|
||||
static std::string DecToHexStr(const int32_t id);
|
||||
|
||||
/**
|
||||
* @brief Check hexadecimal string
|
||||
* @param string Hexadecimal string
|
||||
* @return ture Hexadecimal string is legal, other false;
|
||||
*/
|
||||
static bool CheckHexStr(const std::string &hex);
|
||||
|
||||
/**
|
||||
* @brief get g_contentClusterMap key string
|
||||
* @return All restype string
|
||||
*/
|
||||
static std::string GetAllRestypeString();
|
||||
private:
|
||||
enum class IgnoreType {
|
||||
IGNORE_FILE,
|
||||
|
||||
Reference in New Issue
Block a user