Code Monkey home page Code Monkey logo

protobufgenerator's Introduction

ProtoBufGenerator

Delphi ProtoBuf files generator

Update 13.11.2018

by @modersohn (https://github.com/modersohn)

  • support for optional fields
  • strong check for fill all required fields
  • minimize and beautify the generated code

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.

protobufgenerator's People

Contributors

kami-soft avatar modersohn avatar zedxxx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.