Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/protobuf/objectivec/GPBUtilities.h

Issue 1983203003: Update third_party/protobuf to protobuf-v3.0.0-beta-3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: owners Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 20 matching lines...) Expand all
31 #import <Foundation/Foundation.h> 31 #import <Foundation/Foundation.h>
32 32
33 #import "GPBArray.h" 33 #import "GPBArray.h"
34 #import "GPBMessage.h" 34 #import "GPBMessage.h"
35 #import "GPBRuntimeTypes.h" 35 #import "GPBRuntimeTypes.h"
36 36
37 CF_EXTERN_C_BEGIN 37 CF_EXTERN_C_BEGIN
38 38
39 NS_ASSUME_NONNULL_BEGIN 39 NS_ASSUME_NONNULL_BEGIN
40 40
41 // Generates a string that should be a valid "Text Format" for the C++ version 41 /// Generates a string that should be a valid "Text Format" for the C++ version
42 // of Protocol Buffers. lineIndent can be nil if no additional line indent is 42 /// of Protocol Buffers.
43 // needed. The comments provide the names according to the ObjC library, they 43 ///
44 // most likely won't exactly match the original .proto file. 44 /// @param message The message to generate from.
45 /// @param lineIndent A string to use as the prefix for all lines generated. Ca n
46 /// be nil if no extra indent is needed.
47 ///
48 /// @return A @c NSString with the Text Format of the message.
45 NSString *GPBTextFormatForMessage(GPBMessage *message, 49 NSString *GPBTextFormatForMessage(GPBMessage *message,
46 NSString * __nullable lineIndent); 50 NSString * __nullable lineIndent);
51
52 /// Generates a string that should be a valid "Text Format" for the C++ version
53 /// of Protocol Buffers.
54 ///
55 /// @param unknownSet The unknown field set to generate from.
56 /// @param lineIndent A string to use as the prefix for all lines generated. Ca n
57 /// be nil if no extra indent is needed.
58 ///
59 /// @return A @c NSString with the Text Format of the unknown field set.
47 NSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet * __nullable unknow nSet, 60 NSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet * __nullable unknow nSet,
48 NSString * __nullable lineIndent); 61 NSString * __nullable lineIndent);
49 62
50 // 63 /// Test if the given field is set on a message.
51 // Test if the given field is set on a message.
52 //
53 BOOL GPBMessageHasFieldNumberSet(GPBMessage *self, uint32_t fieldNumber); 64 BOOL GPBMessageHasFieldNumberSet(GPBMessage *self, uint32_t fieldNumber);
65 /// Test if the given field is set on a message.
54 BOOL GPBMessageHasFieldSet(GPBMessage *self, GPBFieldDescriptor *field); 66 BOOL GPBMessageHasFieldSet(GPBMessage *self, GPBFieldDescriptor *field);
55 67
56 // 68 /// Clear the given field of a message.
57 // Clear the given field of a message.
58 //
59 void GPBClearMessageField(GPBMessage *self, GPBFieldDescriptor *field); 69 void GPBClearMessageField(GPBMessage *self, GPBFieldDescriptor *field);
60 70
61 //%PDDM-EXPAND GPB_ACCESSORS() 71 //%PDDM-EXPAND GPB_ACCESSORS()
62 // This block of code is generated, do not edit it directly. 72 // This block of code is generated, do not edit it directly.
63 73
64 74
65 // 75 //
66 // Get/Set the given field of a message. 76 // Get/Set the given field of a message.
67 // 77 //
68 78
69 // Single Fields 79 // Single Fields
70 80
81 /// Gets the value of a bytes field.
71 NSData *GPBGetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field); 82 NSData *GPBGetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field);
83 /// Sets the value of a bytes field.
72 void GPBSetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field, NSData *value); 84 void GPBSetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field, NSData *value);
73 85
86 /// Gets the value of a string field.
74 NSString *GPBGetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field); 87 NSString *GPBGetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field);
88 /// Sets the value of a string field.
75 void GPBSetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field, NSStr ing *value); 89 void GPBSetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field, NSStr ing *value);
76 90
91 /// Gets the value of a message field.
77 GPBMessage *GPBGetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *fiel d); 92 GPBMessage *GPBGetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *fiel d);
93 /// Sets the value of a message field.
78 void GPBSetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *field, GPBM essage *value); 94 void GPBSetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *field, GPBM essage *value);
79 95
96 /// Gets the value of a group field.
80 GPBMessage *GPBGetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field) ; 97 GPBMessage *GPBGetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field) ;
98 /// Sets the value of a group field.
81 void GPBSetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field, GPBMes sage *value); 99 void GPBSetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field, GPBMes sage *value);
82 100
101 /// Gets the value of a bool field.
83 BOOL GPBGetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field); 102 BOOL GPBGetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field);
103 /// Sets the value of a bool field.
84 void GPBSetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field, BOOL va lue); 104 void GPBSetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field, BOOL va lue);
85 105
106 /// Gets the value of an int32 field.
86 int32_t GPBGetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field); 107 int32_t GPBGetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field);
108 /// Sets the value of an int32 field.
87 void GPBSetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field, int32_ t value); 109 void GPBSetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field, int32_ t value);
88 110
111 /// Gets the value of an uint32 field.
89 uint32_t GPBGetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field); 112 uint32_t GPBGetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field);
113 /// Sets the value of an uint32 field.
90 void GPBSetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field, uint3 2_t value); 114 void GPBSetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field, uint3 2_t value);
91 115
116 /// Gets the value of an int64 field.
92 int64_t GPBGetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field); 117 int64_t GPBGetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field);
118 /// Sets the value of an int64 field.
93 void GPBSetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field, int64_ t value); 119 void GPBSetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field, int64_ t value);
94 120
121 /// Gets the value of an uint64 field.
95 uint64_t GPBGetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field); 122 uint64_t GPBGetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field);
123 /// Sets the value of an uint64 field.
96 void GPBSetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field, uint6 4_t value); 124 void GPBSetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field, uint6 4_t value);
97 125
126 /// Gets the value of a float field.
98 float GPBGetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field); 127 float GPBGetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field);
128 /// Sets the value of a float field.
99 void GPBSetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field, float value); 129 void GPBSetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field, float value);
100 130
131 /// Gets the value of a double field.
101 double GPBGetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field); 132 double GPBGetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field);
133 /// Sets the value of a double field.
102 void GPBSetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field, doubl e value); 134 void GPBSetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field, doubl e value);
103 135
104 // Get/Set the given enum field of a message. You can only Set values that are 136 /// Get the given enum field of a message. For proto3, if the value isn't a
105 // members of the enum. For proto3, when doing a Get, if the value isn't a 137 /// member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned.
106 // memeber of the enum, kGPBUnrecognizedEnumeratorValue will be returned. The 138 /// GPBGetMessageRawEnumField will bypass the check and return whatever value
107 // the functions with "Raw" in the will bypass all checks. 139 /// was set.
108 int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); 140 int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field);
141 /// Set the given enum field of a message. You can only set values that are
142 /// members of the enum.
109 void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int32_t value); 143 void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int32_t value);
144 /// Get the given enum field of a message. No check is done to ensure the value
145 /// was defined in the enum.
110 int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field); 146 int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field);
147 /// Set the given enum field of a message. You can set the value to anything,
148 /// even a value that is not a member of the enum.
111 void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, int3 2_t value); 149 void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, int3 2_t value);
112 150
113 // Repeated Fields 151 // Repeated Fields
114 152
115 // The object will/should be GPB*Array or NSMutableArray based on the field's 153 /// Gets the value of a repeated field.
116 // type. 154 ///
155 /// The result will be @c GPB*Array or @c NSMutableArray based on the
156 /// field's type.
117 id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); 157 id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field);
158 /// Sets the value of a repeated field.
159 ///
160 /// The value should be @c GPB*Array or @c NSMutableArray based on the
161 /// field's type.
118 void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array); 162 void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array);
119 163
120 // Map Fields 164 // Map Fields
121 165
122 // The object will/should be GPB*Dictionary or NSMutableDictionary based on the 166 /// Gets the value of a map<> field.
123 // field's type. 167 ///
168 /// The result will be @c GPB*Dictionary or @c NSMutableDictionary based on
169 /// the field's type.
124 id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); 170 id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field);
171 /// Sets the value of a map<> field.
172 ///
173 /// The object should be @c GPB*Dictionary or @c NSMutableDictionary based
174 /// on the field's type.
125 void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id dicti onary); 175 void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id dicti onary);
126 176
127 //%PDDM-EXPAND-END GPB_ACCESSORS() 177 //%PDDM-EXPAND-END GPB_ACCESSORS()
128 178
129 // Returns an empty NSData to assign to byte fields when you wish 179 // Returns an empty NSData to assign to byte fields when you wish
130 // to assign them to empty. Prevents allocating a lot of little [NSData data] 180 // to assign them to empty. Prevents allocating a lot of little [NSData data]
131 // objects. 181 // objects.
132 NSData *GPBEmptyNSData(void) __attribute__((pure)); 182 NSData *GPBEmptyNSData(void) __attribute__((pure));
133 183
134 NS_ASSUME_NONNULL_END 184 NS_ASSUME_NONNULL_END
135 185
136 CF_EXTERN_C_END 186 CF_EXTERN_C_END
137 187
138 188
139 //%PDDM-DEFINE GPB_ACCESSORS() 189 //%PDDM-DEFINE GPB_ACCESSORS()
140 //% 190 //%
141 //%// 191 //%//
142 //%// Get/Set the given field of a message. 192 //%// Get/Set the given field of a message.
143 //%// 193 //%//
144 //% 194 //%
145 //%// Single Fields 195 //%// Single Fields
146 //% 196 //%
147 //%GPB_ACCESSOR_SINGLE_FULL(Bytes, NSData, *) 197 //%GPB_ACCESSOR_SINGLE_FULL(Bytes, NSData, , *)
148 //%GPB_ACCESSOR_SINGLE_FULL(String, NSString, *) 198 //%GPB_ACCESSOR_SINGLE_FULL(String, NSString, , *)
149 //%GPB_ACCESSOR_SINGLE_FULL(Message, GPBMessage, *) 199 //%GPB_ACCESSOR_SINGLE_FULL(Message, GPBMessage, , *)
150 //%GPB_ACCESSOR_SINGLE_FULL(Group, GPBMessage, *) 200 //%GPB_ACCESSOR_SINGLE_FULL(Group, GPBMessage, , *)
151 //%GPB_ACCESSOR_SINGLE(Bool, BOOL) 201 //%GPB_ACCESSOR_SINGLE(Bool, BOOL, )
152 //%GPB_ACCESSOR_SINGLE(Int32, int32_t) 202 //%GPB_ACCESSOR_SINGLE(Int32, int32_t, n)
153 //%GPB_ACCESSOR_SINGLE(UInt32, uint32_t) 203 //%GPB_ACCESSOR_SINGLE(UInt32, uint32_t, n)
154 //%GPB_ACCESSOR_SINGLE(Int64, int64_t) 204 //%GPB_ACCESSOR_SINGLE(Int64, int64_t, n)
155 //%GPB_ACCESSOR_SINGLE(UInt64, uint64_t) 205 //%GPB_ACCESSOR_SINGLE(UInt64, uint64_t, n)
156 //%GPB_ACCESSOR_SINGLE(Float, float) 206 //%GPB_ACCESSOR_SINGLE(Float, float, )
157 //%GPB_ACCESSOR_SINGLE(Double, double) 207 //%GPB_ACCESSOR_SINGLE(Double, double, )
158 //%// Get/Set the given enum field of a message. You can only Set values that a re 208 //%/// Get the given enum field of a message. For proto3, if the value isn't a
159 //%// members of the enum. For proto3, when doing a Get, if the value isn't a 209 //%/// member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned.
160 //%// memeber of the enum, kGPBUnrecognizedEnumeratorValue will be returned. The 210 //%/// GPBGetMessageRawEnumField will bypass the check and return whatever value
161 //%// the functions with "Raw" in the will bypass all checks. 211 //%/// was set.
162 //%int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); 212 //%int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field);
213 //%/// Set the given enum field of a message. You can only set values that are
214 //%/// members of the enum.
163 //%void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int3 2_t value); 215 //%void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int3 2_t value);
216 //%/// Get the given enum field of a message. No check is done to ensure the val ue
217 //%/// was defined in the enum.
164 //%int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field ); 218 //%int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field );
219 //%/// Set the given enum field of a message. You can set the value to anything,
220 //%/// even a value that is not a member of the enum.
165 //%void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, i nt32_t value); 221 //%void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, i nt32_t value);
166 //% 222 //%
167 //%// Repeated Fields 223 //%// Repeated Fields
168 //% 224 //%
169 //%// The object will/should be GPB*Array or NSMutableArray based on the field's 225 //%/// Gets the value of a repeated field.
170 //%// type. 226 //%///
227 //%/// The result will be @c GPB*Array or @c NSMutableArray based on the
228 //%/// field's type.
171 //%id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); 229 //%id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field);
230 //%/// Sets the value of a repeated field.
231 //%///
232 //%/// The value should be @c GPB*Array or @c NSMutableArray based on the
233 //%/// field's type.
172 //%void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array); 234 //%void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array);
173 //% 235 //%
174 //%// Map Fields 236 //%// Map Fields
175 //% 237 //%
176 //%// The object will/should be GPB*Dictionary or NSMutableDictionary based on t he 238 //%/// Gets the value of a map<> field.
177 //%// field's type. 239 //%///
240 //%/// The result will be @c GPB*Dictionary or @c NSMutableDictionary based on
241 //%/// the field's type.
178 //%id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); 242 //%id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field);
243 //%/// Sets the value of a map<> field.
244 //%///
245 //%/// The object should be @c GPB*Dictionary or @c NSMutableDictionary based
246 //%/// on the field's type.
179 //%void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id di ctionary); 247 //%void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id di ctionary);
180 //% 248 //%
181 249
182 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE(NAME, TYPE) 250 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE(NAME, TYPE, AN)
183 //%GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, ) 251 //%GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, )
184 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, TisP) 252 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, TisP)
253 //%/// Gets the value of a##AN NAME$L field.
185 //%TYPE TisP##GPBGetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *f ield); 254 //%TYPE TisP##GPBGetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *f ield);
255 //%/// Sets the value of a##AN NAME$L field.
186 //%void GPBSetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field, TYPE TisP##value); 256 //%void GPBSetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field, TYPE TisP##value);
187 //% 257 //%
OLDNEW
« no previous file with comments | « third_party/protobuf/objectivec/GPBUnknownFieldSet.h ('k') | third_party/protobuf/objectivec/GPBUtilities.m » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698