mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-19 11:31:44 -04:00
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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_LIST_H
|
||||
#define OHOS_RESTOOL_CMD_LIST_H
|
||||
|
||||
#include<functional>
|
||||
#include<string>
|
||||
#include "resource_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class CmdList {
|
||||
public:
|
||||
CmdList() {};
|
||||
virtual ~CmdList() {};
|
||||
using HandleBack = std::function<uint32_t(int c, const std::string &argValue)>;
|
||||
uint32_t Init(const std::string &filePath, HandleBack callback);
|
||||
private:
|
||||
uint32_t GetString(const Json::Value &node, int c, HandleBack callback);
|
||||
uint32_t GetArray(const Json::Value &node, int c, HandleBack callback);
|
||||
uint32_t GetModuleNames(const Json::Value &node, HandleBack callback);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* 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_object.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() {};
|
||||
~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;
|
||||
int32_t GetStartId() const;
|
||||
const std::string &GetCachePath() const;
|
||||
bool IsFileList() const;
|
||||
bool GetPreviewMode() const;
|
||||
int32_t GetPriority() const;
|
||||
|
||||
private:
|
||||
void InitCommand();
|
||||
uint32_t ParseCommand(int argc, char *argv[]);
|
||||
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);
|
||||
uint32_t AddCachePath(const std::string& argValue);
|
||||
uint32_t CheckParam() const;
|
||||
uint32_t HandleProcess(int c, const std::string& argValue);
|
||||
uint32_t ParseFileList(const std::string& fileListPath);
|
||||
uint32_t SetPreviewMode();
|
||||
uint32_t SetPriority(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_;
|
||||
int32_t startId_ = 0;
|
||||
std::string cachePath_;
|
||||
bool isFileList_ = false;
|
||||
bool previewMode_ = false;
|
||||
int32_t priority_ = -1;
|
||||
};
|
||||
|
||||
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 << "Useage:\n";
|
||||
std::cout << TOOL_NAME << " [arguments] Package the OHOS resources.\n";
|
||||
std::cout << "[arguments]:\n";
|
||||
std::cout << " -i input resource path, can add more.\n";
|
||||
std::cout << " -p package name.\n";
|
||||
std::cout << " -o output path.\n";
|
||||
std::cout << " -r resource header file path(like ./ResourceTable.js, ./ResrouceTable.h).\n";
|
||||
std::cout << " -f if output path exists,force delete it.\n";
|
||||
std::cout << " -v print tool version.\n";
|
||||
std::cout << " -m module name, can add more, split by ','(like entry1,entry2,...).\n";
|
||||
std::cout << " -j config.json path.\n";
|
||||
std::cout << " -e start id mask, e.g 0x01000000, in [0x01000000, 0x06FFFFFF),[0x08000000, 0x41FFFFFF)\n";
|
||||
std::cout << " -c increment compile cache directory 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
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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_CONFIG_PARSER_H
|
||||
#define OHOS_RESTOOL_CONFIG_PARSER_H
|
||||
|
||||
#include<functional>
|
||||
#include "resource_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ConfigParser {
|
||||
public:
|
||||
enum class ModuleType {
|
||||
NONE = 0,
|
||||
HAR = 1,
|
||||
ENTRY = 2,
|
||||
FEATURE = 3,
|
||||
};
|
||||
|
||||
ConfigParser();
|
||||
explicit ConfigParser(const std::string &filePath);
|
||||
virtual ~ConfigParser();
|
||||
uint32_t Init();
|
||||
const std::string &GetPackageName() const;
|
||||
const std::string &GetModuleName() const;
|
||||
ModuleType GetModuleType() const;
|
||||
uint32_t ParseRefence();
|
||||
uint32_t Save(const std::string &filePath) const;
|
||||
static void SetUseModule() { useModule_ = true; };
|
||||
static std::string GetConfigName() { return useModule_ ? MODULE_JSON : CONFIG_JSON; };
|
||||
private:
|
||||
bool ParseModule(Json::Value &moduleNode);
|
||||
bool ParseDistro(Json::Value &distroNode);
|
||||
bool ParseRefImpl(Json::Value &parent, const std::string &key, Json::Value &node);
|
||||
bool ParseJsonArrayRef(Json::Value &parent, const std::string &key, Json::Value &node);
|
||||
bool ParseJsonStringRef(Json::Value &parent, const std::string &key, Json::Value &node);
|
||||
bool GetRefIdFromString(std::string &value, bool &update, const std::string &match) const;
|
||||
bool ParseModuleType(const std::string &type);
|
||||
std::string filePath_;
|
||||
std::string packageName_;
|
||||
std::string moduleName_;
|
||||
ModuleType moduleType_;
|
||||
Json::Value rootNode_;
|
||||
static const std::map<std::string, ModuleType> MODULE_TYPES;
|
||||
static const std::map<std::string, std::string> JSON_STRING_IDS;
|
||||
static const std::map<std::string, std::string> JSON_ARRAY_IDS;
|
||||
static bool useModule_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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_FACTORY_RESOURCE_COMPILER_H
|
||||
#define OHOS_RESTOOL_FACTORY_RESOURCE_COMPILER_H
|
||||
|
||||
#include<memory>
|
||||
#include "i_resource_compiler.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class FactoryResourceCompiler {
|
||||
public:
|
||||
static std::unique_ptr<IResourceCompiler> CreateCompiler(ResType type, const std::string &output);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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_FILE_MANAGER_H
|
||||
#define OHOS_RESTOOL_FILE_MANAGER_H
|
||||
|
||||
#include<vector>
|
||||
#include "resource_data.h"
|
||||
#include "resource_item.h"
|
||||
#include "increment_manager.h"
|
||||
#include "singleton_object.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class FileManager : public Singleton<FileManager> {
|
||||
public:
|
||||
uint32_t ScanModules(const std::vector<std::string> &inputs, const std::string &output);
|
||||
const std::map<int32_t, std::vector<ResourceItem>> &GetResources() const { return alls_; };
|
||||
void SetModuleName(const std::string &moduleName) { moduleName_ = moduleName; };
|
||||
uint32_t ScanIncrement(const std::string &output);
|
||||
|
||||
private:
|
||||
uint32_t ScanModule(const std::string &input, const std::string &output,
|
||||
std::map<ResType, std::vector<DirectoryInfo>> &resTypeOfDirs);
|
||||
uint32_t MergeResourceItem(const std::map<int32_t, std::vector<ResourceItem>> &resourceInfos);
|
||||
uint32_t ParseReference(const std::string &output, const std::vector<std::string> &sxmlFolders);
|
||||
bool NeedParseReferenceInSolidXml(ResType resType) const;
|
||||
void FilterRefSolidXml(const std::string &output, std::vector<std::string> &outputPaths,
|
||||
const std::map<ResType, std::vector<DirectoryInfo>> &resTypeOfDirs) const;
|
||||
|
||||
// id, resource items
|
||||
std::map<int32_t, std::vector<ResourceItem>> alls_;
|
||||
std::string moduleName_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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_GENERIC_COMPILER_H
|
||||
#define OHOS_RESTOOL_GENERIC_COMPILER_H
|
||||
|
||||
#include "i_resource_compiler.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class GenericCompiler : public IResourceCompiler {
|
||||
public:
|
||||
GenericCompiler(ResType type, const std::string &output);
|
||||
virtual ~GenericCompiler();
|
||||
protected:
|
||||
uint32_t CompileSingleFile(const FileInfo &fileInfo) override;
|
||||
bool PostFile(const FileInfo &fileInfo);
|
||||
private:
|
||||
std::string GetOutputFilePath(const FileInfo &fileInfo) const;
|
||||
bool IsIgnore(const FileInfo &fileInfo) const;
|
||||
bool CopyFile(const FileInfo &fileInfo) const;
|
||||
bool IsConvertToSolidXml(const FileInfo &fileInfo) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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_HEADER_H
|
||||
#define OHOS_RESTOOL_HEADER_H
|
||||
|
||||
#include<functional>
|
||||
#include<sstream>
|
||||
#include<string>
|
||||
#include "id_worker.h"
|
||||
#include "restool_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class Header {
|
||||
public:
|
||||
static const std::string LICENSE_HEADER;
|
||||
Header(const std::string &outputPath);
|
||||
virtual ~Header();
|
||||
using HandleHeaderTail = std::function<void(std::stringstream&)>;
|
||||
using HandleBody = std::function<void(std::stringstream&, const IdWorker::ResourceId&)>;
|
||||
uint32_t Create(HandleHeaderTail headerHandler, HandleBody bodyHander, HandleHeaderTail tailHander) const;
|
||||
private:
|
||||
const std::string &outputPath_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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_RESOURCE_COMPILER_H
|
||||
#define OHOS_RESTOOL_RESOURCE_COMPILER_H
|
||||
|
||||
#include<vector>
|
||||
#include "increment_manager.h"
|
||||
#include "resource_data.h"
|
||||
#include "resource_item.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class IResourceCompiler {
|
||||
public:
|
||||
IResourceCompiler(ResType type, const std::string &output);
|
||||
virtual ~IResourceCompiler();
|
||||
uint32_t Compile(const std::vector<DirectoryInfo> &directoryInfos);
|
||||
const std::map<int32_t, std::vector<ResourceItem>> &GetResult() const;
|
||||
uint32_t Compile(const FileInfo &fileInfo);
|
||||
void SetModuleName(const std::string &moduleName);
|
||||
void SetPreviewMode(bool enable) { previewMode_ = enable; };
|
||||
|
||||
protected:
|
||||
virtual uint32_t CompileSingleFile(const FileInfo &fileInfo);
|
||||
bool MergeResourceItem(const ResourceItem &resourceItem);
|
||||
bool IsXmlFile(const FileInfo &fileInfo) const;
|
||||
bool HasConvertedToSolidXml(const FileInfo &fileInfo) const;
|
||||
bool NeedIfConvertToSolidXml() const;
|
||||
std::string GetOutputFolder(const DirectoryInfo &directoryInfo) const;
|
||||
ResType type_;
|
||||
std::string output_;
|
||||
std::string moduleName_;
|
||||
bool previewMode_ = false;
|
||||
|
||||
// id, resource items
|
||||
std::map<int32_t, std::vector<ResourceItem>> resourceInfos_;
|
||||
// ResType, name, resourceItems
|
||||
std::map<std::pair<ResType, std::string>, std::vector<ResourceItem>> nameInfos_;
|
||||
|
||||
private:
|
||||
uint32_t ConvertToSolidXml(const std::map<std::string, std::vector<FileInfo>> &setsByDirectory);
|
||||
uint32_t PostCommit();
|
||||
void ListXmlFile(const std::vector<FileInfo> &fileInfo, std::vector<std::string> &xmlPaths) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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_ID_WORKER_H
|
||||
#define OHOS_RESTOOL_ID_WORKER_H
|
||||
|
||||
#include<functional>
|
||||
#include<vector>
|
||||
#include "singleton_object.h"
|
||||
#include "resource_data.h"
|
||||
#include "resource_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class IdWorker : public Singleton<IdWorker> {
|
||||
public:
|
||||
enum class ResourceIdCluster {
|
||||
RES_ID_APP = 0,
|
||||
RES_ID_SYS,
|
||||
RES_ID_TYPE_MAX,
|
||||
};
|
||||
|
||||
struct ResourceId {
|
||||
int32_t id;
|
||||
int32_t seq;
|
||||
std::string type;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
uint32_t Init(ResourceIdCluster type, int32_t start = 0x01000000);
|
||||
int32_t GenerateId(ResType resType, const std::string &name);
|
||||
std::vector<ResourceId> GetHeaderId() const;
|
||||
int32_t GetId(ResType resType, const std::string &name) const;
|
||||
int32_t GetSystemId(ResType resType, const std::string &name) const;
|
||||
bool IsValidName(const std::string &name) const;
|
||||
bool PushCache(ResType resType, const std::string &name, int32_t id);
|
||||
void PushDelId(int32_t id);
|
||||
|
||||
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);
|
||||
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 IsValidSystemName(const std::string &name) const;
|
||||
int32_t GetStartId(const Json::Value &root) const;
|
||||
int32_t GetMaxId(int32_t startId) const;
|
||||
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::string, ParseFunction> handles_;
|
||||
std::vector<int32_t> delIds_;
|
||||
std::map<std::pair<ResType, std::string>, int32_t> cacheIds_;
|
||||
static const int32_t START_SYS_ID;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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_INCREMENT_INDEX_H
|
||||
#define OHOS_RESTOOL_INCREMENT_INDEX_H
|
||||
|
||||
#include "resource_item.h"
|
||||
#include "resource_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class IncrementIndex {
|
||||
public:
|
||||
IncrementIndex(const std::string &indexPath, const std::vector<std::string> &folder);
|
||||
virtual ~IncrementIndex() {};
|
||||
bool Save(const std::map<int32_t, std::vector<ResourceItem>> &items) const;
|
||||
bool Load(std::map<int32_t, std::vector<ResourceItem>> &items) const;
|
||||
void SetSkipPaths(const std::vector<std::string> &skipPaths);
|
||||
|
||||
static const std::string INDEX_FILE;
|
||||
private:
|
||||
bool LoadIndex(const Json::Value &indexInfo, std::map<int32_t, std::vector<ResourceItem>> &items) const;
|
||||
bool ParseResourceItem(const Json::Value &item, const std::string &filePath, ResourceItem &resourceItem) const;
|
||||
bool GetResourceItemProp(const Json::Value &item, const std::string &key, std::string &value) const;
|
||||
bool PushResourceItem(const ResourceItem &resourceItem, int32_t id,
|
||||
std::map<int32_t, std::vector<ResourceItem>> &items) const;
|
||||
bool IsIgnore(const std::string &filePath) const;
|
||||
const std::string &indexPath_;
|
||||
const std::vector<std::string> &folder_;
|
||||
std::vector<std::string> skipPaths_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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_INCREMENT_LIST_H
|
||||
#define OHOS_RESTOOL_INCREMENT_LIST_H
|
||||
|
||||
#include<functional>
|
||||
#include<vector>
|
||||
#include "resource_data.h"
|
||||
#include "resource_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class IncrementList {
|
||||
public:
|
||||
struct FileIncrement : FileInfo {
|
||||
bool isDeleted;
|
||||
std::string rootPath;
|
||||
std::string relativePath;
|
||||
};
|
||||
IncrementList(const std::string &listPath, const std::vector<std::string> &folder);
|
||||
virtual ~IncrementList() {};
|
||||
bool Parse(std::vector<FileIncrement> &fileList) const;
|
||||
|
||||
static const std::string RESTOOL_LIST_FILE;
|
||||
private:
|
||||
bool GetFromPath(const std::string &filePath, FileIncrement &info) const;
|
||||
int32_t GetPriority(const std::string &filePath) const;
|
||||
bool ParseSegment(const std::string &filePath, std::vector<std::string> &segments) const;
|
||||
bool IteratorArray(const Json::Value &array, std::function<bool(const std::string &)> callback) const;
|
||||
bool ParseArray(const Json::Value &array, std::vector<FileIncrement> &fileList, bool isDeleted) const;
|
||||
const std::string &listPath_;
|
||||
const std::vector<std::string> &folder_;
|
||||
enum PathSegment {
|
||||
SEG_RESOURCE = 0,
|
||||
SEG_LIMIT_KEY = 1,
|
||||
SEG_FILE_CLUSTER = 2,
|
||||
SEG_FILE_NAME =3,
|
||||
SEG_MAX
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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_INCREMENT_MANAGER_H
|
||||
#define OHOS_RESTOOL_INCREMENT_MANAGER_H
|
||||
|
||||
#include<string>
|
||||
#include "resource_util.h"
|
||||
#include "resource_item.h"
|
||||
#include "singleton_object.h"
|
||||
|
||||
#include "increment_list.h"
|
||||
#include "increment_index.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class IncrementManager : public Singleton<IncrementManager> {
|
||||
public:
|
||||
struct FileIncrement : FileInfo {
|
||||
std::string extension;
|
||||
std::string relativePath;
|
||||
std::string inputPath;
|
||||
int32_t priority;
|
||||
};
|
||||
|
||||
struct ModuleInfo {
|
||||
std::string rootPath;
|
||||
std::vector<IncrementList::FileIncrement> fileIncrements;
|
||||
};
|
||||
|
||||
virtual ~IncrementManager();
|
||||
uint32_t Init(const std::string &cachePath, const std::vector<std::string> &folder,
|
||||
const std::string &outputPath, const std::string &moduleName);
|
||||
const std::map<int32_t, std::vector<ResourceItem>> &GetResourceItems() const { return items_; };
|
||||
const std::map<ResType, std::vector<DirectoryInfo>> &GetScanDirs() const { return scanDirs_; };
|
||||
bool FirstIncrement() const { return firstIncrement_; };
|
||||
bool Enable() const { return enalbe_; };
|
||||
|
||||
static const std::string ID_JSON_FILE;
|
||||
private:
|
||||
bool InitIdJson();
|
||||
bool InitList(std::vector<IncrementList::FileIncrement> &dels) const;
|
||||
bool ScanModules(const std::vector<IncrementList::FileIncrement> &dels);
|
||||
void FlushId();
|
||||
bool SaveIdJson() const;
|
||||
bool LoadIdJson();
|
||||
void PushScanDir(const std::map<ResType, std::vector<DirectoryInfo>> &scanDirs);
|
||||
void DeleteRawFile(std::vector<IncrementList::FileIncrement> &dels) const;
|
||||
bool ClearSolidXml() const;
|
||||
std::string cachePath_;
|
||||
std::vector<std::string> folder_;
|
||||
std::string outputPath_;
|
||||
std::string moduleName_;
|
||||
std::map<int32_t, std::vector<ResourceItem>> items_;
|
||||
std::map<ResType, std::vector<DirectoryInfo>> scanDirs_;
|
||||
bool enalbe_ = false;
|
||||
bool firstIncrement_ = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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_JSON_COMPILER_H
|
||||
#define OHOS_RESTOOL_JSON_COMPILER_H
|
||||
|
||||
#include <functional>
|
||||
#include "i_resource_compiler.h"
|
||||
#include "resource_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class JsonCompiler : public IResourceCompiler {
|
||||
public:
|
||||
JsonCompiler(ResType type, const std::string &output);
|
||||
virtual ~JsonCompiler();
|
||||
protected:
|
||||
uint32_t CompileSingleFile(const FileInfo &fileInfo) override;
|
||||
private:
|
||||
void InitParser();
|
||||
bool ParseJsonArrayLevel(const Json::Value &arrayNode, const FileInfo &fileInfo);
|
||||
bool ParseJsonObjectLevel(const Json::Value &objectNode, const FileInfo &fileInfo);
|
||||
|
||||
using HandleResource = std::function<bool(const Json::Value&, ResourceItem&)>;
|
||||
bool HandleString(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
bool HandleInteger(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
bool HandleBoolean(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
bool HandleColor(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
bool HandleFloat(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
bool HandleStringArray(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
bool HandleIntegerArray(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
bool HandleTheme(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
bool HandlePattern(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
bool HandlePlural(const Json::Value &objectNode, ResourceItem &resourceItem) const;
|
||||
|
||||
bool PushString(const std::string &value, ResourceItem &resourceItem) const;
|
||||
bool CheckJsonStringValue(const Json::Value &valueNode, const ResourceItem &resourceItem) const;
|
||||
bool CheckJsonIntegerValue(const Json::Value &valueNode, const ResourceItem &resourceItem) const;
|
||||
using HandleValue = std::function<bool(const Json::Value&, const ResourceItem&, std::vector<std::string>&)>;
|
||||
bool ParseValueArray(const Json::Value &objectNode, ResourceItem &resourceItem,
|
||||
const std::vector<std::string> &extra, HandleValue callback) const;
|
||||
bool ParseParent(const Json::Value &objectNode, const ResourceItem &resourceItem,
|
||||
std::vector<std::string> &extra) const;
|
||||
bool ParseAttribute(const Json::Value &arrayItem, const ResourceItem &resourceItem,
|
||||
std::vector<std::string> &values) const;
|
||||
bool CheckPluralValue(const Json::Value &arrayItem, const ResourceItem &resourceItem) const;
|
||||
std::map<ResType, HandleResource> handles_;
|
||||
static const std::string TAG_NAME;
|
||||
static const std::string TAG_VALUE;
|
||||
static const std::string TAG_PARENT;
|
||||
static const std::string TAG_QUANTITY;
|
||||
static const std::vector<std::string> QUANTITY_ATTRS;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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_KEY_MANAGER_H
|
||||
#define OHOS_RESTOOL_KEY_MANAGER_H
|
||||
|
||||
#include<memory>
|
||||
#include "xml_key_node.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class KeyManager {
|
||||
public:
|
||||
KeyManager();
|
||||
virtual ~KeyManager() {};
|
||||
bool LoadKey(const std::string &keysPath);
|
||||
bool SaveKey(const std::string &keysPath);
|
||||
std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &GetKeys() { return keys_; };
|
||||
private:
|
||||
std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> keys_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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_KEY_PARSER_H
|
||||
#define OHOS_RESTOOL_KEY_PARSER_H
|
||||
|
||||
#include<vector>
|
||||
#include "resource_data.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class KeyParser {
|
||||
public:
|
||||
static bool Parse(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
|
||||
private:
|
||||
typedef bool (*parse_key_founction)(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseMatch(const std::vector<std::string> &keys, std::vector<KeyParam> &keyparams, const std::vector<parse_key_founction> &founctions);
|
||||
static bool ParseMatchBySeq(const std::vector<std::string> &keys, std::vector<KeyParam> &keyparams, const std::vector<parse_key_founction> &founctions);
|
||||
|
||||
static bool ParseMccMnc(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseMcc(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseMnc(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseLSR(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseLanguage(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseScript(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseRegion(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseOrientation(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseDeviceType(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseNightMode(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
static bool ParseResolution(const std::string &folderName, std::vector<KeyParam> &keyparams);
|
||||
|
||||
static void PushMccMnc(const std::string &folderName, KeyType type, std::vector<KeyParam> &keyparams);
|
||||
static void PushLSR(const std::string &folderName, KeyType type, std::vector<KeyParam> &keyparams);
|
||||
static void PushValue(uint32_t value, KeyType type, std::vector<KeyParam> &keyparams);
|
||||
static const int32_t MCC_MNC_KEY_LENGHT = 3;
|
||||
static const int32_t SCRIPT_LENGHT = 4;
|
||||
static const int32_t MIN_REGION_LENGHT = 2;
|
||||
static const int32_t MAX_REGION_LENGHT = 3;
|
||||
static std::map<std::string, std::vector<KeyParam>> caches_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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_FILE_COMBINE_H
|
||||
#define OHOS_RESTOOL_FILE_COMBINE_H
|
||||
|
||||
#include "resource_directory.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ModuleCombine {
|
||||
public:
|
||||
ModuleCombine(const std::string &modulePath, const std::string &outputPath);
|
||||
virtual ~ModuleCombine() {};
|
||||
bool Combine();
|
||||
|
||||
private:
|
||||
bool CombineDirectory(const DirectoryInfo &directoryInfo);
|
||||
bool CombineSolidXml(const std::string &src, const std::string &dst,
|
||||
const std::map<std::string , std::string> &sxmlPaths);
|
||||
const std::string &modulePath_;
|
||||
const std::string &outputPath_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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_NOCOPYABLE_OBJECT_H
|
||||
#define OHOS_RESTOOL_NOCOPYABLE_OBJECT_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
#define DISALLOW_COPY_AND_MOVE(className) \
|
||||
DISALLOW_COPY(className); \
|
||||
DISALLOW_MOVE(className)
|
||||
|
||||
#define DISALLOW_COPY(className) \
|
||||
className(const className&) = delete; \
|
||||
className& operator=(const className&&) = delete
|
||||
|
||||
#define DISALLOW_MOVE(className) \
|
||||
className(className&&) = delete; \
|
||||
className& operator=(className&&) = delete
|
||||
|
||||
class NoCopyable {
|
||||
protected:
|
||||
NoCopyable() {};
|
||||
virtual ~NoCopyable() {};
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_MOVE(NoCopyable);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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_PREVIEW_MANAGER_H
|
||||
#define OHOS_RESTOOL_PREVIEW_MANAGER_H
|
||||
|
||||
#include<vector>
|
||||
#include<string>
|
||||
#include "restool_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class PreviewManager {
|
||||
public:
|
||||
PreviewManager() {};
|
||||
virtual ~PreviewManager();
|
||||
uint32_t ScanModules(const std::vector<std::string> &modulePaths, const std::string &output);
|
||||
void SetPriority(int32_t priority) { priority_ = priority; };
|
||||
private:
|
||||
bool ScanFile(const std::string &filePath, int32_t priority);
|
||||
int32_t priority_ = -1;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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_REFERENCE_PARSER_H
|
||||
#define OHOS_RESTOOL_REFERENCE_PARSER_H
|
||||
|
||||
#include "id_worker.h"
|
||||
#include "resource_item.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ReferenceParser {
|
||||
public:
|
||||
ReferenceParser();
|
||||
virtual ~ReferenceParser();
|
||||
uint32_t ParseRefInSolidXml(const std::vector<std::string> &solidXmlFolders) const;
|
||||
uint32_t ParseRefInElement(std::map<int32_t, std::vector<ResourceItem>> &alls) const;
|
||||
uint32_t ParseRefInString(std::string &value, bool &update) const;
|
||||
uint32_t ParseRefInProfile(const std::string &output) const;
|
||||
uint32_t ParseRefInJson(const std::string &filePath) const;
|
||||
private:
|
||||
bool ParseRefResourceItem(ResourceItem &resourceItem) const;
|
||||
bool ParseRefResourceItemData(const ResourceItem &resourceItem, std::string &data, bool &update) const;
|
||||
bool IsStringOfResourceItem(ResType resType) const;
|
||||
bool IsArrayOfResourceItem(ResType resType) const;
|
||||
bool IsNotElement(ResType resType) const;
|
||||
bool ParseRefString(std::string &key) const;
|
||||
bool ParseRefString(std::string &key, bool &update) const;
|
||||
bool ParseRefImpl(std::string &key, const std::map<std::string, ResType> &refs, bool isSystem) const;
|
||||
bool ParseRefJsonImpl(Json::Value &root) const;
|
||||
const IdWorker &idWorker_;
|
||||
static const std::map<std::string, ResType> ID_REFS;
|
||||
static const std::map<std::string, ResType> ID_OHOS_REFS;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* 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_RESOURCE_DATA_H
|
||||
#define OHOS_RESTOOL_RESOURCE_DATA_H
|
||||
|
||||
#include<map>
|
||||
#include<stdint.h>
|
||||
#include<string>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
const static std::string TOOL_NAME = "restool";
|
||||
const static std::string RESOURCES_DIR = "resources";
|
||||
const static std::string CONFIG_JSON = "config.json";
|
||||
const static std::string MODULE_JSON = "module.json";
|
||||
const static std::string RAW_FILE_DIR = "rawfile";
|
||||
const static std::string ID_DEFINED_FILE = "id_defined.json";
|
||||
const static std::string RESOURCE_INDEX_FILE = "resources.index";
|
||||
const static std::string SEPARATOR = "/";
|
||||
const static int32_t VERSION_MAX_LEN = 128;
|
||||
static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 2.007" };
|
||||
const static int32_t TAG_LEN = 4;
|
||||
|
||||
enum class KeyType {
|
||||
LANGUAGE = 0,
|
||||
REGION = 1,
|
||||
RESOLUTION = 2,
|
||||
ORIENTATION = 3,
|
||||
DEVICETYPE = 4,
|
||||
SCRIPT = 5,
|
||||
NIGHTMODE = 6,
|
||||
MCC = 7,
|
||||
MNC = 8,
|
||||
KEY_TYPE_MAX,
|
||||
};
|
||||
|
||||
enum class ResType {
|
||||
ELEMENT = 0,
|
||||
ANIMATION = 1,
|
||||
LAYOUT = 3,
|
||||
RAW = 6,
|
||||
INTEGER = 8,
|
||||
STRING = 9,
|
||||
STRARRAY = 10,
|
||||
INTARRAY = 11,
|
||||
BOOLEAN = 12,
|
||||
COLOR = 14,
|
||||
ID = 15,
|
||||
THEME = 16,
|
||||
PLURAL = 17,
|
||||
FLOAT = 18,
|
||||
MEDIA = 19,
|
||||
PROF = 20,
|
||||
GRAPHIC = 21,
|
||||
PATTERN = 22,
|
||||
INVALID_RES_TYPE = -1,
|
||||
};
|
||||
|
||||
enum class OrientationType {
|
||||
VERTICAL = 0,
|
||||
HORIZONTAL = 1,
|
||||
};
|
||||
|
||||
const std::map<std::string, OrientationType> g_orientaionMap = {
|
||||
{ "vertical", OrientationType::VERTICAL },
|
||||
{ "horizontal", OrientationType::HORIZONTAL },
|
||||
};
|
||||
|
||||
enum class DeviceType {
|
||||
PHONE = 0,
|
||||
TABLET = 1,
|
||||
CAR = 2,
|
||||
// RESERVER 3
|
||||
TV = 4,
|
||||
WEARABLE = 6,
|
||||
};
|
||||
|
||||
const std::map<std::string, DeviceType> g_deviceMap = {
|
||||
{ "phone", DeviceType::PHONE },
|
||||
{ "tablet", DeviceType::TABLET },
|
||||
{ "car", DeviceType::CAR },
|
||||
{ "tv", DeviceType::TV },
|
||||
{ "wearable", DeviceType::WEARABLE },
|
||||
};
|
||||
|
||||
enum class ResolutionType {
|
||||
SDPI = 120,
|
||||
MDPI = 160,
|
||||
LDPI = 240,
|
||||
XLDPI = 320,
|
||||
XXLDPI = 480,
|
||||
XXXLDPI = 640,
|
||||
};
|
||||
|
||||
const std::map<std::string, ResolutionType> g_resolutionMap = {
|
||||
{ "sdpi", ResolutionType::SDPI },
|
||||
{ "mdpi", ResolutionType::MDPI },
|
||||
{ "ldpi", ResolutionType::LDPI },
|
||||
{ "xldpi", ResolutionType::XLDPI },
|
||||
{ "xxldpi", ResolutionType::XXLDPI },
|
||||
{ "xxxldpi", ResolutionType::XXXLDPI },
|
||||
};
|
||||
|
||||
enum class NightMode {
|
||||
DARK = 0,
|
||||
LIGHT = 1,
|
||||
};
|
||||
|
||||
const std::map<std::string, NightMode> g_nightModeMap = {
|
||||
{ "dark", NightMode::DARK },
|
||||
{ "light", NightMode::LIGHT },
|
||||
};
|
||||
|
||||
struct KeyParam {
|
||||
KeyType keyType;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
const std::map<std::string, ResType> g_fileClusterMap = {
|
||||
{ "element", ResType::ELEMENT },
|
||||
{ "media", ResType::MEDIA },
|
||||
{ "profile", ResType::PROF },
|
||||
{ "animation", ResType::ANIMATION },
|
||||
{ "graphic", ResType::GRAPHIC },
|
||||
{ "layout", ResType::LAYOUT }
|
||||
};
|
||||
|
||||
const std::map<std::string, ResType> g_contentClusterMap = {
|
||||
{ "id", ResType::ID },
|
||||
{ "integer", ResType::INTEGER },
|
||||
{ "string", ResType::STRING },
|
||||
{ "strarray", ResType::STRARRAY },
|
||||
{ "intarray", ResType::INTARRAY },
|
||||
{ "color", ResType::COLOR },
|
||||
{ "plural", ResType::PLURAL },
|
||||
{ "boolean", ResType::BOOLEAN },
|
||||
{ "pattern", ResType::PATTERN },
|
||||
{ "theme", ResType::THEME },
|
||||
{ "float", ResType::FLOAT }
|
||||
};
|
||||
|
||||
struct DirectoryInfo {
|
||||
std::string limitKey;
|
||||
std::string fileCluster;
|
||||
std::string dirPath;
|
||||
std::vector<KeyParam> keyParams;
|
||||
ResType dirType;
|
||||
};
|
||||
|
||||
struct FileInfo : DirectoryInfo {
|
||||
std::string filePath;
|
||||
std::string filename;
|
||||
ResType fileType;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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_RESOURCE_DIRECTORY
|
||||
#define OHOS_RESTOOL_RESOURCE_DIRECTORY
|
||||
|
||||
#include<functional>
|
||||
#include<string>
|
||||
#include<map>
|
||||
#include "key_parser.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ResourceDirectory {
|
||||
public:
|
||||
ResourceDirectory() {};
|
||||
virtual ~ResourceDirectory() {};
|
||||
bool ScanResources(const std::string &resourcesDir, std::function<bool(const DirectoryInfo&)> callback) const;
|
||||
private:
|
||||
bool ScanResourceLimitKeyDir(const std::string &resourceTypeDir, const std::string &limitKey,
|
||||
std::function<bool(const DirectoryInfo&)> callback) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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_RESOURCE_ITEM_H
|
||||
#define OHOS_RESTOOL_RESOURCE_ITEM_H
|
||||
|
||||
#include<vector>
|
||||
#include "resource_data.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ResourceItem {
|
||||
public:
|
||||
ResourceItem();
|
||||
ResourceItem(const ResourceItem &other);
|
||||
ResourceItem(const std::string &name, const std::vector<KeyParam> &keyparams, ResType type);
|
||||
virtual ~ResourceItem();
|
||||
|
||||
bool SetData(const std::string &data);
|
||||
bool SetData(const int8_t *data, uint32_t length);
|
||||
void SetFilePath(const std::string &filePath);
|
||||
void SetLimitKey(const std::string &limitKey);
|
||||
|
||||
const int8_t *GetData() const;
|
||||
const uint32_t GetDataLength() const;
|
||||
const std::string &GetName() const;
|
||||
const ResType &GetResType() const;
|
||||
const std::vector<KeyParam> &GetKeyParam() const;
|
||||
const std::string &GetFilePath() const;
|
||||
const std::string &GetLimitKey() const;
|
||||
|
||||
ResourceItem &operator=(const ResourceItem &other);
|
||||
private:
|
||||
void ReleaseData();
|
||||
void CopyFrom(const ResourceItem &other);
|
||||
int8_t *data_ = nullptr;
|
||||
uint32_t dataLen_;
|
||||
std::string name_;
|
||||
std::vector<KeyParam> keyparams_;
|
||||
ResType type_;
|
||||
std::string filePath_;
|
||||
std::string limitKey_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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_RESOURCE_MERGE_H
|
||||
#define OHOS_RESTOOL_RESOURCE_MERGE_H
|
||||
|
||||
#include<string>
|
||||
#include<vector>
|
||||
#include "config_parser.h"
|
||||
#include "restool_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ResourceMerge {
|
||||
public:
|
||||
ResourceMerge();
|
||||
virtual ~ResourceMerge();
|
||||
uint32_t Init();
|
||||
const std::vector<std::string> &GetInputs() const;
|
||||
private:
|
||||
std::vector<std::string> inputsOrder_;
|
||||
static const std::vector<ConfigParser::ModuleType> ORDERS;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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_RESOURCE_MODULE_H
|
||||
#define OHOS_RESTOOL_RESOURCE_MODULE_H
|
||||
|
||||
#include "resource_item.h"
|
||||
#include "resource_directory.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ResourceModule {
|
||||
public:
|
||||
ResourceModule(const std::string &modulePath, const std::string &moduleOutput, const std::string &moduleName);
|
||||
virtual ~ResourceModule() {};
|
||||
uint32_t ScanResource();
|
||||
const std::map<int32_t, std::vector<ResourceItem>> &GetOwner() const;
|
||||
const std::map<ResType, std::vector<DirectoryInfo>> &GetScanDirectorys() const;
|
||||
static uint32_t MergeResourceItem(std::map<int32_t, std::vector<ResourceItem>> &alls,
|
||||
const std::map<int32_t, std::vector<ResourceItem>> &other, bool tipError = false);
|
||||
void SetPreviewMode(bool enable) { previewMode_ = enable; };
|
||||
|
||||
protected:
|
||||
const std::string &modulePath_;
|
||||
const std::string &moduleOutput_;
|
||||
const std::string &moduleName_;
|
||||
std::map<int32_t, std::vector<ResourceItem>> owner_;
|
||||
std::map<ResType, std::vector<DirectoryInfo>> scanDirs_;
|
||||
bool previewMode_ = false;
|
||||
private:
|
||||
void Push(const std::map<int32_t, std::vector<ResourceItem>> &other);
|
||||
static const std::vector<ResType> SCAN_SEQ;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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_RESOURCE_MODULE_INC_H
|
||||
#define OHOS_RESTOOL_RESOURCE_MODULE_INC_H
|
||||
|
||||
#include "increment_list.h"
|
||||
#include "resource_module.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ResourceModuleInc : public ResourceModule {
|
||||
public:
|
||||
ResourceModuleInc(const std::string &modulePath, const std::string &moduleOutput, const std::string &moduleName, const std::vector<std::string> &folder);
|
||||
virtual ~ResourceModuleInc() {};
|
||||
uint32_t ScanResource(const std::vector<IncrementList::FileIncrement> &fileIncrements);
|
||||
uint32_t SaveIndex() const;
|
||||
private:
|
||||
const std::vector<std::string> &folder_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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_RESOURCE_PACK_H
|
||||
#define OHOS_RESTOOL_RESOURCE_PACK_H
|
||||
|
||||
#include "cmd_parser.h"
|
||||
#include "config_parser.h"
|
||||
#include "resource_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ResourcePack {
|
||||
public:
|
||||
explicit ResourcePack(const PackageParser &packageParser);
|
||||
virtual ~ResourcePack() = default;
|
||||
uint32_t Package();
|
||||
|
||||
private:
|
||||
uint32_t Init();
|
||||
uint32_t InitModule();
|
||||
void InitHeaderCreater();
|
||||
uint32_t InitOutput() const;
|
||||
uint32_t GenerateHeader() const;
|
||||
uint32_t InitConfigJson();
|
||||
uint32_t GenerateTextHeader(const std::string &headerPath) const;
|
||||
uint32_t GenerateCplusHeader(const std::string &headerPath) const;
|
||||
uint32_t GenerateJsHeader(const std::string &headerPath) const;
|
||||
uint32_t CopyRawFile(const std::vector<std::string> &inputs) const;
|
||||
uint32_t CopyRawFileImpl(const std::string &src, const std::string &dst) const;
|
||||
uint32_t GenerateConfigJson();
|
||||
uint32_t ScanResources(const std::vector<std::string> &inputs, const std::string &output);
|
||||
PackageParser packageParser_;
|
||||
std::string moduleName_;
|
||||
using HeaderCreater = std::function<uint32_t(const std::string&)>;
|
||||
std::map<std::string, HeaderCreater> headerCreaters_;
|
||||
ConfigParser configJson_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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_RESOURCE_TABLE_H
|
||||
#define OHOS_RESTOOL_RESOURCE_TABLE_H
|
||||
|
||||
#include <fstream>
|
||||
#include "resource_item.h"
|
||||
#include "restool_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class ResourceTable {
|
||||
public:
|
||||
ResourceTable();
|
||||
virtual ~ResourceTable();
|
||||
uint32_t CreateResourceTable();
|
||||
private:
|
||||
struct TableData {
|
||||
int32_t id;
|
||||
ResourceItem resourceItem;
|
||||
};
|
||||
|
||||
struct IndexHeader {
|
||||
int8_t version[VERSION_MAX_LEN];
|
||||
uint32_t fileSize;
|
||||
uint32_t limitKeyConfigSize;
|
||||
};
|
||||
|
||||
struct LimitKeyConfig {
|
||||
int8_t keyTag[TAG_LEN] = {'K', 'E', 'Y', 'S'};
|
||||
uint32_t offset; // IdSet file address offset
|
||||
uint32_t keyCount; // KeyParam count
|
||||
std::vector<int32_t> data;
|
||||
};
|
||||
|
||||
struct IdSet {
|
||||
int8_t idTag[TAG_LEN] = {'I', 'D', 'S', 'S'};
|
||||
uint32_t idCount;
|
||||
std::map<int32_t, uint32_t> data; // pair id and offset
|
||||
};
|
||||
|
||||
struct RecordItem {
|
||||
uint32_t size;
|
||||
int32_t resType;
|
||||
int32_t id;
|
||||
};
|
||||
uint32_t SaveToResouorceIndex(const std::map<std::string, std::vector<TableData>> &configs) 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,
|
||||
std::map<std::string, IdSet> &idSets, uint32_t &pos) const;
|
||||
bool SaveRecordItem(const std::map<std::string, std::vector<TableData>> &configs, std::ofstream &out,
|
||||
std::map<std::string, IdSet> &idSets, uint32_t &pos) const;
|
||||
void SaveHeader(const IndexHeader &indexHeader, std::ofstream &out) const;
|
||||
void SaveLimitKeyConfigs(const std::map<std::string, LimitKeyConfig> &limitKeyConfigs, std::ofstream &out) const;
|
||||
void SaveIdSets(const std::map<std::string, IdSet> &idSets, std::ofstream &out) const;
|
||||
std::string indexFilePath_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* 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_RESOURCE_UTIL_H
|
||||
#define OHOS_RESTOOL_RESOURCE_UTIL_H
|
||||
|
||||
#include<filesystem>
|
||||
#include<vector>
|
||||
#include "resource_data.h"
|
||||
#include "json/json.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
|
||||
class ResourceUtil {
|
||||
public:
|
||||
/**
|
||||
* @brief split the string with given splitter.
|
||||
* @param str: input string.
|
||||
* @param out: the array of strings computed by splitter.
|
||||
* @param splitter: the split string.
|
||||
*/
|
||||
static void Split(const std::string &str, std::vector<std::string> &out, const std::string &splitter);
|
||||
|
||||
/**
|
||||
* @brief check file exist.
|
||||
* @param path: file path.
|
||||
* @return true if exist, other false.
|
||||
*/
|
||||
static bool FileExist(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief remove all files in the directory.
|
||||
* @param path: input directory.
|
||||
* @return true if remove success, other false.
|
||||
*/
|
||||
static bool RmoveAllDir(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief open json file.
|
||||
* @param path: json file path.
|
||||
* @param root: json root node
|
||||
* @return true if open success, other false.
|
||||
*/
|
||||
static bool OpenJsonFile(const std::string &path, Json::Value &root);
|
||||
|
||||
/**
|
||||
* @brief save json file.
|
||||
* @param path: json file path.
|
||||
* @param root: json root node
|
||||
* @return true if save success, other false.
|
||||
*/
|
||||
static bool SaveToJsonFile(const std::string &path, const Json::Value &root);
|
||||
|
||||
/**
|
||||
* @brief get resource type from directory.
|
||||
* @param name: directory name.
|
||||
* @return resrouce type.
|
||||
*/
|
||||
static ResType GetResTypeByDir(const std::string &name);
|
||||
|
||||
/**
|
||||
* @brief ResType to string
|
||||
* @param type: ResType
|
||||
* @return resrouce type string.
|
||||
*/
|
||||
static std::string ResTypeToString(ResType type);
|
||||
|
||||
/**
|
||||
* @brief get id name
|
||||
* @param name; id name or file name
|
||||
* @param type: ResType
|
||||
* @return return id name.
|
||||
*/
|
||||
static std::string GetIdName(const std::string &name, ResType type);
|
||||
|
||||
/**
|
||||
* @brief compose multi strings to string
|
||||
* @param contents: multi strings
|
||||
* @param addNull: if true, string length contains '\0'.
|
||||
* @return return string, empty if error
|
||||
*/
|
||||
static std::string ComposeStrings(const std::vector<std::string> &contents, bool addNull = false);
|
||||
|
||||
/**
|
||||
* @brief decompose string to multi strings
|
||||
* @param content: string
|
||||
* @return return string vector, empty if error
|
||||
*/
|
||||
static std::vector<std::string> DecomposeStrings(const std::string &content);
|
||||
|
||||
/**
|
||||
* @brief string to ResType
|
||||
* @param type: string
|
||||
* @return return ResType
|
||||
*/
|
||||
static ResType GetResTypeFromString(const std::string &type);
|
||||
|
||||
/**
|
||||
* @brief copy file
|
||||
* @param src: source file path
|
||||
* @param dst: destination file path
|
||||
* @return true if success, other false
|
||||
*/
|
||||
static bool CopyFleInner(const std::string &src, const std::string &dst);
|
||||
|
||||
/**
|
||||
* @brief create directorys
|
||||
* @param filePath: directory path
|
||||
* @return true if success, other false
|
||||
*/
|
||||
static bool CreateDirs(const std::string &filePath);
|
||||
|
||||
/**
|
||||
* @brief ignore file or directory
|
||||
* @param filename: file or directory name
|
||||
* @return true if ignore, other false
|
||||
*/
|
||||
static bool IsIgnoreFile(const std::string &filename, std::filesystem::file_type type);
|
||||
|
||||
/**
|
||||
* @brief need convert to solid xml
|
||||
* @param resType: ResType
|
||||
* @return true if need, other false
|
||||
*/
|
||||
static bool NeedConverToSolidXml(ResType resType);
|
||||
|
||||
/**
|
||||
* @brief generate hash string
|
||||
* @param key: string
|
||||
* @return hash string
|
||||
*/
|
||||
static std::string GenerateHash(const std::string key);
|
||||
private:
|
||||
enum class IgnoreType {
|
||||
IGNORE_FILE,
|
||||
IGNORE_DIR,
|
||||
IGNORE_ALL
|
||||
};
|
||||
static const std::map<std::string, IgnoreType> IGNORE_FILE_REGEX;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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_ERRORS_H
|
||||
#define OHOS_RESTOOL_ERRORS_H
|
||||
|
||||
#include<stdint.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
constexpr uint32_t RESTOOL_SUCCESS = 0;
|
||||
constexpr uint32_t RESTOOL_ERROR = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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_SINGLETON_OBJECT_H
|
||||
#define OHOS_RESTOOL_SINGLETON_OBJECT_H
|
||||
|
||||
#include "nocopyable_object.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
template<typename T>
|
||||
class Singleton : public NoCopyable {
|
||||
public:
|
||||
static T &GetInstance()
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
|
||||
private:
|
||||
static T instance_;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
T Singleton<T>::instance_;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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_SOLID_XML_H
|
||||
#define OHOS_RESTOOL_SOLID_XML_H
|
||||
|
||||
#include<fstream>
|
||||
#include<memory>
|
||||
#include<string>
|
||||
#include<vector>
|
||||
#include "libxml/parser.h"
|
||||
#include "xml_key_node.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class SolidXml {
|
||||
public:
|
||||
explicit SolidXml(const std::string &xmlPath, std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &keys);
|
||||
virtual ~SolidXml();
|
||||
bool GenerateSolidXml(const std::string &filePath);
|
||||
bool FlushNodeKeys(const std::string &filePath,
|
||||
std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &newKeys);
|
||||
private:
|
||||
class Node {
|
||||
public:
|
||||
Node(): name_(-1), value_(-1), nameSpace_(-1) {};
|
||||
virtual ~Node() {};
|
||||
virtual void RawData(std::ofstream &out) const;
|
||||
virtual bool LoadFrom(std::ifstream &in);
|
||||
virtual bool FlushIndex(const std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &oldKeys,
|
||||
std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &newKeys);
|
||||
void SetName(int32_t index) { name_ = index; };
|
||||
void SetValue(int32_t index) { value_ = index; };
|
||||
void SetNameSpace(int32_t index) { nameSpace_ = index; };
|
||||
protected:
|
||||
int32_t name_;
|
||||
int32_t value_;
|
||||
int32_t nameSpace_;
|
||||
};
|
||||
|
||||
class XmlNode : public Node {
|
||||
public:
|
||||
XmlNode() : child_(-1), brother_(-1) {};
|
||||
virtual ~XmlNode() {};
|
||||
void RawData(std::ofstream &out) const override;
|
||||
bool LoadFrom(std::ifstream &in) override;
|
||||
bool FlushIndex(const std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &oldKeys,
|
||||
std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &newKeys) override;
|
||||
void SetChild(int32_t index) { child_ = index; };
|
||||
void SetBrother(int32_t index) { brother_ = index; };
|
||||
void AddAttribute(int32_t index) { attributes_.push_back(index); };
|
||||
private:
|
||||
int32_t child_;
|
||||
int32_t brother_;
|
||||
std::vector<int32_t> attributes_;
|
||||
};
|
||||
|
||||
void Compile(const xmlNodePtr nodePtr, std::shared_ptr<XmlNode> &node);
|
||||
void CompileAttr(const xmlAttrPtr attrPtr, std::shared_ptr<XmlNode> &node);
|
||||
void CompileNameSpace(const xmlNodePtr nodePtr, std::shared_ptr<XmlNode> &node);
|
||||
void AddNampeSpaceDef(int32_t nameSpace, int32_t href);
|
||||
bool SaveToFile(const std::string &filePath) const;
|
||||
void PretreatmentAttr(std::string &value) const;
|
||||
bool LoadFromFile(const std::string &sxmlPath);
|
||||
static bool ChangeToNewKey(const std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &oldKeys,
|
||||
std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &newKeys,
|
||||
XmlKeyNode::KeyType keyType, int32_t &keyId);
|
||||
bool FlushXmlnsKey(std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &newKeys);
|
||||
const std::string &xmlPath_;
|
||||
std::map<XmlKeyNode::KeyType, std::shared_ptr<XmlKeyNode>> &keys_;
|
||||
std::vector<std::shared_ptr<Node>> attributes_;
|
||||
std::vector<std::shared_ptr<XmlNode>> nodes_;
|
||||
std::vector<int32_t> nameSpaces_;
|
||||
std::vector<int32_t> hrefs_;
|
||||
|
||||
static const uint8_t SOLID_XML_MAGIC[];
|
||||
static const uint32_t SOLID_XML_MAGIC_LENGTH;
|
||||
#define CHECK_IO(stream) \
|
||||
if (!stream) { \
|
||||
return false; \
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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_SOLID_XML_COMPILER_H
|
||||
#define OHOS_RESTOOL_SOLID_XML_COMPILER_H
|
||||
|
||||
#include "generic_compiler.h"
|
||||
#include "libxml/parser.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class SolidXmlCompiler : public GenericCompiler {
|
||||
public:
|
||||
SolidXmlCompiler(ResType type, const std::string &output);
|
||||
virtual ~SolidXmlCompiler();
|
||||
protected:
|
||||
uint32_t CompileSingleFile(const FileInfo &fileInfo) override;
|
||||
private:
|
||||
bool ParseXml(const FileInfo &fileInfo);
|
||||
bool ParseNodeId(const FileInfo &fileInfo, const xmlNodePtr &node, std::vector<std::string> &ids);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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_SQLITE_DATABASE_H
|
||||
#define OHOS_RESTOOL_SQLITE_DATABASE_H
|
||||
|
||||
#include<string>
|
||||
#include "resource_item.h"
|
||||
#include "singleton_object.h"
|
||||
#include "sqlite3.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class SqliteDatabase : public Singleton<SqliteDatabase> {
|
||||
public:
|
||||
void Init(const std::string &dbPath);
|
||||
bool OpenDatabase();
|
||||
void CloseDatabase();
|
||||
bool Insert(const ResourceItem &resourceItem);
|
||||
void SetPriority(int32_t priority) { priority_ = priority; };
|
||||
private:
|
||||
bool Query(const ResourceItem &resourceItem, int32_t &id);
|
||||
bool FindMaxId();
|
||||
bool CreateTable();
|
||||
std::string GetValue(const ResourceItem &resourceItem) const;
|
||||
std::string dbPath_;
|
||||
sqlite3 * db_ = nullptr;
|
||||
static int32_t id_;
|
||||
int32_t priority_ = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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_TASK_HANDLE_H
|
||||
#define OHOS_RESTOOL_TASK_HANDLE_H
|
||||
|
||||
#include "cmd_parser.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
|
||||
class TaskHandle {
|
||||
public:
|
||||
TaskHandle() {};
|
||||
~TaskHandle() {};
|
||||
uint32_t HandlePackage(const PackageParser &packageParser);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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_XML_CONVERTER_H
|
||||
#define OHOS_RESTOOL_XML_CONVERTER_H
|
||||
|
||||
#include<memory>
|
||||
#include<vector>
|
||||
#include<string>
|
||||
#include "key_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class XmlConverter {
|
||||
public:
|
||||
XmlConverter(const std::vector<std::string> &xmlPaths, const std::string &outputPath);
|
||||
virtual ~XmlConverter();
|
||||
bool GenerateSolidXml();
|
||||
bool GenerateKey();
|
||||
private:
|
||||
bool LoadKeys(const std::string &folderPath);
|
||||
const std::vector<std::string> &xmlPaths_;
|
||||
const std::string &outputPath_;
|
||||
KeyManager keyManager;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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_XML_KEY_NODE_H
|
||||
#define OHOS_RESTOOL_XML_KEY_NODE_H
|
||||
|
||||
#include<functional>
|
||||
#include<map>
|
||||
#include<stdint.h>
|
||||
#include<string>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace Restool {
|
||||
class XmlKeyNode {
|
||||
public:
|
||||
XmlKeyNode();
|
||||
virtual ~XmlKeyNode();
|
||||
int32_t PushKey(const std::string &name);
|
||||
bool SaveToFile(const std::string &filePath) const;
|
||||
bool LoadFromFile(const std::string &filePath);
|
||||
using RefParser = std::function<bool(std::string&)>;
|
||||
bool LoadFromFile(const std::string &filePath, RefParser parser);
|
||||
bool GetKeyValue(int32_t keyId, std::string &value) const;
|
||||
|
||||
enum class KeyType {
|
||||
NODE = 0,
|
||||
ATTRIBUTE,
|
||||
CONSTANT,
|
||||
CONTENT,
|
||||
END
|
||||
};
|
||||
static const std::map<KeyType, std::string> KEY_TO_FILE_NAME;
|
||||
private:
|
||||
int32_t keyId_;
|
||||
std::map<std::string, int32_t> keyMap_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user