!201 restool 添加dump 命令

Merge pull request !201 from sunjie/dev
This commit is contained in:
openharmony_ci
2024-12-24 03:10:38 +00:00
committed by Gitee
34 changed files with 1003 additions and 267 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
#ifndef OHOS_RESTOOL_BINARY_FILE_PACKER_H
#define OHOS_RESTOOL_BINARY_FILE_PACKER_H
#include "cmd_parser.h"
#include "cmd/package_parser.h"
#include "resource_util.h"
#include "thread_pool.h"
+102
View File
@@ -0,0 +1,102 @@
/*
* Copyright (c) 2024 - 2024 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_CMD_PARSER_H
#define OHOS_RESTOOL_CMD_PARSER_H
#include <cstdint>
#include <memory>
#include <iostream>
#include <string>
#include <type_traits>
#include "singleton.h"
#include "restool_errors.h"
namespace OHOS {
namespace Global {
namespace Restool {
class ICmdParser {
public:
virtual uint32_t Parse(int argc, char *argv[]) = 0;
virtual uint32_t ExecCommand() = 0;
};
template<class T>
class CmdParser : public Singleton<CmdParser<T>> {
static_assert(std::is_base_of_v<ICmdParser, T>, "Template T must inherit ICmdParser.");
public:
T &GetCmdParser();
uint32_t Parse(int argc, char *argv[]);
uint32_t ExecCommand();
static void ShowUseage();
private:
T cmdParser_;
};
template<class T>
void CmdParser<T>::ShowUseage()
{
std::cout << "This is an OHOS Packaging Tool.\n";
std::cout << "Usage:\n";
std::cout << TOOL_NAME << " [arguments] Package the OHOS resources.\n";
std::cout << "[arguments]:\n";
std::cout << " -i/--inputPath input resource path, can add more.\n";
std::cout << " -p/--packageName package name.\n";
std::cout << " -o/--outputPath output path.\n";
std::cout << " -r/--resHeader resource header file path(like ./ResourceTable.js, ./ResrouceTable.h).\n";
std::cout << " -f/--forceWrite if output path exists,force delete it.\n";
std::cout << " -v/--version print tool version.\n";
std::cout << " -m/--modules module name, can add more, split by ','(like entry1,entry2,...).\n";
std::cout << " -j/--json config.json path.\n";
std::cout << " -e/--startId start id mask, e.g 0x01000000,";
std::cout << " in [0x01000000, 0x06FFFFFF),[0x08000000, 0xFFFFFFFF)\n";
std::cout << " -x/--append resources folder path\n";
std::cout << " -z/--combine flag for incremental compilation\n";
std::cout << " -h/--help Displays this help menu\n";
std::cout << " -l/--fileList input json file of the option set, e.g resConfig.json.";
std::cout << " For details, see the developer documentation.\n";
std::cout << " --ids save id_defined.json direcory\n";
std::cout << " --defined-ids input id_defined.json path\n";
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";
std::cout << " --compressed-config opt-compression.json path.\n";
std::cout << " dump [config] Dump rsource in hap to json. If with 'config', will only dump limit path.\n";
}
template<class T>
T &CmdParser<T>::GetCmdParser()
{
return cmdParser_;
}
template<class T>
uint32_t CmdParser<T>::Parse(int argc, char *argv[])
{
return cmdParser_.Parse(argc, argv);
}
template<class T>
uint32_t CmdParser<T>::ExecCommand()
{
return cmdParser_.ExecCommand();
};
}
}
}
#endif
+40
View File
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 - 2024 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_DUMP_PARSER_H
#define OHOS_RESTOOL_DUMP_PARSER_H
#include "cmd_parser.h"
#include <memory>
#include <string>
namespace OHOS {
namespace Global {
namespace Restool {
class DumpParser : public ICmdParser {
public:
virtual ~DumpParser() = default;
uint32_t Parse(int argc, char *argv[]) override;
uint32_t ExecCommand() override;
const std::string &GetInputPath() const;
private:
std::string inputPath_;
std::string type_;
};
} // namespace Restool
} // namespace Global
} // namespace OHOS
#endif
+112
View File
@@ -0,0 +1,112 @@
/*
* Copyright (c) 2024 - 2024 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_PACKAGE_PARSER_H
#define OHOS_RESTOOL_PACKAGE_PARSER_H
#include <functional>
#include <getopt.h>
#include "cmd_parser.h"
namespace OHOS {
namespace Global {
namespace Restool {
class PackageParser : public ICmdParser {
public:
PackageParser(){};
virtual ~PackageParser() = default;
uint32_t Parse(int argc, char *argv[]) override;
uint32_t ExecCommand() override;
const std::vector<std::string> &GetInputs() const;
const std::string &GetPackageName() const;
const std::string &GetOutput() const;
const std::vector<std::string> &GetResourceHeaders() const;
bool GetForceWrite() const;
const std::vector<std::string> &GetModuleNames() const;
const std::string &GetConfig() const;
const std::string &GetRestoolPath() const;
uint32_t GetStartId() const;
bool IsFileList() const;
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;
bool GetIconCheck() const;
const TargetConfig &GetTargetConfigValues() const;
bool IsTargetConfig() const;
const std::vector<std::string> &GetSysIdDefinedPaths() const;
const std::string &GetCompressionPath() const;
bool IsOverlap() const;
private:
void InitCommand();
uint32_t ParseCommand(int argc, char *argv[]);
uint32_t CheckError(int argc, char *argv[], int c, int optIndex);
uint32_t AddInput(const std::string &argValue);
uint32_t AddPackageName(const std::string &argValue);
uint32_t AddOutput(const std::string &argValue);
uint32_t AddResourceHeader(const std::string &argValue);
uint32_t ForceWrite();
uint32_t PrintVersion();
uint32_t AddMoudleNames(const std::string &argValue);
uint32_t AddConfig(const std::string &argValue);
uint32_t AddStartId(const std::string &argValue);
void AdaptResourcesDirForInput();
uint32_t CheckParam() const;
uint32_t HandleProcess(int c, const std::string &argValue);
uint32_t ParseFileList(const std::string &fileListPath);
uint32_t AddAppend(const std::string &argValue);
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);
uint32_t AddSysIdDefined(const std::string &argValue);
bool IsAscii(const std::string &argValue) const;
bool IsLongOpt(int argc, char *argv[]) const;
uint32_t IconCheck();
uint32_t ParseTargetConfig(const std::string &argValue);
uint32_t AddCompressionPath(const std::string &argValue);
static const struct option CMD_OPTS[];
static const std::string CMD_PARAMS;
using HandleArgValue = std::function<uint32_t(const std::string &)>;
std::map<int32_t, HandleArgValue> handles_;
std::vector<std::string> inputs_;
std::string packageName_;
std::string output_;
std::vector<std::string> resourceHeaderPaths_;
bool forceWrite_ = false;
std::vector<std::string> moduleNames_;
std::string configPath_;
std::string restoolPath_;
uint32_t startId_ = 0;
bool isFileList_ = false;
std::vector<std::string> append_;
bool combine_ = false;
std::string dependEntry_;
std::string idDefinedOutput_;
std::string idDefinedInputPath_;
bool isIconCheck_ = false;
TargetConfig targetConfig_;
bool isTtargetConfig_;
std::vector<std::string> sysIdDefinedPaths_;
std::string compressionPath_;
};
} // namespace Restool
} // namespace Global
} // namespace OHOS
#endif
-177
View File
@@ -1,177 +0,0 @@
/*
* Copyright (c) 2021 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_CMD_PARSER_H
#define OHOS_RESTOOL_CMD_PARSER_H
#include <getopt.h>
#include <iostream>
#include <functional>
#include <vector>
#include "singleton.h"
#include "resource_data.h"
#include "restool_errors.h"
namespace OHOS {
namespace Global {
namespace Restool {
class ICmdParser {
public:
virtual uint32_t Parse(int argc, char *argv[]) = 0;
};
class PackageParser : public ICmdParser {
public:
PackageParser() {};
virtual ~PackageParser() = default;
uint32_t Parse(int argc, char *argv[]) override;
const std::vector<std::string> &GetInputs() const;
const std::string &GetPackageName() const;
const std::string &GetOutput() const;
const std::vector<std::string> &GetResourceHeaders() const;
bool GetForceWrite() const;
const std::vector<std::string> &GetModuleNames() const;
const std::string &GetConfig() const;
const std::string &GetRestoolPath() const;
uint32_t GetStartId() const;
bool IsFileList() const;
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;
bool GetIconCheck() const;
const TargetConfig &GetTargetConfigValues() const;
bool IsTargetConfig() const;
const std::vector<std::string> &GetSysIdDefinedPaths() const;
const std::string &GetCompressionPath() const;
bool IsOverlap() const;
private:
void InitCommand();
uint32_t ParseCommand(int argc, char *argv[]);
uint32_t CheckError(int argc, char *argv[], int c, int optIndex);
uint32_t AddInput(const std::string& argValue);
uint32_t AddPackageName(const std::string& argValue);
uint32_t AddOutput(const std::string& argValue);
uint32_t AddResourceHeader(const std::string& argValue);
uint32_t ForceWrite();
uint32_t PrintVersion();
uint32_t AddMoudleNames(const std::string& argValue);
uint32_t AddConfig(const std::string& argValue);
uint32_t AddStartId(const std::string& argValue);
void AdaptResourcesDirForInput();
uint32_t CheckParam() const;
uint32_t HandleProcess(int c, const std::string& argValue);
uint32_t ParseFileList(const std::string& fileListPath);
uint32_t AddAppend(const std::string& argValue);
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);
uint32_t AddSysIdDefined(const std::string& argValue);
bool IsAscii(const std::string& argValue) const;
bool IsLongOpt(int argc, char *argv[]) const;
uint32_t IconCheck();
uint32_t ParseTargetConfig(const std::string& argValue);
uint32_t AddCompressionPath(const std::string& argValue);
static const struct option CMD_OPTS[];
static const std::string CMD_PARAMS;
using HandleArgValue = std::function<uint32_t(const std::string&)>;
std::map<int32_t, HandleArgValue> handles_;
std::vector<std::string> inputs_;
std::string packageName_;
std::string output_;
std::vector<std::string> resourceHeaderPaths_;
bool forceWrite_ = false;
std::vector<std::string> moduleNames_;
std::string configPath_;
std::string restoolPath_;
uint32_t startId_ = 0;
bool isFileList_ = false;
std::vector<std::string> append_;
bool combine_ = false;
std::string dependEntry_;
std::string idDefinedOutput_;
std::string idDefinedInputPath_;
bool isIconCheck_ = false;
TargetConfig targetConfig_;
bool isTtargetConfig_;
std::vector<std::string> sysIdDefinedPaths_;
std::string compressionPath_;
};
template<class T>
class CmdParser : public Singleton<CmdParser<T>> {
public:
T &GetCmdParser();
uint32_t Parse(int argc, char *argv[]);
static void ShowUseage();
private:
T cmdParser_;
};
template<class T>
void CmdParser<T>::ShowUseage()
{
std::cout << "This is an OHOS Packaging Tool.\n";
std::cout << "Usage:\n";
std::cout << TOOL_NAME << " [arguments] Package the OHOS resources.\n";
std::cout << "[arguments]:\n";
std::cout << " -i/--inputPath input resource path, can add more.\n";
std::cout << " -p/--packageName package name.\n";
std::cout << " -o/--outputPath output path.\n";
std::cout << " -r/--resHeader resource header file path(like ./ResourceTable.js, ./ResrouceTable.h).\n";
std::cout << " -f/--forceWrite if output path exists,force delete it.\n";
std::cout << " -v/--version print tool version.\n";
std::cout << " -m/--modules module name, can add more, split by ','(like entry1,entry2,...).\n";
std::cout << " -j/--json config.json path.\n";
std::cout << " -e/--startId start id mask, e.g 0x01000000,";
std::cout << " in [0x01000000, 0x06FFFFFF),[0x08000000, 0xFFFFFFFF)\n";
std::cout << " -x/--append resources folder path\n";
std::cout << " -z/--combine flag for incremental compilation\n";
std::cout << " -h/--help Displays this help menu\n";
std::cout << " -l/--fileList input json file of the option set, e.g resConfig.json.";
std::cout << " For details, see the developer documentation.\n";
std::cout << " --ids save id_defined.json direcory\n";
std::cout << " --defined-ids input id_defined.json path\n";
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";
std::cout << " --compressed-config opt-compression.json path.\n";
}
template<class T>
T &CmdParser<T>::GetCmdParser()
{
return cmdParser_;
}
template<class T>
uint32_t CmdParser<T>::Parse(int argc, char *argv[])
{
if (cmdParser_.Parse(argc, argv) != RESTOOL_SUCCESS) {
return RESTOOL_ERROR;
}
return RESTOOL_SUCCESS;
}
}
}
}
#endif
+1 -1
View File
@@ -18,7 +18,7 @@
#include <string>
#include <cJSON.h>
#include "cmd_parser.h"
#include "cmd/package_parser.h"
namespace OHOS {
namespace Global {
+2 -2
View File
@@ -17,8 +17,8 @@
#define OHOS_RESTOOL_RESOURCE_APPEND_H
#include <fstream>
#include "cmd_parser.h"
#include "factory_resource_compiler.h"
#include "cmd/package_parser.h"
#include "resource_compiler_factory.h"
#include "file_entry.h"
namespace OHOS {
@@ -22,7 +22,7 @@
namespace OHOS {
namespace Global {
namespace Restool {
class FactoryResourceCompiler {
class ResourceCompilerFactory {
public:
static std::unique_ptr<IResourceCompiler> CreateCompiler(ResType type, const std::string &output, bool isHap);
static std::unique_ptr<IResourceCompiler> CreateCompilerForAppend(ResType type, const std::string &output);
+14 -1
View File
@@ -49,7 +49,7 @@ const static std::string SOLUTIONS_ARROW = "> ";
const static std::string LONG_PATH_HEAD = "\\\\?\\";
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 5.1.0.002" };
static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 5.1.0.003" };
const static int32_t TAG_LEN = 4;
static std::set<std::string> g_resourceSet;
static std::set<std::string> g_hapResourceSet;
@@ -251,6 +251,19 @@ const std::map<std::string, ResType> g_contentClusterMap = {
{ "symbol", ResType::SYMBOL }
};
const std::map<KeyType, std::string> g_keyTypeToStrMap = {
{KeyType::MCC, "mcc"},
{KeyType::MNC, "mnc"},
{KeyType::LANGUAGE, "language"},
{KeyType::SCRIPT, "script"},
{KeyType::REGION, "region"},
{KeyType::ORIENTATION, "orientation"},
{KeyType::RESOLUTION, "density"},
{KeyType::DEVICETYPE, "device"},
{KeyType::NIGHTMODE, "colorMode"},
{KeyType::INPUTDEVICE, "inputDevice"},
};
const std::map<int32_t, ResType> g_resTypeMap = {
{ static_cast<int32_t>(ResType::ELEMENT), ResType::ELEMENT},
{ static_cast<int32_t>(ResType::RAW), ResType::RAW},
+81
View File
@@ -0,0 +1,81 @@
/*
* Copyright (c) 2024 - 2024 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_RESOURCE_DUMP_H
#define OHOS_RESTOOL_RESOURCE_DUMP_H
#include <cstdint>
#include <functional>
#include <map>
#include <memory>
#include <set>
#include <vector>
#include "config_parser.h"
#include "unzip.h"
#include "cJSON.h"
#include "cmd/dump_parser.h"
#include "resource_data.h"
#include "resource_item.h"
namespace OHOS {
namespace Global {
namespace Restool {
class ResourceDumper {
public:
virtual ~ResourceDumper() = default;
virtual uint32_t Dump(const DumpParser &parser);
protected:
virtual uint32_t DumpRes(std::string &out) const = 0;
void ReadHapInfo(const std::unique_ptr<char[]> &buffer, size_t len);
uint32_t LoadHap();
uint32_t ReadFileFromZip(unzFile &zip, const char *fileName, std::unique_ptr<char[]> &buffer, size_t &len);
std::string inputPath_;
std::string bundleName_;
std::string moduleName_;
std::map<int64_t, std::vector<ResourceItem>> resInfos_;
};
class ConfigDumper : public ResourceDumper {
public:
virtual ~ConfigDumper() = default;
uint32_t DumpRes(std::string &out) const override;
};
class CommonDumper : public ResourceDumper {
public:
virtual ~CommonDumper() = default;
uint32_t DumpRes(std::string &out) const override;
private:
uint32_t AddValueToJson(const ResourceItem &item, cJSON *json) const;
uint32_t AddPairVauleToJson(const ResourceItem &item, cJSON *json) const;
uint32_t AddKeyParamsToJson(const std::vector<KeyParam> &keyParams, cJSON *json) const;
uint32_t AddResourceToJson(int64_t id, const std::vector<ResourceItem> &items, cJSON *json) const;
uint32_t AddItemCommonPropToJson(int32_t resId, const ResourceItem &item, cJSON* json) const;
};
class ResourceDumperFactory {
public:
static std::unique_ptr<ResourceDumper> CreateResourceDumper(const std::string &type);
static const std::set<std::string> GetSupportDumpType();
};
} // namespace Restool
} // namespace Global
} // namespace OHOS
#endif
+3
View File
@@ -44,6 +44,9 @@ public:
const std::string &GetFilePath() const;
const std::string &GetLimitKey() const;
bool IsCoverable() const;
const std::vector<std::string> SplitValue() const;
bool IsArray() const;
bool IsPair() const;
ResourceItem &operator=(const ResourceItem &other);
private:
+1 -1
View File
@@ -20,7 +20,7 @@
#include <vector>
#include "config_parser.h"
#include "restool_errors.h"
#include "cmd_parser.h"
#include "cmd/package_parser.h"
namespace OHOS {
namespace Global {
+1 -1
View File
@@ -16,7 +16,7 @@
#ifndef OHOS_RESTOOL_RESOURCE_OVERLAP_H
#define OHOS_RESTOOL_RESOURCE_OVERLAP_H
#include "cmd_parser.h"
#include "cmd/package_parser.h"
#include "resource_pack.h"
namespace OHOS {
+2 -1
View File
@@ -16,7 +16,6 @@
#ifndef OHOS_RESTOOL_RESOURCE_PACK_H
#define OHOS_RESTOOL_RESOURCE_PACK_H
#include "cmd_parser.h"
#include "config_parser.h"
#include "resource_append.h"
#include "resource_data.h"
@@ -65,6 +64,8 @@ private:
void CheckConfigJson();
void CheckConfigJsonForCombine(ResourceAppend &resourceAppend);
bool CopyIcon(std::string &dataPath, const std::string &idName, std::string &fileName) const;
void ShowPackSuccess();
using HeaderCreater = std::function<uint32_t(const std::string&)>;
std::map<std::string, HeaderCreater> headerCreaters_;
PackType packType_ = PackType::NORMAL;
@@ -22,7 +22,7 @@
namespace OHOS {
namespace Global {
namespace Restool {
class FactoryResourcePacker {
class ResourcePackerFactory {
public:
static std::unique_ptr<ResourcePack> CreatePacker(PackType type, const PackageParser &packageParser);
};
+10 -9
View File
@@ -31,7 +31,8 @@ public:
virtual ~ResourceTable();
uint32_t CreateResourceTable();
uint32_t CreateResourceTable(const std::map<int64_t, std::vector<std::shared_ptr<ResourceItem>>> &items);
uint32_t LoadResTable(const std::string path, std::map<int64_t, std::vector<ResourceItem>> &resInfos);
static uint32_t LoadResTable(const std::string path, std::map<int64_t, std::vector<ResourceItem>> &resInfos);
static uint32_t LoadResTable(std::basic_istream<char> &in, std::map<int64_t, std::vector<ResourceItem>> &resInfos);
private:
struct TableData {
uint32_t id;
@@ -74,16 +75,16 @@ private:
void SaveLimitKeyConfigs(const std::map<std::string, LimitKeyConfig> &limitKeyConfigs,
std::ostringstream &out) const;
void SaveIdSets(const std::map<std::string, IdSet> &idSets, std::ostringstream &out) const;
bool ReadFileHeader(std::ifstream &in, IndexHeader &indexHeader, uint64_t &pos, uint64_t length) const;
bool ReadLimitKeys(std::ifstream &in, std::map<int64_t, std::vector<KeyParam>> &limitKeys,
uint32_t count, uint64_t &pos, uint64_t length) const;
bool ReadIdTables(std::ifstream &in, std::map<int64_t, std::pair<int64_t, int64_t>> &datas,
uint32_t count, uint64_t &pos, uint64_t length) const;
bool ReadDataRecordPrepare(std::ifstream &in, RecordItem &record, uint64_t &pos, uint64_t length) const;
bool ReadDataRecordStart(std::ifstream &in, RecordItem &record,
static bool ReadFileHeader(std::basic_istream<char> &in, IndexHeader &indexHeader, uint64_t &pos, uint64_t length);
static bool ReadLimitKeys(std::basic_istream<char> &in, std::map<int64_t, std::vector<KeyParam>> &limitKeys,
uint32_t count, uint64_t &pos, uint64_t length);
static bool ReadIdTables(std::basic_istream<char> &in, std::map<int64_t, std::pair<int64_t, int64_t>> &datas,
uint32_t count, uint64_t &pos, uint64_t length);
static bool ReadDataRecordPrepare(std::basic_istream<char> &in, RecordItem &record, uint64_t &pos, uint64_t length);
static bool ReadDataRecordStart(std::basic_istream<char> &in, RecordItem &record,
const std::map<int64_t, std::vector<KeyParam>> &limitKeys,
const std::map<int64_t, std::pair<int64_t, int64_t>> &datas,
std::map<int64_t, std::vector<ResourceItem>> &resInfos) const;
std::map<int64_t, std::vector<ResourceItem>> &resInfos);
std::string indexFilePath_;
std::string idDefinedPath_;
};
+13 -1
View File
@@ -247,6 +247,19 @@ public:
*/
static void PrintWarningMsg(std::vector<std::pair<ResType, std::string>> &noBaseResource);
/**
* @brief covert KeyParam to str by keytype
* @param keyParam: KeyParam
* @return limit value string
*/
static std::string GetKeyParamValue(const KeyParam &KeyParam);
/**
* @brief keyType to string
* @param type: KeyType
* @return limit type string
*/
static std::string KeyTypeToStr(KeyType type);
private:
enum class IgnoreType {
IGNORE_FILE,
@@ -257,7 +270,6 @@ private:
static std::string GetLocaleLimitkey(const KeyParam &KeyParam);
static std::string GetDeviceTypeLimitkey(const KeyParam &KeyParam);
static std::string GetResolutionLimitkey(const KeyParam &KeyParam);
static std::string GetKeyParamValue(const KeyParam &KeyParam);
};
}
}