OLD | NEW |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // GPBPrepareReadOnlySemaphore to ensure it has been created. This allows | 71 // GPBPrepareReadOnlySemaphore to ensure it has been created. This allows |
72 // readOnlySemaphore_ to be only created when actually needed. | 72 // readOnlySemaphore_ to be only created when actually needed. |
73 dispatch_once_t readOnlySemaphoreCreationOnce_; | 73 dispatch_once_t readOnlySemaphoreCreationOnce_; |
74 dispatch_semaphore_t readOnlySemaphore_; | 74 dispatch_semaphore_t readOnlySemaphore_; |
75 } | 75 } |
76 | 76 |
77 // Gets an extension value without autocreating the result if not found. (i.e. | 77 // Gets an extension value without autocreating the result if not found. (i.e. |
78 // returns nil if the extension is not set) | 78 // returns nil if the extension is not set) |
79 - (id)getExistingExtension:(GPBExtensionDescriptor *)extension; | 79 - (id)getExistingExtension:(GPBExtensionDescriptor *)extension; |
80 | 80 |
81 // Returns an array of GPBExtensionDescriptor* for all the extensions currently | |
82 // in use on the message. They are sorted by field number. | |
83 - (NSArray *)sortedExtensionsInUse; | |
84 | |
85 // Parses a message of this type from the input and merges it with this | 81 // Parses a message of this type from the input and merges it with this |
86 // message. | 82 // message. |
87 // | 83 // |
88 // Warning: This does not verify that all required fields are present in | 84 // Warning: This does not verify that all required fields are present in |
89 // the input message. | 85 // the input message. |
90 // Note: The caller should call | 86 // Note: The caller should call |
91 // -[CodedInputStream checkLastTagWas:] after calling this to | 87 // -[CodedInputStream checkLastTagWas:] after calling this to |
92 // verify that the last tag seen was the appropriate end-group tag, | 88 // verify that the last tag seen was the appropriate end-group tag, |
93 // or zero for EOF. | 89 // or zero for EOF. |
94 // NOTE: This will throw if there is an error while parsing. | 90 // NOTE: This will throw if there is an error while parsing. |
95 - (void)mergeFromCodedInputStream:(GPBCodedInputStream *)input | 91 - (void)mergeFromCodedInputStream:(GPBCodedInputStream *)input |
96 extensionRegistry:(GPBExtensionRegistry *)extensionRegistry; | 92 extensionRegistry:(GPBExtensionRegistry *)extensionRegistry; |
97 | 93 |
98 // Parses the next delimited message of this type from the input and merges it | 94 // Parses the next delimited message of this type from the input and merges it |
99 // with this message. | 95 // with this message. |
100 - (void)mergeDelimitedFromCodedInputStream:(GPBCodedInputStream *)input | 96 - (void)mergeDelimitedFromCodedInputStream:(GPBCodedInputStream *)input |
101 extensionRegistry: | 97 extensionRegistry: |
102 (GPBExtensionRegistry *)extensionRegistry; | 98 (GPBExtensionRegistry *)extensionRegistry; |
103 | 99 |
104 - (void)addUnknownMapEntry:(int32_t)fieldNum value:(NSData *)data; | 100 - (void)addUnknownMapEntry:(int32_t)fieldNum value:(NSData *)data; |
105 | 101 |
106 @end | 102 @end |
107 | 103 |
108 CF_EXTERN_C_BEGIN | 104 CF_EXTERN_C_BEGIN |
109 | 105 |
110 | 106 |
111 // Call this before using the readOnlySemaphore_. This ensures it is created onl
y once. | 107 // Call this before using the readOnlySemaphore_. This ensures it is created onl
y once. |
112 NS_INLINE void GPBPrepareReadOnlySemaphore(GPBMessage *self) { | 108 NS_INLINE void GPBPrepareReadOnlySemaphore(GPBMessage *self) { |
| 109 #pragma clang diagnostic push |
| 110 #pragma clang diagnostic ignored "-Wdirect-ivar-access" |
113 dispatch_once(&self->readOnlySemaphoreCreationOnce_, ^{ | 111 dispatch_once(&self->readOnlySemaphoreCreationOnce_, ^{ |
114 self->readOnlySemaphore_ = dispatch_semaphore_create(1); | 112 self->readOnlySemaphore_ = dispatch_semaphore_create(1); |
115 }); | 113 }); |
| 114 #pragma clang diagnostic pop |
116 } | 115 } |
117 | 116 |
118 // Returns a new instance that was automatically created by |autocreator| for | 117 // Returns a new instance that was automatically created by |autocreator| for |
119 // its field |field|. | 118 // its field |field|. |
120 GPBMessage *GPBCreateMessageWithAutocreator(Class msgClass, | 119 GPBMessage *GPBCreateMessageWithAutocreator(Class msgClass, |
121 GPBMessage *autocreator, | 120 GPBMessage *autocreator, |
122 GPBFieldDescriptor *field) | 121 GPBFieldDescriptor *field) |
123 __attribute__((ns_returns_retained)); | 122 __attribute__((ns_returns_retained)); |
124 | 123 |
125 // Returns whether |message| autocreated this message. This is NO if the message | 124 // Returns whether |message| autocreated this message. This is NO if the message |
126 // was not autocreated by |message| or if it has been mutated since | 125 // was not autocreated by |message| or if it has been mutated since |
127 // autocreation. | 126 // autocreation. |
128 BOOL GPBWasMessageAutocreatedBy(GPBMessage *message, GPBMessage *parent); | 127 BOOL GPBWasMessageAutocreatedBy(GPBMessage *message, GPBMessage *parent); |
129 | 128 |
130 // Call this when you mutate a message. It will cause the message to become | 129 // Call this when you mutate a message. It will cause the message to become |
131 // visible to its autocreator. | 130 // visible to its autocreator. |
132 void GPBBecomeVisibleToAutocreator(GPBMessage *self); | 131 void GPBBecomeVisibleToAutocreator(GPBMessage *self); |
133 | 132 |
134 // Call this when an array/dictionary is mutated so the parent message that | 133 // Call this when an array/dictionary is mutated so the parent message that |
135 // autocreated it can react. | 134 // autocreated it can react. |
136 void GPBAutocreatedArrayModified(GPBMessage *self, id array); | 135 void GPBAutocreatedArrayModified(GPBMessage *self, id array); |
137 void GPBAutocreatedDictionaryModified(GPBMessage *self, id dictionary); | 136 void GPBAutocreatedDictionaryModified(GPBMessage *self, id dictionary); |
138 | 137 |
139 // Clear the autocreator, if any. Asserts if the autocreator still has an | 138 // Clear the autocreator, if any. Asserts if the autocreator still has an |
140 // autocreated reference to this message. | 139 // autocreated reference to this message. |
141 void GPBClearMessageAutocreator(GPBMessage *self); | 140 void GPBClearMessageAutocreator(GPBMessage *self); |
142 | 141 |
143 CF_EXTERN_C_END | 142 CF_EXTERN_C_END |
OLD | NEW |