{"id":13746153,"url":"https://github.com/cloudwu/pbc","last_synced_at":"2025-09-27T10:30:44.467Z","repository":{"id":1940235,"uuid":"2869484","full_name":"cloudwu/pbc","owner":"cloudwu","description":"A protocol buffers library for C","archived":true,"fork":false,"pushed_at":"2022-11-03T03:00:02.000Z","size":312,"stargazers_count":1619,"open_issues_count":74,"forks_count":568,"subscribers_count":163,"default_branch":"master","last_synced_at":"2024-09-25T22:42:37.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudwu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-28T19:16:06.000Z","updated_at":"2024-09-25T12:00:23.000Z","dependencies_parsed_at":"2023-01-11T16:06:49.914Z","dependency_job_id":null,"html_url":"https://github.com/cloudwu/pbc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwu%2Fpbc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwu%2Fpbc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwu%2Fpbc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwu%2Fpbc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudwu","download_url":"https://codeload.github.com/cloudwu/pbc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234426057,"owners_count":18830838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T06:00:48.069Z","updated_at":"2025-09-27T10:30:39.085Z","avatar_url":"https://github.com/cloudwu.png","language":"C","funding_links":[],"categories":["Utilities","C","公用事业","Utilities ##"],"sub_categories":["YAML","Vim ###"],"readme":"## PBC\n\n[![travis-ci status](https://travis-ci.org/cloudwu/pbc.svg?branch=master)](https://travis-ci.org/cloudwu/pbc)\n\nPBC is a google protocol buffers library for C without code generation.\n\n## Quick Example\n\n    package tutorial;\n    \n    message Person {\n      required string name = 1;\n      required int32 id = 2;        // Unique ID number for this person.\n      optional string email = 3;\n    \n      enum PhoneType {\n        MOBILE = 0;\n        HOME = 1;\n        WORK = 2;\n      }\n    \n      message PhoneNumber {\n        required string number = 1;\n        optional PhoneType type = 2 [default = HOME];\n      }\n    \n      repeated PhoneNumber phone = 4;\n    }\n\n```C\nstruct pbc_rmessage * m = pbc_rmessage_new(env, \"tutorial.Person\", slice);\nprintf(\"name = %s\\n\", pbc_rmessage_string(m , \"name\" , 0 , NULL));\nprintf(\"id = %d\\n\", pbc_rmessage_integer(m , \"id\" , 0 , NULL));\nprintf(\"email = %s\\n\", pbc_rmessage_string(m , \"email\" , 0 , NULL));\n\nint phone_n = pbc_rmessage_size(m, \"phone\");\nint i;\n\nfor (i=0;i\u003cphone_n;i++) {\n\tstruct pbc_rmessage * p = pbc_rmessage_message(m , \"phone\", i);\n\tprintf(\"\\tnumber[%d] = %s\\n\",i,pbc_rmessage_string(p , \"number\", i ,NULL));\n\tprintf(\"\\ttype[%d] = %s\\n\",i,pbc_rmessage_string(p, \"type\", i, NULL));\n}\n\npbc_rmessage_delete(m);\n```\n\n## Message API\n\nYou can use *wmessage* for encoding , and *rmessage* for decoding.\n\nSee test/addressbook.c for details.\n\n## Pattern API\n\nIf you need better performance , you can use pbc_pattern_xxx api .\n\nSee test/pattern.c for details.\n\nPattern api is faster and less memory used because it can access data in native C struct.\n\n## Extension\n\nPBC support extension in a very simple way . PBC add a specific prefix to every extension field name. \n\n## Service\n\nNot supported\n\n## Enum\n\nWith message API , you can use both string and integer as enum type . They must be integer in Pattern API. \n\n## Lua bindings\n\ncd binding/lua \u0026\u0026 make\nor\ncd binding/lua53 \u0026\u0026 make\n\nSee https://github.com/cloudwu/pbc/tree/master/binding/lua/README.md\n\n## Building pbc - Using vcpkg\n\nYou can download and install pbc using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:\n\n    git clone https://github.com/Microsoft/vcpkg.git\n    cd vcpkg\n    ./bootstrap-vcpkg.sh\n    ./vcpkg integrate install\n    ./vcpkg install pbc\n\nThe pbc port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.\n\n## Question ?\n\n* Send me email : http://www.codingnow.com/2000/gmail.gif\n* My Blog : http://blog.codingnow.com\n* Design : http://blog.codingnow.com/2011/12/protocol_buffers_for_c.html (in Chinese)\n* Build for Visual Studio 2012 : https://github.com/miaodadao/pbc\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudwu%2Fpbc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudwu%2Fpbc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudwu%2Fpbc/lists"}