开源中国 2018 年度最后一场技术盛会邀你来约~错过就要等明年啦!点此立即预约

Warrially / ProtoBufGeneratorPascal

Watch 1 Star 0 Fork 0
加入码云
与超过 300 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
Delphi ProtoBuf files generator 展开 收起

Loading...
README.md

ProtoBufGenerator

Delphi ProtoBuf files generator

Update 14.01.2017

Add console generator version

Update 08.01.2017

Add example

Work with binary ProtoBuf messages based on https://sourceforge.net/projects/protobuf-delphi/files/ by marat1961 (sources have some modifications)

Main features:

  • generate classes, not records (like most other parsers)
  • cross-platform(???) realization

Limitations:

  • no comments in the middle of declaration:

    // this is correct
    message Sample { // this is correct
      // and this too
      repeated // this is NOT supported (comment in the middle of field declaration)
        sint32 Foo = 1;
      optional string FooString = 2; // this is correct
    
  • field types Any and OneOf not supported

  • reserved word extensions not supported

  • groups (deprecated feature) not supported

How to use

  • add root folder of this project to library path (Tools - Options - Delphi options - Library)
  • open ProtoBufGeneratorGroup.groupproj from root folder of this project
  • compile and run ProtoBufGenerator.exe
  • open .proto file(s) by press "Open" button
  • select directory for new generated .pas file(s) and press "Generate" button
  • add generated file to your project.

Do not use LoadFromBuf/SaveToBuf methods in generated classes! Use LoadFromStream and SaveToStream methods, which inherited from base class. See Example2, how to use generated classes.

ToDo:

  • add extensions (simple ignore directive, or - wrap to comment)
  • add tests with "original" ProtoBuf generated binary messages.

点评 ( 0 )

你可以在登录后,发表评论

搜索帮助