-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…_unknown_fields
- Loading branch information
Showing
15 changed files
with
606 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,110 @@ | ||
// Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. | ||
// versions: | ||
// - protoc-gen-cpp-tableau-loader v0.4.5 | ||
// - protoc v3.19.3 | ||
// source: item_conf.proto | ||
|
||
#include "item_conf.pc.h" | ||
|
||
namespace tableau { | ||
const std::string ItemConf::kProtoName = "Item"; | ||
bool ItemConf::Load(const std::string& dir, Format fmt) { | ||
bool ok = LoadMessage(dir, data_, fmt); | ||
const std::string ItemConf::kProtoName = "ItemConf"; | ||
|
||
bool ItemConf::Load(const std::string& dir, Format fmt, const LoadOptions* options /* = nullptr */) { | ||
bool ok = LoadMessage(dir, data_, fmt, options); | ||
return ok ? ProcessAfterLoad() : false; | ||
} | ||
|
||
bool ItemConf::ProcessAfterLoad() { | ||
// OrderedMap init. | ||
for (auto&& item1 : data_.item_map()) { | ||
ordered_map_[item1.first] = &item1.second; | ||
} | ||
|
||
// Index init. | ||
for (auto&& item1 : data_.item_map()) { | ||
index_item_map_[static_cast<int>(item1.second.type())].push_back(&item1.second); | ||
} | ||
|
||
for (auto&& item1 : data_.item_map()) { | ||
for (auto&& item2 : item1.second.param_list()) { | ||
index_item_info_map_[item2].push_back(&item1.second); | ||
} | ||
} | ||
|
||
for (auto&& item1 : data_.item_map()) { | ||
for (auto&& item2 : item1.second.ext_type_list()) { | ||
index_item_ext_info_map_[static_cast<int>(item2)].push_back(&item1.second); | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
const protoconf::ItemConf::Item* ItemConf::Get(uint32_t key1) const { | ||
auto iter = data_.item_map().find(key1); | ||
if (iter == data_.item_map().end()) { | ||
return nullptr; | ||
} | ||
return &iter->second; | ||
} | ||
|
||
const ItemConf::Item_OrderedMap* ItemConf::GetOrderedMap() const { | ||
return &ordered_map_; | ||
} | ||
|
||
const ItemConf::Index_ItemInfoMap& ItemConf::FindItemInfo() const { return index_item_info_map_ ;} | ||
|
||
const ItemConf::Index_ItemInfoVector* ItemConf::FindItemInfo(int32_t param_list) const { | ||
auto iter = index_item_info_map_.find(param_list); | ||
if (iter == index_item_info_map_.end()) { | ||
return nullptr; | ||
} | ||
return &iter->second; | ||
} | ||
|
||
const protoconf::ItemConf::Item* ItemConf::FindFirstItemInfo(int32_t param_list) const { | ||
auto conf = FindItemInfo(param_list); | ||
if (conf == nullptr || conf->size() == 0) { | ||
return nullptr; | ||
} | ||
return (*conf)[0]; | ||
} | ||
|
||
const ItemConf::Index_ItemExtInfoMap& ItemConf::FindItemExtInfo() const { return index_item_ext_info_map_ ;} | ||
|
||
const ItemConf::Index_ItemExtInfoVector* ItemConf::FindItemExtInfo(protoconf::FruitType ext_type_list) const { | ||
auto iter = index_item_ext_info_map_.find(static_cast<int>(ext_type_list)); | ||
if (iter == index_item_ext_info_map_.end()) { | ||
return nullptr; | ||
} | ||
return &iter->second; | ||
} | ||
|
||
const protoconf::ItemConf::Item* ItemConf::FindFirstItemExtInfo(protoconf::FruitType ext_type_list) const { | ||
auto conf = FindItemExtInfo(ext_type_list); | ||
if (conf == nullptr || conf->size() == 0) { | ||
return nullptr; | ||
} | ||
return (*conf)[0]; | ||
} | ||
|
||
const ItemConf::Index_ItemMap& ItemConf::FindItem() const { return index_item_map_ ;} | ||
|
||
const ItemConf::Index_ItemVector* ItemConf::FindItem(protoconf::FruitType type) const { | ||
auto iter = index_item_map_.find(static_cast<int>(type)); | ||
if (iter == index_item_map_.end()) { | ||
return nullptr; | ||
} | ||
return &iter->second; | ||
} | ||
|
||
const protoconf::ItemConf::Item* ItemConf::FindFirstItem(protoconf::FruitType type) const { | ||
auto conf = FindItem(type); | ||
if (conf == nullptr || conf->size() == 0) { | ||
return nullptr; | ||
} | ||
return (*conf)[0]; | ||
} | ||
|
||
|
||
} // namespace tableau |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,76 @@ | ||
// Code generated by protoc-gen-cpp-tableau-loader. DO NOT EDIT. | ||
// versions: | ||
// - protoc-gen-cpp-tableau-loader v0.4.5 | ||
// - protoc v3.19.3 | ||
// source: item_conf.proto | ||
|
||
#pragma once | ||
#include <string> | ||
|
||
#include "hub.pc.h" | ||
#include "protoconf/item_conf.pb.h" | ||
#include "item_conf.pb.h" | ||
|
||
namespace tableau { | ||
class ItemConf : public Messager { | ||
public: | ||
static const std::string& Name() { return kProtoName; }; | ||
virtual bool Load(const std::string& dir, Format fmt) override; | ||
virtual bool Load(const std::string& dir, Format fmt, const LoadOptions* options = nullptr) override; | ||
const protoconf::ItemConf& Data() const { return data_; }; | ||
|
||
private: | ||
virtual bool ProcessAfterLoad() override final; | ||
|
||
public: | ||
const protoconf::ItemConf::Item* Get(uint32_t key1) const; | ||
|
||
private: | ||
static const std::string kProtoName; | ||
protoconf::ItemConf data_; | ||
|
||
// OrderedMap accessers. | ||
public: | ||
using Item_OrderedMap = std::map<uint32_t, const protoconf::ItemConf::Item*>; | ||
const Item_OrderedMap* GetOrderedMap() const; | ||
|
||
private: | ||
Item_OrderedMap ordered_map_; | ||
|
||
// Index accessers. | ||
public: | ||
using Index_ItemVector = std::vector<const protoconf::ItemConf::Item*>; | ||
using Index_ItemMap = std::unordered_map<int, Index_ItemVector>; | ||
const Index_ItemMap& FindItem() const; | ||
const Index_ItemVector* FindItem(protoconf::FruitType type) const; | ||
const protoconf::ItemConf::Item* FindFirstItem(protoconf::FruitType type) const; | ||
|
||
private: | ||
Index_ItemMap index_item_map_; | ||
|
||
public: | ||
using Index_ItemInfoVector = std::vector<const protoconf::ItemConf::Item*>; | ||
using Index_ItemInfoMap = std::unordered_map<int32_t, Index_ItemInfoVector>; | ||
const Index_ItemInfoMap& FindItemInfo() const; | ||
const Index_ItemInfoVector* FindItemInfo(int32_t param_list) const; | ||
const protoconf::ItemConf::Item* FindFirstItemInfo(int32_t param_list) const; | ||
|
||
private: | ||
Index_ItemInfoMap index_item_info_map_; | ||
|
||
public: | ||
using Index_ItemExtInfoVector = std::vector<const protoconf::ItemConf::Item*>; | ||
using Index_ItemExtInfoMap = std::unordered_map<int, Index_ItemExtInfoVector>; | ||
const Index_ItemExtInfoMap& FindItemExtInfo() const; | ||
const Index_ItemExtInfoVector* FindItemExtInfo(protoconf::FruitType ext_type_list) const; | ||
const protoconf::ItemConf::Item* FindFirstItemExtInfo(protoconf::FruitType ext_type_list) const; | ||
|
||
private: | ||
Index_ItemExtInfoMap index_item_ext_info_map_; | ||
|
||
}; | ||
|
||
} // namespace tableau | ||
|
||
namespace protoconf { | ||
// Here are some type aliases for easy use. | ||
using ItemConfMgr = tableau::ItemConf; | ||
} // namespace protoconf |
Oops, something went wrong.