|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| DevTools/ | | 03-May-2024 | - | 1,657 | 1,279 |
| ProtocolBuffers_OSX.xcodeproj/ | | 03-May-2024 | - | 1,429 | 1,409 |
| ProtocolBuffers_iOS.xcodeproj/ | | 03-May-2024 | - | 1,698 | 1,675 |
| Tests/ | | 03-May-2024 | - | 37,595 | 33,430 |
| google/protobuf/ | | 03-May-2024 | - | 3,882 | 2,445 |
| GPBArray.h | D | 03-May-2024 | 20 KiB | 550 | 227 |
| GPBArray.m | D | 03-May-2024 | 74.8 KiB | 2,535 | 2,245 |
| GPBArray_PackagePrivate.h | D | 03-May-2024 | 3.4 KiB | 131 | 56 |
| GPBBootstrap.h | D | 03-May-2024 | 4 KiB | 86 | 26 |
| GPBCodedInputStream.h | D | 03-May-2024 | 4.7 KiB | 131 | 33 |
| GPBCodedInputStream.m | D | 03-May-2024 | 15.1 KiB | 500 | 434 |
| GPBCodedInputStream_PackagePrivate.h | D | 03-May-2024 | 5.1 KiB | 115 | 58 |
| GPBCodedOutputStream.h | D | 03-May-2024 | 14.4 KiB | 345 | 124 |
| GPBCodedOutputStream.m | D | 03-May-2024 | 40.7 KiB | 1,222 | 1,058 |
| GPBCodedOutputStream_PackagePrivate.h | D | 03-May-2024 | 6.1 KiB | 127 | 76 |
| GPBDescriptor.h | D | 03-May-2024 | 5.4 KiB | 142 | 76 |
| GPBDescriptor.m | D | 03-May-2024 | 29.5 KiB | 964 | 850 |
| GPBDescriptor_PackagePrivate.h | D | 03-May-2024 | 11.7 KiB | 314 | 186 |
| GPBDictionary.h | D | 03-May-2024 | 88.2 KiB | 2,244 | 1,348 |
| GPBDictionary.m | D | 03-May-2024 | 463 KiB | 13,556 | 11,877 |
| GPBDictionary_PackagePrivate.h | D | 03-May-2024 | 14.6 KiB | 489 | 332 |
| GPBExtensionInternals.h | D | 03-May-2024 | 2.4 KiB | 51 | 15 |
| GPBExtensionInternals.m | D | 03-May-2024 | 15.3 KiB | 381 | 362 |
| GPBExtensionRegistry.h | D | 03-May-2024 | 3.7 KiB | 83 | 11 |
| GPBExtensionRegistry.m | D | 03-May-2024 | 4 KiB | 109 | 96 |
| GPBMessage.h | D | 03-May-2024 | 13.6 KiB | 309 | 67 |
| GPBMessage.m | D | 03-May-2024 | 118.8 KiB | 3,185 | 2,944 |
| GPBMessage_PackagePrivate.h | D | 03-May-2024 | 6.3 KiB | 144 | 38 |
| GPBProtocolBuffers.h | D | 03-May-2024 | 2.4 KiB | 58 | 24 |
| GPBProtocolBuffers.m | D | 03-May-2024 | 2.7 KiB | 61 | 57 |
| GPBProtocolBuffers_RuntimeSupport.h | D | 03-May-2024 | 2 KiB | 41 | 6 |
| GPBRootObject.h | D | 03-May-2024 | 2.1 KiB | 48 | 7 |
| GPBRootObject.m | D | 03-May-2024 | 8.6 KiB | 231 | 205 |
| GPBRootObject_PackagePrivate.h | D | 03-May-2024 | 2 KiB | 47 | 7 |
| GPBRuntimeTypes.h | D | 03-May-2024 | 3.6 KiB | 103 | 50 |
| GPBUnknownField.h | D | 03-May-2024 | 3.2 KiB | 90 | 20 |
| GPBUnknownField.m | D | 03-May-2024 | 10.8 KiB | 327 | 291 |
| GPBUnknownFieldSet.h | D | 03-May-2024 | 2.5 KiB | 66 | 11 |
| GPBUnknownFieldSet.m | D | 03-May-2024 | 13.6 KiB | 424 | 375 |
| GPBUnknownFieldSet_PackagePrivate.h | D | 03-May-2024 | 2.4 KiB | 62 | 19 |
| GPBUnknownField_PackagePrivate.h | D | 03-May-2024 | 2 KiB | 50 | 11 |
| GPBUtilities.h | D | 03-May-2024 | 10.9 KiB | 258 | 46 |
| GPBUtilities.m | D | 03-May-2024 | 62.7 KiB | 1,718 | 1,542 |
| GPBUtilities_PackagePrivate.h | D | 03-May-2024 | 13.2 KiB | 332 | 190 |
| GPBWellKnownTypes.h | D | 03-May-2024 | 2.4 KiB | 53 | 15 |
| GPBWellKnownTypes.m | D | 03-May-2024 | 4.2 KiB | 118 | 100 |
| GPBWireFormat.h | D | 03-May-2024 | 2.9 KiB | 73 | 33 |
| GPBWireFormat.m | D | 03-May-2024 | 3.4 KiB | 79 | 70 |
| README.md | D | 03-May-2024 | 5.7 KiB | 153 | 113 |
| generate_well_known_types.sh | D | 03-May-2024 | 2 KiB | 77 | 52 |
README.md
1Protocol Buffers - Google's data interchange format
2===================================================
3
4[![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf)
5
6Copyright 2008 Google Inc.
7
8This directory contains the Objective C Protocol Buffers runtime library.
9
10Requirements
11------------
12
13The Objective C implementation requires:
14
15- Objective C 2.0 Runtime (32bit & 64bit iOS, 64bit OS X).
16- Xcode 7.0 (or later).
17- The library code does *not* use ARC (for performance reasons), but it all can
18 be called from ARC code.
19
20Installation
21------------
22
23The full distribution pulled from github includes the sources for both the
24compiler (protoc) and the runtime (this directory). To build the compiler
25and run the runtime tests, you can use:
26
27 $ objectivec/DevTools/full_mac_build.sh
28
29This will generate the `src/protoc` binary.
30
31Building
32--------
33
34There are two ways to include the Runtime sources in your project:
35
36Add `objectivec/\*.h` & `objectivec/GPBProtocolBuffers.m` to your project.
37
38*or*
39
40Add `objectivec/\*.h` & `objectivec/\*.m` except for
41`objectivec/GPBProtocolBuffers.m` to your project.
42
43
44If the target is using ARC, remember to turn off ARC (`-fno-objc-arc`) for the
45`.m` files.
46
47The files generated by `protoc` for the `*.proto` files (`\*.pbobjc.h' and
48`\*.pbobjc.m`) are then also added to the target.
49
50Usage
51-----
52
53The objects generated for messages should work like any other Objective C
54object. They are mutable objects, but if you don't change them, they are safe
55to share between threads (similar to passing an NSMutableDictionary between
56threads/queues; as long as no one mutates it, things are fine).
57
58There are a few behaviors worth calling out:
59
60A property that is type NSString\* will never return nil. If the value is
61unset, it will return an empty string (@""). This is inpart to align things
62with the Protocol Buffers spec which says the default for strings is an empty
63string, but also so you can always safely pass them to isEqual:/compare:, etc.
64and have deterministic results.
65
66A property that is type NSData\* also won't return nil, it will return an empty
67data ([NSData data]). The reasoning is the same as for NSString not returning
68nil.
69
70A property that is another GPBMessage class also will not return nil. If the
71field wasn't already set, you will get a instance of the correct class. This
72instance will be a temporary instance unless you mutate it, at which point it
73will be attached to its parent object. We call this pattern *autocreators*.
74Similar to NSString and NSData properties it makes things a little safer when
75using them with isEqual:/etc.; but more importantly, this allows you to write
76code that uses Objective C's property dot notation to walk into nested objects
77and access and/or assign things without having to check that they are not nil
78and create them each step along the way. You can write this:
79
80```
81- (void)updateRecord:(MyMessage *)msg {
82 ...
83 // Note: You don't have to check subMessage and otherMessage for nil and
84 // alloc/init/assign them back along the way.
85 msg.subMessage.otherMessage.lastName = @"Smith";
86 ...
87}
88```
89
90If you want to check if a GPBMessage property is present, there is always as
91`has\[NAME\]` property to go with the main property to check if it is set.
92
93A property that is of an Array or Dictionary type also provides *autocreator*
94behavior and will never return nil. This provides all the same benefits you
95see for the message properties. Again, you can write:
96
97```
98- (void)updateRecord:(MyMessage *)msg {
99 ...
100 // Note: Just like above, you don't have to check subMessage and otherMessage
101 // for nil and alloc/init/assign them back along the way. You also don't have
102 // to create the siblingsArray, you can safely just append to it.
103 [msg.subMessage.otherMessage.siblingsArray addObject:@"Pat"];
104 ...
105}
106```
107
108If you are inspecting a message you got from some other place (server, disk,
109etc), you may want to check if the Array or Dictionary has entries without
110causing it to be created for you. For this, there is always a `\[NAME\]_Count`
111property also provided that can return zero or the real count, but won't trigger
112the creation.
113
114For primitive type fields (ints, floats, bools, enum) in messages defined in a
115`.proto` file that use *proto2* syntax there are conceptual differences between
116having an *explicit* and *default* value. You can always get the value of the
117property. In the case that it hasn't been set you will get the default. In
118cases where you need to know whether it was set explicitly or you are just
119getting the default, you can use the `has\[NAME\]` property. If the value has
120been set, and you want to clear it, you can set the `has\[NAME\]` to `NO`.
121*proto3* syntax messages do away with this concept, thus the default values are
122never included when the message is encoded.
123
124The Objective C classes/enums can be used from Swift code.
125
126Objective C Generator Options
127-----------------------------
128
129**objc_class_prefix=\<prefix\>** (no default)
130
131Since Objective C uses a global namespace for all of its classes, there can
132be collisions. This option provides a prefix that will be added to the Enums
133and Objects (for messages) generated from the proto. Convention is to base
134the prefix on the package the proto is in.
135
136Contributing
137------------
138
139Please make updates to the tests along with changes. If just changing the
140runtime, the Xcode projects can be used to build and run tests. If your change
141also requires changes to the generated code,
142`objectivec/DevTools/full_mac_build.sh` can be used to easily rebuild and test
143changes. Passing `-h` to the script will show the addition options that could
144be useful.
145
146Documentation
147-------------
148
149The complete documentation for Protocol Buffers is available via the
150web at:
151
152 https://developers.google.com/protocol-buffers/
153