123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500 |
- // Protocol Buffers - Google's data interchange format
- // Copyright 2008 Google Inc. All rights reserved.
- // https://developers.google.com/protocol-buffers/
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions are
- // met:
- //
- // * Redistributions of source code must retain the above copyright
- // notice, this list of conditions and the following disclaimer.
- // * Redistributions in binary form must reproduce the above
- // copyright notice, this list of conditions and the following disclaimer
- // in the documentation and/or other materials provided with the
- // distribution.
- // * Neither the name of Google Inc. nor the names of its
- // contributors may be used to endorse or promote products derived from
- // this software without specific prior written permission.
- //
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #import <Foundation/Foundation.h>
- #import "GPBDictionary.h"
- @class GPBCodedInputStream;
- @class GPBCodedOutputStream;
- @class GPBExtensionRegistry;
- @class GPBFieldDescriptor;
- @protocol GPBDictionaryInternalsProtocol
- - (size_t)computeSerializedSizeAsField:(GPBFieldDescriptor *)field;
- - (void)writeToCodedOutputStream:(GPBCodedOutputStream *)outputStream
- asField:(GPBFieldDescriptor *)field;
- - (void)setGPBGenericValue:(GPBGenericValue *)value
- forGPBGenericValueKey:(GPBGenericValue *)key;
- - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block;
- @end
- //%PDDM-DEFINE DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(KEY_NAME)
- //%DICTIONARY_POD_PRIV_INTERFACES_FOR_KEY(KEY_NAME)
- //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, Object, Object)
- //%PDDM-DEFINE DICTIONARY_POD_PRIV_INTERFACES_FOR_KEY(KEY_NAME)
- //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, UInt32, Basic)
- //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, Int32, Basic)
- //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, UInt64, Basic)
- //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, Int64, Basic)
- //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, Bool, Basic)
- //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, Float, Basic)
- //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, Double, Basic)
- //%DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, Enum, Enum)
- //%PDDM-DEFINE DICTIONARY_PRIVATE_INTERFACES(KEY_NAME, VALUE_NAME, HELPER)
- //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary () <GPBDictionaryInternalsProtocol> {
- //% @package
- //% GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- //%}
- //%EXTRA_DICTIONARY_PRIVATE_INTERFACES_##HELPER()@end
- //%
- //%PDDM-DEFINE EXTRA_DICTIONARY_PRIVATE_INTERFACES_Basic()
- // Empty
- //%PDDM-DEFINE EXTRA_DICTIONARY_PRIVATE_INTERFACES_Object()
- //%- (BOOL)isInitialized;
- //%- (instancetype)deepCopyWithZone:(NSZone *)zone
- //% __attribute__((ns_returns_retained));
- //%
- //%PDDM-DEFINE EXTRA_DICTIONARY_PRIVATE_INTERFACES_Enum()
- //%- (NSData *)serializedDataForUnknownValue:(int32_t)value
- //% forKey:(GPBGenericValue *)key
- //% keyDataType:(GPBDataType)keyDataType;
- //%
- //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(UInt32)
- // This block of code is generated, do not edit it directly.
- // clang-format off
- @interface GPBUInt32UInt32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt32Int32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt32UInt64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt32Int64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt32BoolDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt32FloatDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt32DoubleDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt32EnumDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (NSData *)serializedDataForUnknownValue:(int32_t)value
- forKey:(GPBGenericValue *)key
- keyDataType:(GPBDataType)keyDataType;
- @end
- @interface GPBUInt32ObjectDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (BOOL)isInitialized;
- - (instancetype)deepCopyWithZone:(NSZone *)zone
- __attribute__((ns_returns_retained));
- @end
- // clang-format on
- //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(Int32)
- // This block of code is generated, do not edit it directly.
- // clang-format off
- @interface GPBInt32UInt32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt32Int32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt32UInt64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt32Int64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt32BoolDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt32FloatDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt32DoubleDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt32EnumDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (NSData *)serializedDataForUnknownValue:(int32_t)value
- forKey:(GPBGenericValue *)key
- keyDataType:(GPBDataType)keyDataType;
- @end
- @interface GPBInt32ObjectDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (BOOL)isInitialized;
- - (instancetype)deepCopyWithZone:(NSZone *)zone
- __attribute__((ns_returns_retained));
- @end
- // clang-format on
- //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(UInt64)
- // This block of code is generated, do not edit it directly.
- // clang-format off
- @interface GPBUInt64UInt32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt64Int32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt64UInt64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt64Int64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt64BoolDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt64FloatDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt64DoubleDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBUInt64EnumDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (NSData *)serializedDataForUnknownValue:(int32_t)value
- forKey:(GPBGenericValue *)key
- keyDataType:(GPBDataType)keyDataType;
- @end
- @interface GPBUInt64ObjectDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (BOOL)isInitialized;
- - (instancetype)deepCopyWithZone:(NSZone *)zone
- __attribute__((ns_returns_retained));
- @end
- // clang-format on
- //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(Int64)
- // This block of code is generated, do not edit it directly.
- // clang-format off
- @interface GPBInt64UInt32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt64Int32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt64UInt64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt64Int64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt64BoolDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt64FloatDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt64DoubleDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBInt64EnumDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (NSData *)serializedDataForUnknownValue:(int32_t)value
- forKey:(GPBGenericValue *)key
- keyDataType:(GPBDataType)keyDataType;
- @end
- @interface GPBInt64ObjectDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (BOOL)isInitialized;
- - (instancetype)deepCopyWithZone:(NSZone *)zone
- __attribute__((ns_returns_retained));
- @end
- // clang-format on
- //%PDDM-EXPAND DICTIONARY_PRIV_INTERFACES_FOR_POD_KEY(Bool)
- // This block of code is generated, do not edit it directly.
- // clang-format off
- @interface GPBBoolUInt32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBBoolInt32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBBoolUInt64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBBoolInt64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBBoolBoolDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBBoolFloatDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBBoolDoubleDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBBoolEnumDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (NSData *)serializedDataForUnknownValue:(int32_t)value
- forKey:(GPBGenericValue *)key
- keyDataType:(GPBDataType)keyDataType;
- @end
- @interface GPBBoolObjectDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (BOOL)isInitialized;
- - (instancetype)deepCopyWithZone:(NSZone *)zone
- __attribute__((ns_returns_retained));
- @end
- // clang-format on
- //%PDDM-EXPAND DICTIONARY_POD_PRIV_INTERFACES_FOR_KEY(String)
- // This block of code is generated, do not edit it directly.
- // clang-format off
- @interface GPBStringUInt32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBStringInt32Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBStringUInt64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBStringInt64Dictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBStringBoolDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBStringFloatDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBStringDoubleDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- @interface GPBStringEnumDictionary () <GPBDictionaryInternalsProtocol> {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- - (NSData *)serializedDataForUnknownValue:(int32_t)value
- forKey:(GPBGenericValue *)key
- keyDataType:(GPBDataType)keyDataType;
- @end
- // clang-format on
- //%PDDM-EXPAND-END (6 expansions)
- #pragma mark - NSDictionary Subclass
- @interface GPBAutocreatedDictionary : NSMutableDictionary {
- @package
- GPB_UNSAFE_UNRETAINED GPBMessage *_autocreator;
- }
- @end
- #pragma mark - Helpers
- CF_EXTERN_C_BEGIN
- // Helper to compute size when an NSDictionary is used for the map instead
- // of a custom type.
- size_t GPBDictionaryComputeSizeInternalHelper(NSDictionary *dict,
- GPBFieldDescriptor *field);
- // Helper to write out when an NSDictionary is used for the map instead
- // of a custom type.
- void GPBDictionaryWriteToStreamInternalHelper(
- GPBCodedOutputStream *outputStream, NSDictionary *dict,
- GPBFieldDescriptor *field);
- // Helper to check message initialization when an NSDictionary is used for
- // the map instead of a custom type.
- BOOL GPBDictionaryIsInitializedInternalHelper(NSDictionary *dict,
- GPBFieldDescriptor *field);
- // Helper to read a map instead.
- void GPBDictionaryReadEntry(id mapDictionary, GPBCodedInputStream *stream,
- GPBExtensionRegistry *registry,
- GPBFieldDescriptor *field,
- GPBMessage *parentMessage);
- CF_EXTERN_C_END
|