## PBC
[![travis-ci status](https://travis-ci.org/cloudwu/pbc.svg?branch=master)](https://travis-ci.org/cloudwu/pbc)
PBC is a google protocol buffers library for C without code generation.
## Quick Example
package tutorial;
message Person {
required string name = 1;
required int32 id = 2; // Unique ID number for this person.
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}
```C
struct pbc_rmessage * m = pbc_rmessage_new(env, "tutorial.Person", slice);
printf("name = %s\n", pbc_rmessage_string(m , "name" , 0 , NULL));
printf("id = %d\n", pbc_rmessage_integer(m , "id" , 0 , NULL));
printf("email = %s\n", pbc_rmessage_string(m , "email" , 0 , NULL));
int phone_n = pbc_rmessage_size(m, "phone");
int i;
for (i=0;i<phone_n;i++) {
struct pbc_rmessage * p = pbc_rmessage_message(m , "phone", i);
printf("\tnumber[%d] = %s\n",i,pbc_rmessage_string(p , "number", i ,NULL));
printf("\ttype[%d] = %s\n",i,pbc_rmessage_string(p, "type", i, NULL));
}
pbc_rmessage_delete(m);
```
## Message API
You can use *wmessage* for encoding , and *rmessage* for decoding.
See test/addressbook.c for details.
## Pattern API
If you need better performance , you can use pbc_pattern_xxx api .
See test/pattern.c for details.
Pattern api is faster and less memory used because it can access data in native C struct.
## Extension
PBC support extension in a very simple way . PBC add a specific prefix to every extension field name.
## Service
Not supported
## Enum
With message API , you can use both string and integer as enum type . They must be integer in Pattern API.
## Lua bindings
cd bindings/lua && make
See https://github.com/cloudwu/pbc/tree/master/binding/lua/README.md
## Question ?
* Send me email : http://www.codingnow.com/2000/gmail.gif
* My Blog : http://blog.codingnow.com
* Design : http://blog.codingnow.com/2011/12/protocol_buffers_for_c.html (in Chinese)
* Build for Visual Studio 2012 : https://github.com/miaodadao/pbc
没有合适的资源?快使用搜索试试~ 我知道了~
基于Cocos2d-x框架,并使用MVC架构的棋类游戏
共254个文件
lua:80个
tbl:72个
c:27个
需积分: 0 0 下载量 76 浏览量
2023-06-11
10:06:13
上传
评论
收藏 7.43MB ZIP 举报
温馨提示
基于Cocos2d-x框架,并使用MVC架构的一个棋类游戏。 Pure MVC架构,构建可维护的Cocos2d-x游戏。 ###使用的框架 Cocos2d-x2.2.3 ###apk下载地址 应用宝 360手机助手 ###相关博客 架构篇:http://my.oschina.net/wangxuanyihaha/blog/265649 ###项目导入 将该项目放在Cocos2d-x根目录下的projects文件夹下。 ####Xcode 直接点击Four.xcodeproj,即可通过Xcode打开该项目。 ####Eclipse 使用Eclipse的Import功能,将已有的安卓代码导入到Eclipse中,并运行proj.android中的build_native.sh。再在Eclipse中运行即可。
资源推荐
资源详情
资源评论
收起资源包目录
基于Cocos2d-x框架,并使用MVC架构的棋类游戏 (254个子文件)
config.game.br 1KB
pbc-lua.c 26KB
pattern.c 25KB
pbc-lua53.c 20KB
wmessage.c 12KB
lua-log.c 12KB
rmessage.c 11KB
map.c 10KB
register.c 10KB
decode.c 8KB
bootstrap.c 7KB
proto.c 5KB
context.c 5KB
dump.c 4KB
pattern.c 4KB
array.c 3KB
addressbook.c 3KB
varint.c 2KB
decode.c 2KB
alloc.c 1KB
stringpool.c 1KB
float.c 1KB
pbc.c 1KB
map.c 1KB
test.c 892B
varint.c 869B
array.c 399B
lua-zlib.c 0B
config.center 791B
config.db 1KB
config.gate 833B
.gitignore 61B
.gitignore 39B
.gitmodules 81B
descriptor.pbc.h 15KB
pbc.h 3KB
context.h 3KB
proto.h 1KB
map.h 1KB
alloc.h 634B
array.h 578B
varint.h 509B
pattern.h 456B
readfile.h 449B
stringpool.h 256B
bootstrap.h 206B
config.hall 932B
config.login 963B
halldbmgr.lua 58KB
dbmgr.lua 36KB
gamemgr.lua 34KB
game_lhd.lua 34KB
db_helper.lua 33KB
date.lua 30KB
logic.lua 27KB
game.lua 25KB
game.lua 25KB
gametable.lua 22KB
mysqldbconfig.lua 16KB
agent.lua 16KB
protobuf.lua 14KB
protobuf.lua 12KB
protobuf.lua 12KB
parser.lua 10KB
gateway.lua 9KB
wsagent.lua 9KB
config.lua 9KB
websocket.lua 8KB
uuid.lua 8KB
gamedbmgr.lua 8KB
loginserverex.lua 8KB
logic.lua 7KB
config.lua 7KB
client.lua 7KB
robot_lhd.lua 6KB
wsgateway.lua 6KB
logind.lua 6KB
luaext.lua 6KB
wsagent.lua 6KB
config.lua 6KB
game.lua 6KB
util.lua 5KB
internal.lua 5KB
mysql_utils.lua 4KB
wsgate.lua 4KB
server_manager.lua 4KB
c_login.lua 3KB
client_util.lua 3KB
testlua.lua 3KB
robot.lua 3KB
robot.lua 3KB
random.lua 3KB
gen_table.lua 3KB
logindbmgr.lua 3KB
mysqlpool.lua 3KB
gen_feng_table.lua 2KB
table_mgr.lua 2KB
c_game.lua 2KB
httpserveragent.lua 2KB
mjlib.lua 2KB
共 254 条
- 1
- 2
- 3
资源评论
图灵软件技术
- 粉丝: 596
- 资源: 73
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功