Skip to content

OnlyloveSY/libgameref

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

1.Guide

EN:Head Only C ++ - based game server or client is an efficient table reading tool, Reflect table data into the structure

CN:跨平台适用于游戏服务器,自动将以\t进行分割的数据表高效反射到对应标记的结构体成员中,他仅仅包含下面两个文件,并且没有其他任何依赖,具体如何使用请查看test文件夹中的测试用例,其中包含大量数据的表作为耗时参考

  • See the test case in (test) for details on how to use it

  • If you want to use it, just include the following files

  • libref.hpp

  • table_ref.h

2.API function docs

  • To create a table structure object with a structure as its template, you pass in the path to the table and the split character
static StructValueConverter<StructType>* CreateTable(const char* file_name, const char d = '\t');
  • Register a store of the underlying type
void Register(FieldType StructType::* field_pointer,std::string bind_field);
  • Register a store for std::vector,
void Register(std::vector<FieldType> StructType::* field_pointer,std::string bind_field);
  • Register a store for std::set/unordered_set,
void Register(std::unordered_set<FieldType> StructType::* field_pointer,std::string bind_field);
  • Export as STL map/unordered_map data structure
bool Unmarshal(std::unordered_map<KeyType, StructType>& save);
  • Export as STL map/unordered_map data structure,and support for lambda to check data easily
bool Unmarshal(std::unordered_map<KeyType, StructType>& save, _Pr pr);
  • Export as STL vector data structure
bool Unmarshal(std::vector<StructType>& save);
  • Export as STL vector data structure,and support for lambda to check data easily
bool Unmarshal(std::vector<StructType>& save, _Pr pr);

3.test

Support

variable type test support
int8_t
uint8_t
int16_t
uint16_t
int32_t
uint32_t
int64_t
uint64_t
std::string
std::set/std::unordered_set
std::vector

Unmarshal Support

c++ stl test support
std::vector
std::unordered_map
std::map

4.Generated Game Config Tool

If you want to expand or trim some fields, you can use the GneratedTool tool

go build -o tools
./tools
or
go run tools

About

C ++ reflection library for game servers and other table-structured data processing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors