Giter VIP home page Giter VIP logo

protobuf-objc's Introduction

Protocol Buffers, Objective C

Java style generator with full support for google protocol buffers in Objective C.

Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. This project is based on an implementation of Protocol Buffers from Google. See the Google protobuf project for more information.

Project Overview

This project contains two components:

  • Protocol Buffer compiler plugin (protoc-gen-objc), that will allow (protoc) to generate Objective-C data model classes from ".proto" definitions and, optionally, the specialized code necessary to both read and write instances of the equivalent protocol buffer messages.
  • Runtime static library, written in Objective-C that you link into your project to enable protobuf support for the generated data model.

The (protoc-gen-objc) compiler plugin supports almost all the features of the protobuf 2 language. Once installed, (protoc) will be able to generate Objective-C classes when the --objc_out parameter is used to process a .proto file. These classes, along with the supplied static library, will then allow your code to read and write protobuf instances simply and in a cocoa manner.

Features of this Fork

  • Produces modern, ARC enabled, Objective-C code
  • Supports the latest version of google protocol buffers and most language features
  • Uses the latest compiler infrastructure supplied by the google protocol buffers project
  • imports and global_scope insertion points for plugins @gregschlom

Creating the Protocol Buffer Compiler Plugin

Requirements:

Ensure the following have been built and installed the current release versions of the following tools. Some instructions may be found in this project's wiki.

  • Xcode and the current "Xcode command line tools" package
  • autoconf/automake
  • google protocol buffers

Building:

  1. Download source or clone repository to the build machine
  2. cd into root directory of the project
  3. Run $ ./autogen.sh
  4. Run $ ./configure
  5. Run $ make and $ sudo make install

Installation:

Ensure (protoc-gen-objc) is in a directory specified by your $PATH environment variable. By default, it will be installed into the same directory as the google compiler (protoc).

Generating Objective-C Classes:

The protocol buffer compiler (protoc) produces Objective-C output when invoked with the --objc_out= command-line flag. The parameter to the --objc_out= option is the directory where you want the compiler to write your Objective-C output. The compiler creates a header file and an implementation file for each .proto file input. The names of the output files are computed by taking the name of the .proto file and making two changes:

  • The extension (.proto) is replaced with either .pb.h or .pb.m for the header or implementation file, respectively.
  • Generated files will be in the location specified. The proto path (specified with the --proto_path= command-line parameter) is replaced with the output path (specified with the --objc_out= flag).

Integrating the Runtime Static Library

Once you have generated the .pb.h and .pb.m files from the .proto files, you can then add them to your project. However, in order to build properly there is a one time, per project, configuration process to integrate the runtime source files.

  • Open your existing project and a reference to the "ProtocolModels" project found in /src/runtime.
  • Add "ProtocolModels" as a direct dependency of your build target.
  • Often, it is necessary to manually add the static library the runtime project creates to the list of libraries linked to your project

Some instructions and screenshots illustrating this process may be found in this project's wiki.

Credits

Protocol Buffers, Objective C

Protocol Buffers, Objective C iOS5, Regwez Inc.

Protocol Buffers for Objective C, Booyah Inc.

Google Protocol Buffers, Objective C

Google Protocol Buffers

  • Kenton Varda, Sanjay Ghemawat, Jeff Dean, and others

protobuf-objc's People

Contributors

andrewlmurray avatar chapados avatar dicej avatar epreston avatar evanj avatar gregschlom avatar idolize avatar jhhsia avatar jparise avatar macdrevx avatar michaelpetrov avatar ragy avatar wader avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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