Giter Site home page Giter Site logo

protobuf-qt's Introduction

Protobuf-Qt

This lib should help with usage of generated sources from Google Protobuf files with Qt and QML.

Idea

Just write plugin for current C++ generator:

  • Add getter/setter for std::string as QString
  • Mark all messages classes as QObject
  • Add Q_PROPERTY for all messages fields
    • Wrap repeated fields by QQmlListProperty
    • Add signals for fields changes

Usage

  • Build compiler
  • Generate sources; example command:
    protoc --plugin=protoc-gen-qt=protoc-gen-qt --cpp_out=. --qt_out=. Test.proto
  • Profit

List of known insertion points (look at orignal C++ generator)

$full_name$ mean:

  • package.ClassName for message type
  • package.ClassName.field_name for field

File (google/protobuf/compiler/cpp/cpp_file.cc)

  • includes
  • namespace_scope
  • global_scope

Message type (google/protobuf/compiler/cpp/cpp_message.cc)

  • class_definition:$full_name$
  • dep_base_class_definition:$full_name$
  • class_scope:$full_name$
  • constructor:$full_name$
  • arena_constructor:$full_name$
  • copy_constructor:$full_name$
  • destructor:$full_name$
  • message_clear_start:$full_name$
  • one_of_clear_start:$full_name$
  • generalized_merge_from_start:$full_name$
  • generalized_merge_from_cast_fail:$full_name$
  • generalized_merge_from_cast_success:$full_name$
  • class_specific_merge_from_start:$full_name$
  • generalized_copy_from_start:$full_name$
  • class_specific_copy_from_start:$full_name$
  • parse_start:$full_name$
  • parse_success:$full_name$
  • parse_failure:$full_name$
  • serialize_start:$full_name$
  • serialize_end:$full_name$
  • serialize_to_array_start:$full_name$
  • serialize_to_array_end:$full_name$
  • message_set_byte_size_start:$full_name$
  • required_fields_byte_size_fallback_start:$full_name$
  • message_byte_size_start:$full_name$

Primitive field (google/protobuf/compiler/cpp/cpp_primitive_field.cc)

  • field_get:$full_name$
  • field_set:$full_name$

Primitive repeated field (google/protobuf/compiler/cpp/cpp_primitive_field.cc)

  • field_get:$full_name$
  • field_set:$full_name$
  • field_add:$full_name$
  • field_list:$full_name$
  • field_mutable_list:$full_name$

String field (google/protobuf/compiler/cpp/cpp_string_field.cc)

  • field_get:$full_name$
  • field_set:$full_name$
  • field_set_rvalue:$full_name$
  • field_set_char:$full_name$
  • field_set_pointer:$full_name$
  • field_mutable:$full_name$
  • field_release:$full_name$
  • field_set_allocated:$full_name$
  • field_unsafe_arena_release:$full_name$
  • field_unsafe_arena_set_allocated:$full_name$

String repeated field (google/protobuf/compiler/cpp/cpp_string_field.cc)

  • field_get:$full_name$
  • field_set:$full_name$
  • field_set_rvalue:$full_name$
  • field_set_char:$full_name$
  • field_set_pointer:$full_name$
  • field_mutable:$full_name$
  • field_add_mutable:$full_name$
  • field_add:$full_name$
  • field_add_char:$full_name$
  • field_add_pointer:$full_name$
  • field_list:$full_name$
  • field_mutable_list:$full_name$

Enum field (google/protobuf/compiler/cpp/cpp_enum_field.cc)

  • field_get:$full_name$
  • field_set:$full_name$

Enum repeated field (google/protobuf/compiler/cpp/cpp_enum_field.cc)

  • field_get:$full_name$
  • field_set:$full_name$
  • field_add:$full_name$
  • field_list:$full_name$
  • field_mutable_list:$full_name$

Map field (google/protobuf/compiler/cpp/cpp_map_field.cc)

  • field_map:$full_name$
  • field_mutable_map:$full_name$

Message field (google/protobuf/compiler/cpp/cpp_message_field.cc)

  • field_unsafe_arena_set_allocated:$full_name$
  • field_get:$full_name$
  • field_release:$full_name$
  • field_unsafe_arena_release:$full_name$
  • field_mutable:$full_name$
  • field_set_allocated:$full_name$

Message repeated field (google/protobuf/compiler/cpp/cpp_message_field.cc)

  • field_add:$full_name$
  • field_mutable:$full_name$
  • field_get:$full_name$
  • field_list:$full_name$

protobuf-qt's People

Contributors

onto avatar

Watchers

 avatar  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.