Skip to content

Commit 32fadc0

Browse files
sergiocampamathomasvl
authored andcommitted
Migrating documentation of the ObjectiveC runtime code to appledoc. (protocolbuffers#1867)
Work for protocolbuffers#1866 Migrates all the public class docs over to appledoc format. While Xcode is fine with blank lines in `///` comments, appledoc (used by cocoadocs) isn't and was leaving a bunch of info off the doc pages. The generator still needs to be updated to do this also; that will be a follow up CL.
1 parent 1102a8a commit 32fadc0

14 files changed

+9524
-774
lines changed

objectivec/GPBArray.h

+1,433-15
Large diffs are not rendered by default.

objectivec/GPBBootstrap.h

+27-10
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@
2828
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2929
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030

31-
// The Objective C runtime has complete enough info that most protos don’t end
32-
// up using this, so leaving it on is no cost or very little cost. If you
33-
// happen to see it causing bloat, this is the way to disable it. If you do
34-
// need to disable it, try only disabling it for Release builds as having
35-
// full TextFormat can be useful for debugging.
31+
/**
32+
* The Objective C runtime has complete enough info that most protos don’t end
33+
* up using this, so leaving it on is no cost or very little cost. If you
34+
* happen to see it causing bloat, this is the way to disable it. If you do
35+
* need to disable it, try only disabling it for Release builds as having
36+
* full TextFormat can be useful for debugging.
37+
**/
3638
#ifndef GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
3739
#define GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS 0
3840
#endif
@@ -42,6 +44,7 @@
4244
#if !__has_feature(objc_fixed_enum)
4345
#error All supported Xcode versions should support objc_fixed_enum.
4446
#endif
47+
4548
// If the headers are imported into Objective-C++, we can run into an issue
4649
// where the defintion of NS_ENUM (really CF_ENUM) changes based on the C++
4750
// standard that is in effect. If it isn't C++11 or higher, the definition
@@ -53,19 +56,29 @@
5356
#else
5457
#define GPB_ENUM(X) NS_ENUM(int32_t, X)
5558
#endif
56-
// GPB_ENUM_FWD_DECLARE is used for forward declaring enums, ex:
57-
// GPB_ENUM_FWD_DECLARE(Foo_Enum)
58-
// @property (nonatomic) Foo_Enum value;
59+
60+
/**
61+
* GPB_ENUM_FWD_DECLARE is used for forward declaring enums, for example:
62+
*
63+
* ```
64+
* GPB_ENUM_FWD_DECLARE(Foo_Enum)
65+
* @property (nonatomic) Foo_Enum value;
66+
* ```
67+
**/
5968
#define GPB_ENUM_FWD_DECLARE(X) enum X : int32_t
6069

61-
// Based upon CF_INLINE. Forces inlining in release.
70+
/**
71+
* Based upon CF_INLINE. Forces inlining in non DEBUG builds.
72+
**/
6273
#if !defined(DEBUG)
6374
#define GPB_INLINE static __inline__ __attribute__((always_inline))
6475
#else
6576
#define GPB_INLINE static __inline__
6677
#endif
6778

68-
// For use in public headers that might need to deal with ARC.
79+
/**
80+
* For use in public headers that might need to deal with ARC.
81+
**/
6982
#ifndef GPB_UNSAFE_UNRETAINED
7083
#if __has_feature(objc_arc)
7184
#define GPB_UNSAFE_UNRETAINED __unsafe_unretained
@@ -76,10 +89,14 @@
7689

7790
// If property name starts with init we need to annotate it to get past ARC.
7891
// http://stackoverflow.com/questions/18723226/how-do-i-annotate-an-objective-c-property-with-an-objc-method-family/18723227#18723227
92+
//
93+
// Meant to be used internally by generated code.
7994
#define GPB_METHOD_FAMILY_NONE __attribute__((objc_method_family(none)))
8095

8196
// The protoc-gen-objc version which works with the current version of the
8297
// generated Objective C sources. In general we don't want to change the
8398
// runtime interfaces (or this version) as it means everything has to be
8499
// regenerated.
100+
//
101+
// Meant to be used internally by generated code.
85102
#define GOOGLE_PROTOBUF_OBJC_GEN_VERSION 30001

objectivec/GPBCodedInputStream.h

+134-65
Original file line numberDiff line numberDiff line change
@@ -37,125 +37,194 @@ NS_ASSUME_NONNULL_BEGIN
3737

3838
CF_EXTERN_C_BEGIN
3939

40-
/// GPBCodedInputStream exception name. Exceptions raised from
41-
/// GPBCodedInputStream contain an underlying error in the userInfo dictionary
42-
/// under the GPBCodedInputStreamUnderlyingErrorKey key.
40+
/**
41+
* @c GPBCodedInputStream exception name. Exceptions raised from
42+
* @c GPBCodedInputStream contain an underlying error in the userInfo dictionary
43+
* under the GPBCodedInputStreamUnderlyingErrorKey key.
44+
**/
4345
extern NSString *const GPBCodedInputStreamException;
4446

45-
/// The key under which the underlying NSError from the exception is stored.
47+
/** The key under which the underlying NSError from the exception is stored. */
4648
extern NSString *const GPBCodedInputStreamUnderlyingErrorKey;
4749

48-
/// NSError domain used for GPBCodedInputStream errors.
50+
/** NSError domain used for @c GPBCodedInputStream errors. */
4951
extern NSString *const GPBCodedInputStreamErrorDomain;
5052

51-
/// Error code for NSError with GPBCodedInputStreamErrorDomain.
53+
/**
54+
* Error code for NSError with @c GPBCodedInputStreamErrorDomain.
55+
**/
5256
typedef NS_ENUM(NSInteger, GPBCodedInputStreamErrorCode) {
53-
/// The size does not fit in the remaining bytes to be read.
57+
/** The size does not fit in the remaining bytes to be read. */
5458
GPBCodedInputStreamErrorInvalidSize = -100,
55-
/// Attempted to read beyond the subsection limit.
59+
/** Attempted to read beyond the subsection limit. */
5660
GPBCodedInputStreamErrorSubsectionLimitReached = -101,
57-
/// The requested subsection limit is invalid.
61+
/** The requested subsection limit is invalid. */
5862
GPBCodedInputStreamErrorInvalidSubsectionLimit = -102,
59-
/// Invalid tag read.
63+
/** Invalid tag read. */
6064
GPBCodedInputStreamErrorInvalidTag = -103,
61-
/// Invalid UTF-8 character in a string.
65+
/** Invalid UTF-8 character in a string. */
6266
GPBCodedInputStreamErrorInvalidUTF8 = -104,
63-
/// Invalid VarInt read.
67+
/** Invalid VarInt read. */
6468
GPBCodedInputStreamErrorInvalidVarInt = -105,
65-
/// The maximum recursion depth of messages was exceeded.
69+
/** The maximum recursion depth of messages was exceeded. */
6670
GPBCodedInputStreamErrorRecursionDepthExceeded = -106,
6771
};
6872

6973
CF_EXTERN_C_END
7074

71-
/// Reads and decodes protocol message fields.
72-
///
73-
/// The common uses of protocol buffers shouldn't need to use this class.
74-
/// @c GPBMessage's provide a @c +parseFromData:error: and @c
75-
/// +parseFromData:extensionRegistry:error: method that will decode a
76-
/// message for you.
77-
///
78-
/// @note Subclassing of GPBCodedInputStream is NOT supported.
75+
/**
76+
* Reads and decodes protocol message fields.
77+
*
78+
* The common uses of protocol buffers shouldn't need to use this class.
79+
* @c GPBMessage's provide a @c +parseFromData:error: and
80+
* @c +parseFromData:extensionRegistry:error: method that will decode a
81+
* message for you.
82+
*
83+
* @note Subclassing of @c GPBCodedInputStream is NOT supported.
84+
**/
7985
@interface GPBCodedInputStream : NSObject
8086

81-
/// Creates a new stream wrapping some data.
87+
/**
88+
* Creates a new stream wrapping some data.
89+
*
90+
* @param data The data to wrap inside the stream.
91+
*
92+
* @return A newly instanced GPBCodedInputStream.
93+
**/
8294
+ (instancetype)streamWithData:(NSData *)data;
8395

84-
/// Initializes a stream wrapping some data.
96+
/**
97+
* Initializes a stream wrapping some data.
98+
*
99+
* @param data The data to wrap inside the stream.
100+
*
101+
* @return A newly initialized GPBCodedInputStream.
102+
**/
85103
- (instancetype)initWithData:(NSData *)data;
86104

87-
/// Attempt to read a field tag, returning zero if we have reached EOF.
88-
/// Protocol message parsers use this to read tags, since a protocol message
89-
/// may legally end wherever a tag occurs, and zero is not a valid tag number.
105+
/**
106+
* Attempts to read a field tag, returning zero if we have reached EOF.
107+
* Protocol message parsers use this to read tags, since a protocol message
108+
* may legally end wherever a tag occurs, and zero is not a valid tag number.
109+
*
110+
* @return The field tag, or zero if EOF was reached.
111+
**/
90112
- (int32_t)readTag;
91113

92-
/// Read and return a double.
114+
/**
115+
* @return A double read from the stream.
116+
**/
93117
- (double)readDouble;
94-
/// Read and return a float.
118+
/**
119+
* @return A float read from the stream.
120+
**/
95121
- (float)readFloat;
96-
/// Read and return a uint64.
122+
/**
123+
* @return A uint64 read from the stream.
124+
**/
97125
- (uint64_t)readUInt64;
98-
/// Read and return a uint32.
126+
/**
127+
* @return A uint32 read from the stream.
128+
**/
99129
- (uint32_t)readUInt32;
100-
/// Read and return an int64.
130+
/**
131+
* @return An int64 read from the stream.
132+
**/
101133
- (int64_t)readInt64;
102-
/// Read and return an int32.
134+
/**
135+
* @return An int32 read from the stream.
136+
**/
103137
- (int32_t)readInt32;
104-
/// Read and return a fixed64.
138+
/**
139+
* @return A fixed64 read from the stream.
140+
**/
105141
- (uint64_t)readFixed64;
106-
/// Read and return a fixed32.
142+
/**
143+
* @return A fixed32 read from the stream.
144+
**/
107145
- (uint32_t)readFixed32;
108-
/// Read and return an enum (int).
146+
/**
147+
* @return An enum read from the stream.
148+
**/
109149
- (int32_t)readEnum;
110-
/// Read and return a sfixed32.
150+
/**
151+
* @return A sfixed32 read from the stream.
152+
**/
111153
- (int32_t)readSFixed32;
112-
/// Read and return a sfixed64.
154+
/**
155+
* @return A fixed64 read from the stream.
156+
**/
113157
- (int64_t)readSFixed64;
114-
/// Read and return a sint32.
158+
/**
159+
* @return A sint32 read from the stream.
160+
**/
115161
- (int32_t)readSInt32;
116-
/// Read and return a sint64.
162+
/**
163+
* @return A sint64 read from the stream.
164+
**/
117165
- (int64_t)readSInt64;
118-
/// Read and return a boolean.
166+
/**
167+
* @return A boolean read from the stream.
168+
**/
119169
- (BOOL)readBool;
120-
/// Read and return a string.
170+
/**
171+
* @return A string read from the stream.
172+
**/
121173
- (NSString *)readString;
122-
/// Read and return length delimited data.
174+
/**
175+
* @return Data read from the stream.
176+
**/
123177
- (NSData *)readBytes;
124178

125-
/// Read an embedded message field value from the stream.
126-
///
127-
/// @param message The message to set fields on as they are read.
128-
/// @param extensionRegistry An optional extension registry to use to lookup
129-
/// extensions for @c message.
179+
/**
180+
* Read an embedded message field value from the stream.
181+
*
182+
* @param message The message to set fields on as they are read.
183+
* @param extensionRegistry An optional extension registry to use to lookup
184+
* extensions for message.
185+
**/
130186
- (void)readMessage:(GPBMessage *)message
131187
extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry;
132188

133-
/// Reads and discards a single field, given its tag value.
134-
///
135-
/// @param tag The tag number of the field to skip.
136-
///
137-
/// @return NO if the tag is an endgroup tag (in which case nothing is skipped),
138-
/// YES in all other cases.
189+
/**
190+
* Reads and discards a single field, given its tag value.
191+
*
192+
* @param tag The tag number of the field to skip.
193+
*
194+
* @return NO if the tag is an endgroup tag (in which case nothing is skipped),
195+
* YES in all other cases.
196+
**/
139197
- (BOOL)skipField:(int32_t)tag;
140198

141-
/// Reads and discards an entire message. This will read either until EOF
142-
/// or until an endgroup tag, whichever comes first.
199+
/**
200+
* Reads and discards an entire message. This will read either until EOF or
201+
* until an endgroup tag, whichever comes first.
202+
**/
143203
- (void)skipMessage;
144204

145-
/// Check to see if the logical end of the stream has been reached.
146-
///
147-
/// This can return NO when there is no more data, but the current parsing
148-
/// expected more data.
205+
/**
206+
* Check to see if the logical end of the stream has been reached.
207+
*
208+
* @note This can return NO when there is no more data, but the current parsing
209+
* expected more data.
210+
*
211+
* @return YES if the logical end of the stream has been reached, NO otherwise.
212+
**/
149213
- (BOOL)isAtEnd;
150214

151-
/// The offset into the stream.
215+
/**
216+
* @return The offset into the stream.
217+
**/
152218
- (size_t)position;
153219

154-
/// Verifies that the last call to @c -readTag returned the given tag value.
155-
/// This is used to verify that a nested group ended with the correct end tag.
156-
/// Throws @c NSParseErrorException if value does not match the last tag.
157-
///
158-
/// @param expected The tag that was expected.
220+
/**
221+
* Verifies that the last call to -readTag returned the given tag value. This
222+
* is used to verify that a nested group ended with the correct end tag.
223+
*
224+
* @exception NSParseErrorException If the value does not match the last tag.
225+
*
226+
* @param expected The tag that was expected.
227+
**/
159228
- (void)checkLastTagWas:(int32_t)expected;
160229

161230
@end

0 commit comments

Comments
 (0)