OLD | NEW |
(Empty) | |
| 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ |
| 4 // |
| 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are |
| 7 // met: |
| 8 // |
| 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. |
| 11 // * Redistributions in binary form must reproduce the above |
| 12 // copyright notice, this list of conditions and the following disclaimer |
| 13 // in the documentation and/or other materials provided with the |
| 14 // distribution. |
| 15 // * Neither the name of Google Inc. nor the names of its |
| 16 // contributors may be used to endorse or promote products derived from |
| 17 // this software without specific prior written permission. |
| 18 // |
| 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 |
| 31 #import <Foundation/Foundation.h> |
| 32 |
| 33 @class GPBMessage; |
| 34 @class GPBExtensionRegistry; |
| 35 |
| 36 NS_ASSUME_NONNULL_BEGIN |
| 37 |
| 38 // Reads and decodes protocol message fields. |
| 39 // Subclassing of GPBCodedInputStream is NOT supported. |
| 40 @interface GPBCodedInputStream : NSObject |
| 41 |
| 42 + (instancetype)streamWithData:(NSData *)data; |
| 43 - (instancetype)initWithData:(NSData *)data; |
| 44 |
| 45 // Attempt to read a field tag, returning zero if we have reached EOF. |
| 46 // Protocol message parsers use this to read tags, since a protocol message |
| 47 // may legally end wherever a tag occurs, and zero is not a valid tag number. |
| 48 - (int32_t)readTag; |
| 49 |
| 50 - (double)readDouble; |
| 51 - (float)readFloat; |
| 52 - (uint64_t)readUInt64; |
| 53 - (uint32_t)readUInt32; |
| 54 - (int64_t)readInt64; |
| 55 - (int32_t)readInt32; |
| 56 - (uint64_t)readFixed64; |
| 57 - (uint32_t)readFixed32; |
| 58 - (int32_t)readEnum; |
| 59 - (int32_t)readSFixed32; |
| 60 - (int64_t)readSFixed64; |
| 61 - (int32_t)readSInt32; |
| 62 - (int64_t)readSInt64; |
| 63 - (BOOL)readBool; |
| 64 - (NSString *)readString; |
| 65 - (NSData *)readBytes; |
| 66 |
| 67 // Read an embedded message field value from the stream. |
| 68 - (void)readMessage:(GPBMessage *)message |
| 69 extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry; |
| 70 |
| 71 // Reads and discards a single field, given its tag value. Returns NO if the |
| 72 // tag is an endgroup tag, in which case nothing is skipped. Otherwise, |
| 73 // returns YES. |
| 74 - (BOOL)skipField:(int32_t)tag; |
| 75 |
| 76 // Reads and discards an entire message. This will read either until EOF |
| 77 // or until an endgroup tag, whichever comes first. |
| 78 - (void)skipMessage; |
| 79 |
| 80 // Verifies that the last call to readTag() returned the given tag value. |
| 81 // This is used to verify that a nested group ended with the correct end tag. |
| 82 // Throws NSParseErrorException if value does not match the last tag. |
| 83 - (void)checkLastTagWas:(int32_t)value; |
| 84 |
| 85 @end |
| 86 |
| 87 NS_ASSUME_NONNULL_END |
OLD | NEW |