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