parent
f00300d7f0
commit
cf14183bcd
228 changed files with 14739 additions and 3859 deletions
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,559 @@ |
||||
// 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.
|
||||
|
||||
package com.google.protobuf; |
||||
|
||||
import static com.google.protobuf.UnittestLite.OptionalGroup_extension_lite; |
||||
import static com.google.protobuf.UnittestLite.RepeatedGroup_extension_lite; |
||||
import static com.google.protobuf.UnittestLite.defaultBoolExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultBytesExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultCordExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultDoubleExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultFixed32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultFixed64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultFloatExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultForeignEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultImportEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultInt32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultInt64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultNestedEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultSfixed32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultSfixed64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultSint32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultSint64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultStringExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultStringPieceExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultUint32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.defaultUint64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.oneofBytesExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.oneofNestedMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.oneofStringExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.oneofUint32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalBoolExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalBytesExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalCordExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalDoubleExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalFixed32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalFixed64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalFloatExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalForeignEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalForeignMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalGroupExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalImportEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalImportMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalInt32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalInt64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalLazyMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalNestedEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalNestedMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalPublicImportMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalSfixed32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalSfixed64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalSint32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalSint64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalStringExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalStringPieceExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalUint32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.optionalUint64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedBoolExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedDoubleExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedFixed32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedFixed64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedFloatExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedInt32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedInt64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedSfixed32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedSfixed64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedSint32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedSint64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedUint32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.packedUint64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedBoolExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedBytesExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedCordExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedDoubleExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedFixed32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedFixed64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedFloatExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedForeignEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedForeignMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedGroupExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedImportEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedImportMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedInt32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedInt64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedLazyMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedNestedEnumExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedNestedMessageExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedSfixed32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedSfixed64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedSint32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedSint64ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedStringExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedStringPieceExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedUint32ExtensionLite; |
||||
import static com.google.protobuf.UnittestLite.repeatedUint64ExtensionLite; |
||||
|
||||
import com.google.protobuf.UnittestImportLite.ImportEnumLite; |
||||
import com.google.protobuf.UnittestImportLite.ImportMessageLite; |
||||
import com.google.protobuf.UnittestImportPublicLite.PublicImportMessageLite; |
||||
import com.google.protobuf.UnittestLite.ForeignEnumLite; |
||||
import com.google.protobuf.UnittestLite.ForeignMessageLite; |
||||
import com.google.protobuf.UnittestLite.TestAllExtensionsLite; |
||||
import com.google.protobuf.UnittestLite.TestAllTypesLite; |
||||
import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; |
||||
|
||||
/** |
||||
* Contains methods for setting fields of {@code TestAllTypesLite}, {@code TestAllExtensionsLite}, |
||||
* and {@code TestPackedExtensionsLite}. This is analogous to the functionality in TestUtil.java but |
||||
* does not depend on the presence of any non-lite protos. |
||||
* |
||||
* <p>This code is not to be used outside of {@code com.google.protobuf} and |
||||
* subpackages. |
||||
*/ |
||||
public final class TestUtilLite { |
||||
private TestUtilLite() {} |
||||
|
||||
/** Helper to convert a String to ByteString. */ |
||||
static ByteString toBytes(String str) { |
||||
return ByteString.copyFrom(str.getBytes(Internal.UTF_8)); |
||||
} |
||||
|
||||
/** |
||||
* Get a {@code TestAllTypesLite.Builder} with all fields set as they would be by |
||||
* {@link #setAllFields(TestAllTypesLite.Builder)}. |
||||
*/ |
||||
public static TestAllTypesLite.Builder getAllLiteSetBuilder() { |
||||
TestAllTypesLite.Builder builder = TestAllTypesLite.newBuilder(); |
||||
setAllFields(builder); |
||||
return builder; |
||||
} |
||||
|
||||
/** |
||||
* Get a {@code TestAllExtensionsLite} with all fields set as they would be by |
||||
* {@link #setAllExtensions(TestAllExtensionsLite.Builder)}. |
||||
*/ |
||||
public static TestAllExtensionsLite getAllLiteExtensionsSet() { |
||||
TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.newBuilder(); |
||||
setAllExtensions(builder); |
||||
return builder.build(); |
||||
} |
||||
|
||||
public static TestPackedExtensionsLite getLitePackedExtensionsSet() { |
||||
TestPackedExtensionsLite.Builder builder = TestPackedExtensionsLite.newBuilder(); |
||||
setPackedExtensions(builder); |
||||
return builder.build(); |
||||
} |
||||
|
||||
/** |
||||
* Set every field of {@code builder} to the values expected by |
||||
* {@code assertAllFieldsSet()}. |
||||
*/ |
||||
public static void setAllFields(TestAllTypesLite.Builder builder) { |
||||
builder.setOptionalInt32 (101); |
||||
builder.setOptionalInt64 (102); |
||||
builder.setOptionalUint32 (103); |
||||
builder.setOptionalUint64 (104); |
||||
builder.setOptionalSint32 (105); |
||||
builder.setOptionalSint64 (106); |
||||
builder.setOptionalFixed32 (107); |
||||
builder.setOptionalFixed64 (108); |
||||
builder.setOptionalSfixed32(109); |
||||
builder.setOptionalSfixed64(110); |
||||
builder.setOptionalFloat (111); |
||||
builder.setOptionalDouble (112); |
||||
builder.setOptionalBool (true); |
||||
builder.setOptionalString ("115"); |
||||
builder.setOptionalBytes (toBytes("116")); |
||||
|
||||
builder.setOptionalGroup( |
||||
TestAllTypesLite.OptionalGroup.newBuilder().setA(117).build()); |
||||
builder.setOptionalNestedMessage( |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(118).build()); |
||||
builder.setOptionalForeignMessage( |
||||
ForeignMessageLite.newBuilder().setC(119).build()); |
||||
builder.setOptionalImportMessage( |
||||
ImportMessageLite.newBuilder().setD(120).build()); |
||||
builder.setOptionalPublicImportMessage( |
||||
PublicImportMessageLite.newBuilder().setE(126).build()); |
||||
builder.setOptionalLazyMessage( |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(127).build()); |
||||
|
||||
builder.setOptionalNestedEnum (TestAllTypesLite.NestedEnum.BAZ); |
||||
builder.setOptionalForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAZ); |
||||
builder.setOptionalImportEnum (ImportEnumLite.IMPORT_LITE_BAZ); |
||||
|
||||
builder.setOptionalStringPiece("124"); |
||||
builder.setOptionalCord("125"); |
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
builder.addRepeatedInt32 (201); |
||||
builder.addRepeatedInt64 (202); |
||||
builder.addRepeatedUint32 (203); |
||||
builder.addRepeatedUint64 (204); |
||||
builder.addRepeatedSint32 (205); |
||||
builder.addRepeatedSint64 (206); |
||||
builder.addRepeatedFixed32 (207); |
||||
builder.addRepeatedFixed64 (208); |
||||
builder.addRepeatedSfixed32(209); |
||||
builder.addRepeatedSfixed64(210); |
||||
builder.addRepeatedFloat (211); |
||||
builder.addRepeatedDouble (212); |
||||
builder.addRepeatedBool (true); |
||||
builder.addRepeatedString ("215"); |
||||
builder.addRepeatedBytes (toBytes("216")); |
||||
|
||||
builder.addRepeatedGroup( |
||||
TestAllTypesLite.RepeatedGroup.newBuilder().setA(217).build()); |
||||
builder.addRepeatedNestedMessage( |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(218).build()); |
||||
builder.addRepeatedForeignMessage( |
||||
ForeignMessageLite.newBuilder().setC(219).build()); |
||||
builder.addRepeatedImportMessage( |
||||
ImportMessageLite.newBuilder().setD(220).build()); |
||||
builder.addRepeatedLazyMessage( |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(227).build()); |
||||
|
||||
builder.addRepeatedNestedEnum (TestAllTypesLite.NestedEnum.BAR); |
||||
builder.addRepeatedForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAR); |
||||
builder.addRepeatedImportEnum (ImportEnumLite.IMPORT_LITE_BAR); |
||||
|
||||
builder.addRepeatedStringPiece("224"); |
||||
builder.addRepeatedCord("225"); |
||||
|
||||
// Add a second one of each field.
|
||||
builder.addRepeatedInt32 (301); |
||||
builder.addRepeatedInt64 (302); |
||||
builder.addRepeatedUint32 (303); |
||||
builder.addRepeatedUint64 (304); |
||||
builder.addRepeatedSint32 (305); |
||||
builder.addRepeatedSint64 (306); |
||||
builder.addRepeatedFixed32 (307); |
||||
builder.addRepeatedFixed64 (308); |
||||
builder.addRepeatedSfixed32(309); |
||||
builder.addRepeatedSfixed64(310); |
||||
builder.addRepeatedFloat (311); |
||||
builder.addRepeatedDouble (312); |
||||
builder.addRepeatedBool (false); |
||||
builder.addRepeatedString ("315"); |
||||
builder.addRepeatedBytes (toBytes("316")); |
||||
|
||||
builder.addRepeatedGroup( |
||||
TestAllTypesLite.RepeatedGroup.newBuilder().setA(317).build()); |
||||
builder.addRepeatedNestedMessage( |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(318).build()); |
||||
builder.addRepeatedForeignMessage( |
||||
ForeignMessageLite.newBuilder().setC(319).build()); |
||||
builder.addRepeatedImportMessage( |
||||
ImportMessageLite.newBuilder().setD(320).build()); |
||||
builder.addRepeatedLazyMessage( |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(327).build()); |
||||
|
||||
builder.addRepeatedNestedEnum (TestAllTypesLite.NestedEnum.BAZ); |
||||
builder.addRepeatedForeignEnum(ForeignEnumLite.FOREIGN_LITE_BAZ); |
||||
builder.addRepeatedImportEnum (ImportEnumLite.IMPORT_LITE_BAZ); |
||||
|
||||
builder.addRepeatedStringPiece("324"); |
||||
builder.addRepeatedCord("325"); |
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
builder.setDefaultInt32 (401); |
||||
builder.setDefaultInt64 (402); |
||||
builder.setDefaultUint32 (403); |
||||
builder.setDefaultUint64 (404); |
||||
builder.setDefaultSint32 (405); |
||||
builder.setDefaultSint64 (406); |
||||
builder.setDefaultFixed32 (407); |
||||
builder.setDefaultFixed64 (408); |
||||
builder.setDefaultSfixed32(409); |
||||
builder.setDefaultSfixed64(410); |
||||
builder.setDefaultFloat (411); |
||||
builder.setDefaultDouble (412); |
||||
builder.setDefaultBool (false); |
||||
builder.setDefaultString ("415"); |
||||
builder.setDefaultBytes (toBytes("416")); |
||||
|
||||
builder.setDefaultNestedEnum (TestAllTypesLite.NestedEnum.FOO); |
||||
builder.setDefaultForeignEnum(ForeignEnumLite.FOREIGN_LITE_FOO); |
||||
builder.setDefaultImportEnum (ImportEnumLite.IMPORT_LITE_FOO); |
||||
|
||||
builder.setDefaultStringPiece("424"); |
||||
builder.setDefaultCord("425"); |
||||
|
||||
builder.setOneofUint32(601); |
||||
builder.setOneofNestedMessage( |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(602).build()); |
||||
builder.setOneofString("603"); |
||||
builder.setOneofBytes(toBytes("604")); |
||||
} |
||||
|
||||
/** |
||||
* Get an unmodifiable {@link ExtensionRegistryLite} containing all the |
||||
* extensions of {@code TestAllExtensionsLite}. |
||||
*/ |
||||
public static ExtensionRegistryLite getExtensionRegistryLite() { |
||||
ExtensionRegistryLite registry = ExtensionRegistryLite.newInstance(); |
||||
registerAllExtensionsLite(registry); |
||||
return registry.getUnmodifiable(); |
||||
} |
||||
|
||||
/** |
||||
* Register all of {@code TestAllExtensionsLite}'s extensions with the |
||||
* given {@link ExtensionRegistryLite}. |
||||
*/ |
||||
public static void registerAllExtensionsLite(ExtensionRegistryLite registry) { |
||||
UnittestLite.registerAllExtensions(registry); |
||||
} |
||||
|
||||
// ===================================================================
|
||||
// Lite extensions
|
||||
|
||||
/** |
||||
* Set every field of {@code message} to the values expected by |
||||
* {@code assertAllExtensionsSet()}. |
||||
*/ |
||||
public static void setAllExtensions(TestAllExtensionsLite.Builder message) { |
||||
message.setExtension(optionalInt32ExtensionLite , 101); |
||||
message.setExtension(optionalInt64ExtensionLite , 102L); |
||||
message.setExtension(optionalUint32ExtensionLite , 103); |
||||
message.setExtension(optionalUint64ExtensionLite , 104L); |
||||
message.setExtension(optionalSint32ExtensionLite , 105); |
||||
message.setExtension(optionalSint64ExtensionLite , 106L); |
||||
message.setExtension(optionalFixed32ExtensionLite , 107); |
||||
message.setExtension(optionalFixed64ExtensionLite , 108L); |
||||
message.setExtension(optionalSfixed32ExtensionLite, 109); |
||||
message.setExtension(optionalSfixed64ExtensionLite, 110L); |
||||
message.setExtension(optionalFloatExtensionLite , 111F); |
||||
message.setExtension(optionalDoubleExtensionLite , 112D); |
||||
message.setExtension(optionalBoolExtensionLite , true); |
||||
message.setExtension(optionalStringExtensionLite , "115"); |
||||
message.setExtension(optionalBytesExtensionLite , toBytes("116")); |
||||
|
||||
message.setExtension(optionalGroupExtensionLite, |
||||
OptionalGroup_extension_lite.newBuilder().setA(117).build()); |
||||
message.setExtension(optionalNestedMessageExtensionLite, |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(118).build()); |
||||
message.setExtension(optionalForeignMessageExtensionLite, |
||||
ForeignMessageLite.newBuilder().setC(119).build()); |
||||
message.setExtension(optionalImportMessageExtensionLite, |
||||
ImportMessageLite.newBuilder().setD(120).build()); |
||||
message.setExtension(optionalPublicImportMessageExtensionLite, |
||||
PublicImportMessageLite.newBuilder().setE(126).build()); |
||||
message.setExtension(optionalLazyMessageExtensionLite, |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(127).build()); |
||||
|
||||
message.setExtension(optionalNestedEnumExtensionLite, TestAllTypesLite.NestedEnum.BAZ); |
||||
message.setExtension(optionalForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ); |
||||
message.setExtension(optionalImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ); |
||||
|
||||
message.setExtension(optionalStringPieceExtensionLite, "124"); |
||||
message.setExtension(optionalCordExtensionLite, "125"); |
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
message.addExtension(repeatedInt32ExtensionLite , 201); |
||||
message.addExtension(repeatedInt64ExtensionLite , 202L); |
||||
message.addExtension(repeatedUint32ExtensionLite , 203); |
||||
message.addExtension(repeatedUint64ExtensionLite , 204L); |
||||
message.addExtension(repeatedSint32ExtensionLite , 205); |
||||
message.addExtension(repeatedSint64ExtensionLite , 206L); |
||||
message.addExtension(repeatedFixed32ExtensionLite , 207); |
||||
message.addExtension(repeatedFixed64ExtensionLite , 208L); |
||||
message.addExtension(repeatedSfixed32ExtensionLite, 209); |
||||
message.addExtension(repeatedSfixed64ExtensionLite, 210L); |
||||
message.addExtension(repeatedFloatExtensionLite , 211F); |
||||
message.addExtension(repeatedDoubleExtensionLite , 212D); |
||||
message.addExtension(repeatedBoolExtensionLite , true); |
||||
message.addExtension(repeatedStringExtensionLite , "215"); |
||||
message.addExtension(repeatedBytesExtensionLite , toBytes("216")); |
||||
|
||||
message.addExtension(repeatedGroupExtensionLite, |
||||
RepeatedGroup_extension_lite.newBuilder().setA(217).build()); |
||||
message.addExtension(repeatedNestedMessageExtensionLite, |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(218).build()); |
||||
message.addExtension(repeatedForeignMessageExtensionLite, |
||||
ForeignMessageLite.newBuilder().setC(219).build()); |
||||
message.addExtension(repeatedImportMessageExtensionLite, |
||||
ImportMessageLite.newBuilder().setD(220).build()); |
||||
message.addExtension(repeatedLazyMessageExtensionLite, |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(227).build()); |
||||
|
||||
message.addExtension(repeatedNestedEnumExtensionLite, TestAllTypesLite.NestedEnum.BAR); |
||||
message.addExtension(repeatedForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAR); |
||||
message.addExtension(repeatedImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAR); |
||||
|
||||
message.addExtension(repeatedStringPieceExtensionLite, "224"); |
||||
message.addExtension(repeatedCordExtensionLite, "225"); |
||||
|
||||
// Add a second one of each field.
|
||||
message.addExtension(repeatedInt32ExtensionLite , 301); |
||||
message.addExtension(repeatedInt64ExtensionLite , 302L); |
||||
message.addExtension(repeatedUint32ExtensionLite , 303); |
||||
message.addExtension(repeatedUint64ExtensionLite , 304L); |
||||
message.addExtension(repeatedSint32ExtensionLite , 305); |
||||
message.addExtension(repeatedSint64ExtensionLite , 306L); |
||||
message.addExtension(repeatedFixed32ExtensionLite , 307); |
||||
message.addExtension(repeatedFixed64ExtensionLite , 308L); |
||||
message.addExtension(repeatedSfixed32ExtensionLite, 309); |
||||
message.addExtension(repeatedSfixed64ExtensionLite, 310L); |
||||
message.addExtension(repeatedFloatExtensionLite , 311F); |
||||
message.addExtension(repeatedDoubleExtensionLite , 312D); |
||||
message.addExtension(repeatedBoolExtensionLite , false); |
||||
message.addExtension(repeatedStringExtensionLite , "315"); |
||||
message.addExtension(repeatedBytesExtensionLite , toBytes("316")); |
||||
|
||||
message.addExtension(repeatedGroupExtensionLite, |
||||
RepeatedGroup_extension_lite.newBuilder().setA(317).build()); |
||||
message.addExtension(repeatedNestedMessageExtensionLite, |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(318).build()); |
||||
message.addExtension(repeatedForeignMessageExtensionLite, |
||||
ForeignMessageLite.newBuilder().setC(319).build()); |
||||
message.addExtension(repeatedImportMessageExtensionLite, |
||||
ImportMessageLite.newBuilder().setD(320).build()); |
||||
message.addExtension(repeatedLazyMessageExtensionLite, |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(327).build()); |
||||
|
||||
message.addExtension(repeatedNestedEnumExtensionLite, TestAllTypesLite.NestedEnum.BAZ); |
||||
message.addExtension(repeatedForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ); |
||||
message.addExtension(repeatedImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ); |
||||
|
||||
message.addExtension(repeatedStringPieceExtensionLite, "324"); |
||||
message.addExtension(repeatedCordExtensionLite, "325"); |
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
message.setExtension(defaultInt32ExtensionLite , 401); |
||||
message.setExtension(defaultInt64ExtensionLite , 402L); |
||||
message.setExtension(defaultUint32ExtensionLite , 403); |
||||
message.setExtension(defaultUint64ExtensionLite , 404L); |
||||
message.setExtension(defaultSint32ExtensionLite , 405); |
||||
message.setExtension(defaultSint64ExtensionLite , 406L); |
||||
message.setExtension(defaultFixed32ExtensionLite , 407); |
||||
message.setExtension(defaultFixed64ExtensionLite , 408L); |
||||
message.setExtension(defaultSfixed32ExtensionLite, 409); |
||||
message.setExtension(defaultSfixed64ExtensionLite, 410L); |
||||
message.setExtension(defaultFloatExtensionLite , 411F); |
||||
message.setExtension(defaultDoubleExtensionLite , 412D); |
||||
message.setExtension(defaultBoolExtensionLite , false); |
||||
message.setExtension(defaultStringExtensionLite , "415"); |
||||
message.setExtension(defaultBytesExtensionLite , toBytes("416")); |
||||
|
||||
message.setExtension(defaultNestedEnumExtensionLite, TestAllTypesLite.NestedEnum.FOO); |
||||
message.setExtension(defaultForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_FOO); |
||||
message.setExtension(defaultImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_FOO); |
||||
|
||||
message.setExtension(defaultStringPieceExtensionLite, "424"); |
||||
message.setExtension(defaultCordExtensionLite, "425"); |
||||
|
||||
message.setExtension(oneofUint32ExtensionLite, 601); |
||||
message.setExtension(oneofNestedMessageExtensionLite, |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(602).build()); |
||||
message.setExtension(oneofStringExtensionLite, "603"); |
||||
message.setExtension(oneofBytesExtensionLite, toBytes("604")); |
||||
} |
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
/** |
||||
* Modify the repeated extensions of {@code message} to contain the values |
||||
* expected by {@code assertRepeatedExtensionsModified()}. |
||||
*/ |
||||
public static void modifyRepeatedExtensions( |
||||
TestAllExtensionsLite.Builder message) { |
||||
message.setExtension(repeatedInt32ExtensionLite , 1, 501); |
||||
message.setExtension(repeatedInt64ExtensionLite , 1, 502L); |
||||
message.setExtension(repeatedUint32ExtensionLite , 1, 503); |
||||
message.setExtension(repeatedUint64ExtensionLite , 1, 504L); |
||||
message.setExtension(repeatedSint32ExtensionLite , 1, 505); |
||||
message.setExtension(repeatedSint64ExtensionLite , 1, 506L); |
||||
message.setExtension(repeatedFixed32ExtensionLite , 1, 507); |
||||
message.setExtension(repeatedFixed64ExtensionLite , 1, 508L); |
||||
message.setExtension(repeatedSfixed32ExtensionLite, 1, 509); |
||||
message.setExtension(repeatedSfixed64ExtensionLite, 1, 510L); |
||||
message.setExtension(repeatedFloatExtensionLite , 1, 511F); |
||||
message.setExtension(repeatedDoubleExtensionLite , 1, 512D); |
||||
message.setExtension(repeatedBoolExtensionLite , 1, true); |
||||
message.setExtension(repeatedStringExtensionLite , 1, "515"); |
||||
message.setExtension(repeatedBytesExtensionLite , 1, toBytes("516")); |
||||
|
||||
message.setExtension(repeatedGroupExtensionLite, 1, |
||||
RepeatedGroup_extension_lite.newBuilder().setA(517).build()); |
||||
message.setExtension(repeatedNestedMessageExtensionLite, 1, |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(518).build()); |
||||
message.setExtension(repeatedForeignMessageExtensionLite, 1, |
||||
ForeignMessageLite.newBuilder().setC(519).build()); |
||||
message.setExtension(repeatedImportMessageExtensionLite, 1, |
||||
ImportMessageLite.newBuilder().setD(520).build()); |
||||
message.setExtension(repeatedLazyMessageExtensionLite, 1, |
||||
TestAllTypesLite.NestedMessage.newBuilder().setBb(527).build()); |
||||
|
||||
message.setExtension(repeatedNestedEnumExtensionLite , 1, TestAllTypesLite.NestedEnum.FOO); |
||||
message.setExtension(repeatedForeignEnumExtensionLite, 1, ForeignEnumLite.FOREIGN_LITE_FOO); |
||||
message.setExtension(repeatedImportEnumExtensionLite , 1, ImportEnumLite.IMPORT_LITE_FOO); |
||||
|
||||
message.setExtension(repeatedStringPieceExtensionLite, 1, "524"); |
||||
message.setExtension(repeatedCordExtensionLite, 1, "525"); |
||||
} |
||||
|
||||
public static void setPackedExtensions(TestPackedExtensionsLite.Builder message) { |
||||
message.addExtension(packedInt32ExtensionLite , 601); |
||||
message.addExtension(packedInt64ExtensionLite , 602L); |
||||
message.addExtension(packedUint32ExtensionLite , 603); |
||||
message.addExtension(packedUint64ExtensionLite , 604L); |
||||
message.addExtension(packedSint32ExtensionLite , 605); |
||||
message.addExtension(packedSint64ExtensionLite , 606L); |
||||
message.addExtension(packedFixed32ExtensionLite , 607); |
||||
message.addExtension(packedFixed64ExtensionLite , 608L); |
||||
message.addExtension(packedSfixed32ExtensionLite, 609); |
||||
message.addExtension(packedSfixed64ExtensionLite, 610L); |
||||
message.addExtension(packedFloatExtensionLite , 611F); |
||||
message.addExtension(packedDoubleExtensionLite , 612D); |
||||
message.addExtension(packedBoolExtensionLite , true); |
||||
message.addExtension(packedEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAR); |
||||
// Add a second one of each field.
|
||||
message.addExtension(packedInt32ExtensionLite , 701); |
||||
message.addExtension(packedInt64ExtensionLite , 702L); |
||||
message.addExtension(packedUint32ExtensionLite , 703); |
||||
message.addExtension(packedUint64ExtensionLite , 704L); |
||||
message.addExtension(packedSint32ExtensionLite , 705); |
||||
message.addExtension(packedSint64ExtensionLite , 706L); |
||||
message.addExtension(packedFixed32ExtensionLite , 707); |
||||
message.addExtension(packedFixed64ExtensionLite , 708L); |
||||
message.addExtension(packedSfixed32ExtensionLite, 709); |
||||
message.addExtension(packedSfixed64ExtensionLite, 710L); |
||||
message.addExtension(packedFloatExtensionLite , 711F); |
||||
message.addExtension(packedDoubleExtensionLite , 712D); |
||||
message.addExtension(packedBoolExtensionLite , false); |
||||
message.addExtension(packedEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ); |
||||
} |
||||
} |
@ -0,0 +1,20 @@ |
||||
<project name="generate-sources"> |
||||
<echo message="Running protoc ..."/> |
||||
<mkdir dir="${generated.sources.lite.dir}"/> |
||||
<exec executable="${protoc}"> |
||||
<arg value="--java_out=lite:${generated.sources.lite.dir}"/> |
||||
<arg value="--proto_path=${protobuf.source.dir}"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/any.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/api.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/duration.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/empty.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/field_mask.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/source_context.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/struct.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/timestamp.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/type.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/wrappers.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/compiler/plugin.proto"/> |
||||
</exec> |
||||
</project> |
@ -0,0 +1,43 @@ |
||||
<project name="generate-test-sources"> |
||||
<mkdir dir="${generated.testsources.lite.dir}"/> |
||||
<exec executable="${protoc}"> |
||||
<arg value="--java_out=lite:${generated.testsources.lite.dir}"/> |
||||
<arg value="--proto_path=${protobuf.source.dir}"/> |
||||
<arg value="--proto_path=${test.proto.dir}"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_mset.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_mset_wire_format.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_optimize_for.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_custom_options.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_lite.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import_lite.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public_lite.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_lite_imports_nonlite.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_enormous_descriptor.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_no_generic_services.proto"/> |
||||
<arg value="${protobuf.source.dir}/google/protobuf/unittest_well_known_types.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/lazy_fields_lite.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/lite_equals_and_hash.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/multiple_files_test.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/nested_builders_test.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/nested_extension.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/nested_extension_lite.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/non_nested_extension.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/non_nested_extension_lite.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/outer_class_name_test.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/outer_class_name_test2.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/outer_class_name_test3.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/test_bad_identifiers.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/test_check_utf8.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/test_check_utf8_size.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/test_custom_options.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/any_test.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/field_presence_test.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/map_for_proto2_lite_test.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/map_for_proto2_test.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/map_test.proto"/> |
||||
<arg value="${test.proto.dir}/com/google/protobuf/map_initialization_order_test.proto"/> |
||||
</exec> |
||||
</project> |
@ -0,0 +1,553 @@ |
||||
// 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.
|
||||
|
||||
package com.google.protobuf; |
||||
|
||||
import com.google.protobuf.Descriptors.EnumValueDescriptor; |
||||
import com.google.protobuf.Descriptors.FieldDescriptor; |
||||
import com.google.protobuf.Descriptors.OneofDescriptor; |
||||
import com.google.protobuf.Internal.EnumLite; |
||||
|
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.util.Arrays; |
||||
import java.util.Collections; |
||||
import java.util.HashMap; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* A partial implementation of the {@link Message} interface which implements |
||||
* as many methods of that interface as possible in terms of other methods. |
||||
* |
||||
* @author kenton@google.com Kenton Varda |
||||
*/ |
||||
public abstract class AbstractMessage |
||||
// TODO(dweis): Update GeneratedMessage to parameterize with MessageType and BuilderType.
|
||||
extends AbstractMessageLite |
||||
implements Message { |
||||
|
||||
@Override |
||||
public boolean isInitialized() { |
||||
return MessageReflection.isInitialized(this); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public List<String> findInitializationErrors() { |
||||
return MessageReflection.findMissingFields(this); |
||||
} |
||||
|
||||
@Override |
||||
public String getInitializationErrorString() { |
||||
return MessageReflection.delimitWithCommas(findInitializationErrors()); |
||||
} |
||||
|
||||
/** TODO(jieluo): Clear it when all subclasses have implemented this method. */ |
||||
@Override |
||||
public boolean hasOneof(OneofDescriptor oneof) { |
||||
throw new UnsupportedOperationException("hasOneof() is not implemented."); |
||||
} |
||||
|
||||
/** TODO(jieluo): Clear it when all subclasses have implemented this method. */ |
||||
@Override |
||||
public FieldDescriptor getOneofFieldDescriptor(OneofDescriptor oneof) { |
||||
throw new UnsupportedOperationException( |
||||
"getOneofFieldDescriptor() is not implemented."); |
||||
} |
||||
|
||||
@Override |
||||
public final String toString() { |
||||
return TextFormat.printToString(this); |
||||
} |
||||
|
||||
@Override |
||||
public void writeTo(final CodedOutputStream output) throws IOException { |
||||
MessageReflection.writeMessageTo(this, getAllFields(), output, false); |
||||
} |
||||
|
||||
protected int memoizedSize = -1; |
||||
|
||||
@Override |
||||
public int getSerializedSize() { |
||||
int size = memoizedSize; |
||||
if (size != -1) { |
||||
return size; |
||||
} |
||||
|
||||
memoizedSize = MessageReflection.getSerializedSize(this, getAllFields()); |
||||
return memoizedSize; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(final Object other) { |
||||
if (other == this) { |
||||
return true; |
||||
} |
||||
if (!(other instanceof Message)) { |
||||
return false; |
||||
} |
||||
final Message otherMessage = (Message) other; |
||||
if (getDescriptorForType() != otherMessage.getDescriptorForType()) { |
||||
return false; |
||||
} |
||||
return compareFields(getAllFields(), otherMessage.getAllFields()) && |
||||
getUnknownFields().equals(otherMessage.getUnknownFields()); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
int hash = memoizedHashCode; |
||||
if (hash == 0) { |
||||
hash = 41; |
||||
hash = (19 * hash) + getDescriptorForType().hashCode(); |
||||
hash = hashFields(hash, getAllFields()); |
||||
hash = (29 * hash) + getUnknownFields().hashCode(); |
||||
memoizedHashCode = hash; |
||||
} |
||||
return hash; |
||||
} |
||||
|
||||
private static ByteString toByteString(Object value) { |
||||
if (value instanceof byte[]) { |
||||
return ByteString.copyFrom((byte[]) value); |
||||
} else { |
||||
return (ByteString) value; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Compares two bytes fields. The parameters must be either a byte array or a |
||||
* ByteString object. They can be of different type though. |
||||
*/ |
||||
private static boolean compareBytes(Object a, Object b) { |
||||
if (a instanceof byte[] && b instanceof byte[]) { |
||||
return Arrays.equals((byte[])a, (byte[])b); |
||||
} |
||||
return toByteString(a).equals(toByteString(b)); |
||||
} |
||||
|
||||
/** |
||||
* Converts a list of MapEntry messages into a Map used for equals() and |
||||
* hashCode(). |
||||
*/ |
||||
@SuppressWarnings({"rawtypes", "unchecked"}) |
||||
private static Map convertMapEntryListToMap(List list) { |
||||
if (list.isEmpty()) { |
||||
return Collections.emptyMap(); |
||||
} |
||||
Map result = new HashMap(); |
||||
Iterator iterator = list.iterator(); |
||||
Message entry = (Message) iterator.next(); |
||||
Descriptors.Descriptor descriptor = entry.getDescriptorForType(); |
||||
Descriptors.FieldDescriptor key = descriptor.findFieldByName("key"); |
||||
Descriptors.FieldDescriptor value = descriptor.findFieldByName("value"); |
||||
Object fieldValue = entry.getField(value); |
||||
if (fieldValue instanceof EnumValueDescriptor) { |
||||
fieldValue = ((EnumValueDescriptor) fieldValue).getNumber(); |
||||
} |
||||
result.put(entry.getField(key), fieldValue); |
||||
while (iterator.hasNext()) { |
||||
entry = (Message) iterator.next(); |
||||
fieldValue = entry.getField(value); |
||||
if (fieldValue instanceof EnumValueDescriptor) { |
||||
fieldValue = ((EnumValueDescriptor) fieldValue).getNumber(); |
||||
} |
||||
result.put(entry.getField(key), fieldValue); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
/** |
||||
* Compares two map fields. The parameters must be a list of MapEntry |
||||
* messages. |
||||
*/ |
||||
@SuppressWarnings({"rawtypes", "unchecked"}) |
||||
private static boolean compareMapField(Object a, Object b) { |
||||
Map ma = convertMapEntryListToMap((List) a); |
||||
Map mb = convertMapEntryListToMap((List) b); |
||||
return MapFieldLite.equals(ma, mb); |
||||
} |
||||
|
||||
/** |
||||
* Compares two set of fields. |
||||
* This method is used to implement {@link AbstractMessage#equals(Object)} |
||||
* and {@link AbstractMutableMessage#equals(Object)}. It takes special care |
||||
* of bytes fields because immutable messages and mutable messages use |
||||
* different Java type to reprensent a bytes field and this method should be |
||||
* able to compare immutable messages, mutable messages and also an immutable |
||||
* message to a mutable message. |
||||
*/ |
||||
static boolean compareFields(Map<FieldDescriptor, Object> a, |
||||
Map<FieldDescriptor, Object> b) { |
||||
if (a.size() != b.size()) { |
||||
return false; |
||||
} |
||||
for (FieldDescriptor descriptor : a.keySet()) { |
||||
if (!b.containsKey(descriptor)) { |
||||
return false; |
||||
} |
||||
Object value1 = a.get(descriptor); |
||||
Object value2 = b.get(descriptor); |
||||
if (descriptor.getType() == FieldDescriptor.Type.BYTES) { |
||||
if (descriptor.isRepeated()) { |
||||
List list1 = (List) value1; |
||||
List list2 = (List) value2; |
||||
if (list1.size() != list2.size()) { |
||||
return false; |
||||
} |
||||
for (int i = 0; i < list1.size(); i++) { |
||||
if (!compareBytes(list1.get(i), list2.get(i))) { |
||||
return false; |
||||
} |
||||
} |
||||
} else { |
||||
// Compares a singular bytes field.
|
||||
if (!compareBytes(value1, value2)) { |
||||
return false; |
||||
} |
||||
} |
||||
} else if (descriptor.isMapField()) { |
||||
if (!compareMapField(value1, value2)) { |
||||
return false; |
||||
} |
||||
} else { |
||||
// Compare non-bytes fields.
|
||||
if (!value1.equals(value2)) { |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* Calculates the hash code of a map field. {@code value} must be a list of |
||||
* MapEntry messages. |
||||
*/ |
||||
@SuppressWarnings("unchecked") |
||||
private static int hashMapField(Object value) { |
||||
return MapFieldLite.calculateHashCodeForMap(convertMapEntryListToMap((List) value)); |
||||
} |
||||
|
||||
/** Get a hash code for given fields and values, using the given seed. */ |
||||
@SuppressWarnings("unchecked") |
||||
protected static int hashFields(int hash, Map<FieldDescriptor, Object> map) { |
||||
for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) { |
||||
FieldDescriptor field = entry.getKey(); |
||||
Object value = entry.getValue(); |
||||
hash = (37 * hash) + field.getNumber(); |
||||
if (field.isMapField()) { |
||||
hash = (53 * hash) + hashMapField(value); |
||||
} else if (field.getType() != FieldDescriptor.Type.ENUM){ |
||||
hash = (53 * hash) + value.hashCode(); |
||||
} else if (field.isRepeated()) { |
||||
List<? extends EnumLite> list = (List<? extends EnumLite>) value; |
||||
hash = (53 * hash) + Internal.hashEnumList(list); |
||||
} else { |
||||
hash = (53 * hash) + Internal.hashEnum((EnumLite) value); |
||||
} |
||||
} |
||||
return hash; |
||||
} |
||||
|
||||
/** |
||||
* Package private helper method for AbstractParser to create |
||||
* UninitializedMessageException with missing field information. |
||||
*/ |
||||
@Override |
||||
UninitializedMessageException newUninitializedMessageException() { |
||||
return Builder.newUninitializedMessageException(this); |
||||
} |
||||
|
||||
// =================================================================
|
||||
|
||||
/** |
||||
* A partial implementation of the {@link Message.Builder} interface which |
||||
* implements as many methods of that interface as possible in terms of |
||||
* other methods. |
||||
*/ |
||||
@SuppressWarnings("unchecked") |
||||
public static abstract class Builder<BuilderType extends Builder<BuilderType>> |
||||
extends AbstractMessageLite.Builder |
||||
implements Message.Builder { |
||||
// The compiler produces an error if this is not declared explicitly.
|
||||
@Override |
||||
public abstract BuilderType clone(); |
||||
|
||||
/** TODO(jieluo): Clear it when all subclasses have implemented this method. */ |
||||
@Override |
||||
public boolean hasOneof(OneofDescriptor oneof) { |
||||
throw new UnsupportedOperationException("hasOneof() is not implemented."); |
||||
} |
||||
|
||||
/** TODO(jieluo): Clear it when all subclasses have implemented this method. */ |
||||
@Override |
||||
public FieldDescriptor getOneofFieldDescriptor(OneofDescriptor oneof) { |
||||
throw new UnsupportedOperationException( |
||||
"getOneofFieldDescriptor() is not implemented."); |
||||
} |
||||
|
||||
/** TODO(jieluo): Clear it when all subclasses have implemented this method. */ |
||||
@Override |
||||
public BuilderType clearOneof(OneofDescriptor oneof) { |
||||
throw new UnsupportedOperationException("clearOneof() is not implemented."); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType clear() { |
||||
for (final Map.Entry<FieldDescriptor, Object> entry : |
||||
getAllFields().entrySet()) { |
||||
clearField(entry.getKey()); |
||||
} |
||||
return (BuilderType) this; |
||||
} |
||||
|
||||
@Override |
||||
public List<String> findInitializationErrors() { |
||||
return MessageReflection.findMissingFields(this); |
||||
} |
||||
|
||||
@Override |
||||
public String getInitializationErrorString() { |
||||
return MessageReflection.delimitWithCommas(findInitializationErrors()); |
||||
} |
||||
|
||||
@Override |
||||
protected BuilderType internalMergeFrom(AbstractMessageLite other) { |
||||
return mergeFrom((Message) other); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final Message other) { |
||||
if (other.getDescriptorForType() != getDescriptorForType()) { |
||||
throw new IllegalArgumentException( |
||||
"mergeFrom(Message) can only merge messages of the same type."); |
||||
} |
||||
|
||||
// Note: We don't attempt to verify that other's fields have valid
|
||||
// types. Doing so would be a losing battle. We'd have to verify
|
||||
// all sub-messages as well, and we'd have to make copies of all of
|
||||
// them to insure that they don't change after verification (since
|
||||
// the Message interface itself cannot enforce immutability of
|
||||
// implementations).
|
||||
// TODO(kenton): Provide a function somewhere called makeDeepCopy()
|
||||
// which allows people to make secure deep copies of messages.
|
||||
|
||||
for (final Map.Entry<FieldDescriptor, Object> entry : |
||||
other.getAllFields().entrySet()) { |
||||
final FieldDescriptor field = entry.getKey(); |
||||
if (field.isRepeated()) { |
||||
for (final Object element : (List)entry.getValue()) { |
||||
addRepeatedField(field, element); |
||||
} |
||||
} else if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { |
||||
final Message existingValue = (Message)getField(field); |
||||
if (existingValue == existingValue.getDefaultInstanceForType()) { |
||||
setField(field, entry.getValue()); |
||||
} else { |
||||
setField(field, |
||||
existingValue.newBuilderForType() |
||||
.mergeFrom(existingValue) |
||||
.mergeFrom((Message)entry.getValue()) |
||||
.build()); |
||||
} |
||||
} else { |
||||
setField(field, entry.getValue()); |
||||
} |
||||
} |
||||
|
||||
mergeUnknownFields(other.getUnknownFields()); |
||||
|
||||
return (BuilderType) this; |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final CodedInputStream input) |
||||
throws IOException { |
||||
return mergeFrom(input, ExtensionRegistry.getEmptyRegistry()); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom( |
||||
final CodedInputStream input, |
||||
final ExtensionRegistryLite extensionRegistry) |
||||
throws IOException { |
||||
final UnknownFieldSet.Builder unknownFields = |
||||
UnknownFieldSet.newBuilder(getUnknownFields()); |
||||
while (true) { |
||||
final int tag = input.readTag(); |
||||
if (tag == 0) { |
||||
break; |
||||
} |
||||
|
||||
MessageReflection.BuilderAdapter builderAdapter = |
||||
new MessageReflection.BuilderAdapter(this); |
||||
if (!MessageReflection.mergeFieldFrom(input, unknownFields, |
||||
extensionRegistry, |
||||
getDescriptorForType(), |
||||
builderAdapter, |
||||
tag)) { |
||||
// end group tag
|
||||
break; |
||||
} |
||||
} |
||||
setUnknownFields(unknownFields.build()); |
||||
return (BuilderType) this; |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeUnknownFields(final UnknownFieldSet unknownFields) { |
||||
setUnknownFields( |
||||
UnknownFieldSet.newBuilder(getUnknownFields()) |
||||
.mergeFrom(unknownFields) |
||||
.build()); |
||||
return (BuilderType) this; |
||||
} |
||||
|
||||
@Override |
||||
public Message.Builder getFieldBuilder(final FieldDescriptor field) { |
||||
throw new UnsupportedOperationException( |
||||
"getFieldBuilder() called on an unsupported message type."); |
||||
} |
||||
|
||||
@Override |
||||
public Message.Builder getRepeatedFieldBuilder(final FieldDescriptor field, int index) { |
||||
throw new UnsupportedOperationException( |
||||
"getRepeatedFieldBuilder() called on an unsupported message type."); |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return TextFormat.printToString(this); |
||||
} |
||||
|
||||
/** |
||||
* Construct an UninitializedMessageException reporting missing fields in |
||||
* the given message. |
||||
*/ |
||||
protected static UninitializedMessageException |
||||
newUninitializedMessageException(Message message) { |
||||
return new UninitializedMessageException( |
||||
MessageReflection.findMissingFields(message)); |
||||
} |
||||
|
||||
// ===============================================================
|
||||
// The following definitions seem to be required in order to make javac
|
||||
// not produce weird errors like:
|
||||
//
|
||||
// java/com/google/protobuf/DynamicMessage.java:203: types
|
||||
// com.google.protobuf.AbstractMessage.Builder<
|
||||
// com.google.protobuf.DynamicMessage.Builder> and
|
||||
// com.google.protobuf.AbstractMessage.Builder<
|
||||
// com.google.protobuf.DynamicMessage.Builder> are incompatible; both
|
||||
// define mergeFrom(com.google.protobuf.ByteString), but with unrelated
|
||||
// return types.
|
||||
//
|
||||
// Strangely, these lines are only needed if javac is invoked separately
|
||||
// on AbstractMessage.java and AbstractMessageLite.java. If javac is
|
||||
// invoked on both simultaneously, it works. (Or maybe the important
|
||||
// point is whether or not DynamicMessage.java is compiled together with
|
||||
// AbstractMessageLite.java -- not sure.) I suspect this is a compiler
|
||||
// bug.
|
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final ByteString data) |
||||
throws InvalidProtocolBufferException { |
||||
return (BuilderType) super.mergeFrom(data); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom( |
||||
final ByteString data, |
||||
final ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return (BuilderType) super.mergeFrom(data, extensionRegistry); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final byte[] data) |
||||
throws InvalidProtocolBufferException { |
||||
return (BuilderType) super.mergeFrom(data); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom( |
||||
final byte[] data, final int off, final int len) |
||||
throws InvalidProtocolBufferException { |
||||
return (BuilderType) super.mergeFrom(data, off, len); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom( |
||||
final byte[] data, |
||||
final ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return (BuilderType) super.mergeFrom(data, extensionRegistry); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom( |
||||
final byte[] data, final int off, final int len, |
||||
final ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return (BuilderType) super.mergeFrom(data, off, len, extensionRegistry); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final InputStream input) |
||||
throws IOException { |
||||
return (BuilderType) super.mergeFrom(input); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom( |
||||
final InputStream input, |
||||
final ExtensionRegistryLite extensionRegistry) |
||||
throws IOException { |
||||
return (BuilderType) super.mergeFrom(input, extensionRegistry); |
||||
} |
||||
|
||||
@Override |
||||
public boolean mergeDelimitedFrom(final InputStream input) |
||||
throws IOException { |
||||
return super.mergeDelimitedFrom(input); |
||||
} |
||||
|
||||
@Override |
||||
public boolean mergeDelimitedFrom( |
||||
final InputStream input, |
||||
final ExtensionRegistryLite extensionRegistry) |
||||
throws IOException { |
||||
return super.mergeDelimitedFrom(input, extensionRegistry); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,386 @@ |
||||
// 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.
|
||||
|
||||
package com.google.protobuf; |
||||
|
||||
import java.io.FilterInputStream; |
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.io.OutputStream; |
||||
import java.util.Collection; |
||||
|
||||
/** |
||||
* A partial implementation of the {@link MessageLite} interface which |
||||
* implements as many methods of that interface as possible in terms of other |
||||
* methods. |
||||
* |
||||
* @author kenton@google.com Kenton Varda |
||||
*/ |
||||
public abstract class AbstractMessageLite< |
||||
MessageType extends AbstractMessageLite<MessageType, BuilderType>, |
||||
BuilderType extends AbstractMessageLite.Builder<MessageType, BuilderType>> |
||||
implements MessageLite { |
||||
protected int memoizedHashCode = 0; |
||||
|
||||
@Override |
||||
public ByteString toByteString() { |
||||
try { |
||||
final ByteString.CodedBuilder out = |
||||
ByteString.newCodedBuilder(getSerializedSize()); |
||||
writeTo(out.getCodedOutput()); |
||||
return out.build(); |
||||
} catch (IOException e) { |
||||
throw new RuntimeException( |
||||
"Serializing to a ByteString threw an IOException (should " + |
||||
"never happen).", e); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public byte[] toByteArray() { |
||||
try { |
||||
final byte[] result = new byte[getSerializedSize()]; |
||||
final CodedOutputStream output = CodedOutputStream.newInstance(result); |
||||
writeTo(output); |
||||
output.checkNoSpaceLeft(); |
||||
return result; |
||||
} catch (IOException e) { |
||||
throw new RuntimeException( |
||||
"Serializing to a byte array threw an IOException " + |
||||
"(should never happen).", e); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void writeTo(final OutputStream output) throws IOException { |
||||
final int bufferSize = |
||||
CodedOutputStream.computePreferredBufferSize(getSerializedSize()); |
||||
final CodedOutputStream codedOutput = |
||||
CodedOutputStream.newInstance(output, bufferSize); |
||||
writeTo(codedOutput); |
||||
codedOutput.flush(); |
||||
} |
||||
|
||||
@Override |
||||
public void writeDelimitedTo(final OutputStream output) throws IOException { |
||||
final int serialized = getSerializedSize(); |
||||
final int bufferSize = CodedOutputStream.computePreferredBufferSize( |
||||
CodedOutputStream.computeRawVarint32Size(serialized) + serialized); |
||||
final CodedOutputStream codedOutput = |
||||
CodedOutputStream.newInstance(output, bufferSize); |
||||
codedOutput.writeRawVarint32(serialized); |
||||
writeTo(codedOutput); |
||||
codedOutput.flush(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Package private helper method for AbstractParser to create |
||||
* UninitializedMessageException. |
||||
*/ |
||||
UninitializedMessageException newUninitializedMessageException() { |
||||
return new UninitializedMessageException(this); |
||||
} |
||||
|
||||
protected static void checkByteStringIsUtf8(ByteString byteString) |
||||
throws IllegalArgumentException { |
||||
if (!byteString.isValidUtf8()) { |
||||
throw new IllegalArgumentException("Byte string is not UTF-8."); |
||||
} |
||||
} |
||||
|
||||
protected static <T> void addAll(final Iterable<T> values, |
||||
final Collection<? super T> list) { |
||||
Builder.addAll(values, list); |
||||
} |
||||
|
||||
/** |
||||
* A partial implementation of the {@link Message.Builder} interface which |
||||
* implements as many methods of that interface as possible in terms of |
||||
* other methods. |
||||
*/ |
||||
@SuppressWarnings("unchecked") |
||||
public abstract static class Builder< |
||||
MessageType extends AbstractMessageLite<MessageType, BuilderType>, |
||||
BuilderType extends Builder<MessageType, BuilderType>> |
||||
implements MessageLite.Builder { |
||||
// The compiler produces an error if this is not declared explicitly.
|
||||
@Override |
||||
public abstract BuilderType clone(); |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final CodedInputStream input) throws IOException { |
||||
return mergeFrom(input, ExtensionRegistryLite.getEmptyRegistry()); |
||||
} |
||||
|
||||
// Re-defined here for return type covariance.
|
||||
@Override |
||||
public abstract BuilderType mergeFrom( |
||||
final CodedInputStream input, final ExtensionRegistryLite extensionRegistry) |
||||
throws IOException; |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final ByteString data) throws InvalidProtocolBufferException { |
||||
try { |
||||
final CodedInputStream input = data.newCodedInput(); |
||||
mergeFrom(input); |
||||
input.checkLastTagWas(0); |
||||
return (BuilderType) this; |
||||
} catch (InvalidProtocolBufferException e) { |
||||
throw e; |
||||
} catch (IOException e) { |
||||
throw new RuntimeException( |
||||
"Reading from a ByteString threw an IOException (should " + |
||||
"never happen).", e); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom( |
||||
final ByteString data, final ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
try { |
||||
final CodedInputStream input = data.newCodedInput(); |
||||
mergeFrom(input, extensionRegistry); |
||||
input.checkLastTagWas(0); |
||||
return (BuilderType) this; |
||||
} catch (InvalidProtocolBufferException e) { |
||||
throw e; |
||||
} catch (IOException e) { |
||||
throw new RuntimeException( |
||||
"Reading from a ByteString threw an IOException (should " + |
||||
"never happen).", e); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final byte[] data) throws InvalidProtocolBufferException { |
||||
return mergeFrom(data, 0, data.length); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final byte[] data, final int off, final int len) |
||||
throws InvalidProtocolBufferException { |
||||
try { |
||||
final CodedInputStream input = |
||||
CodedInputStream.newInstance(data, off, len); |
||||
mergeFrom(input); |
||||
input.checkLastTagWas(0); |
||||
return (BuilderType) this; |
||||
} catch (InvalidProtocolBufferException e) { |
||||
throw e; |
||||
} catch (IOException e) { |
||||
throw new RuntimeException( |
||||
"Reading from a byte array threw an IOException (should " + |
||||
"never happen).", e); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final byte[] data, final ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return mergeFrom(data, 0, data.length, extensionRegistry); |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom( |
||||
final byte[] data, |
||||
final int off, |
||||
final int len, |
||||
final ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
try { |
||||
final CodedInputStream input = |
||||
CodedInputStream.newInstance(data, off, len); |
||||
mergeFrom(input, extensionRegistry); |
||||
input.checkLastTagWas(0); |
||||
return (BuilderType) this; |
||||
} catch (InvalidProtocolBufferException e) { |
||||
throw e; |
||||
} catch (IOException e) { |
||||
throw new RuntimeException( |
||||
"Reading from a byte array threw an IOException (should " + |
||||
"never happen).", e); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom(final InputStream input) throws IOException { |
||||
final CodedInputStream codedInput = CodedInputStream.newInstance(input); |
||||
mergeFrom(codedInput); |
||||
codedInput.checkLastTagWas(0); |
||||
return (BuilderType) this; |
||||
} |
||||
|
||||
@Override |
||||
public BuilderType mergeFrom( |
||||
final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException { |
||||
final CodedInputStream codedInput = CodedInputStream.newInstance(input); |
||||
mergeFrom(codedInput, extensionRegistry); |
||||
codedInput.checkLastTagWas(0); |
||||
return (BuilderType) this; |
||||
} |
||||
|
||||
/** |
||||
* An InputStream implementations which reads from some other InputStream |
||||
* but is limited to a particular number of bytes. Used by |
||||
* mergeDelimitedFrom(). This is intentionally package-private so that |
||||
* UnknownFieldSet can share it. |
||||
*/ |
||||
static final class LimitedInputStream extends FilterInputStream { |
||||
private int limit; |
||||
|
||||
LimitedInputStream(InputStream in, int limit) { |
||||
super(in); |
||||
this.limit = limit; |
||||
} |
||||
|
||||
@Override |
||||
public int available() throws IOException { |
||||
return Math.min(super.available(), limit); |
||||
} |
||||
|
||||
@Override |
||||
public int read() throws IOException { |
||||
if (limit <= 0) { |
||||
return -1; |
||||
} |
||||
final int result = super.read(); |
||||
if (result >= 0) { |
||||
--limit; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public int read(final byte[] b, final int off, int len) |
||||
throws IOException { |
||||
if (limit <= 0) { |
||||
return -1; |
||||
} |
||||
len = Math.min(len, limit); |
||||
final int result = super.read(b, off, len); |
||||
if (result >= 0) { |
||||
limit -= result; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public long skip(final long n) throws IOException { |
||||
final long result = super.skip(Math.min(n, limit)); |
||||
if (result >= 0) { |
||||
limit -= result; |
||||
} |
||||
return result; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean mergeDelimitedFrom( |
||||
final InputStream input, final ExtensionRegistryLite extensionRegistry) throws IOException { |
||||
final int firstByte = input.read(); |
||||
if (firstByte == -1) { |
||||
return false; |
||||
} |
||||
final int size = CodedInputStream.readRawVarint32(firstByte, input); |
||||
final InputStream limitedInput = new LimitedInputStream(input, size); |
||||
mergeFrom(limitedInput, extensionRegistry); |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public boolean mergeDelimitedFrom(final InputStream input) throws IOException { |
||||
return mergeDelimitedFrom(input, |
||||
ExtensionRegistryLite.getEmptyRegistry()); |
||||
} |
||||
|
||||
@Override |
||||
@SuppressWarnings("unchecked") // isInstance takes care of this
|
||||
public BuilderType mergeFrom(final MessageLite other) { |
||||
if (!getDefaultInstanceForType().getClass().isInstance(other)) { |
||||
throw new IllegalArgumentException( |
||||
"mergeFrom(MessageLite) can only merge messages of the same type."); |
||||
} |
||||
|
||||
return internalMergeFrom((MessageType) other); |
||||
} |
||||
|
||||
protected abstract BuilderType internalMergeFrom(MessageType message); |
||||
|
||||
/** |
||||
* Construct an UninitializedMessageException reporting missing fields in |
||||
* the given message. |
||||
*/ |
||||
protected static UninitializedMessageException |
||||
newUninitializedMessageException(MessageLite message) { |
||||
return new UninitializedMessageException(message); |
||||
} |
||||
|
||||
/** |
||||
* Adds the {@code values} to the {@code list}. This is a helper method |
||||
* used by generated code. Users should ignore it. |
||||
* |
||||
* @throws NullPointerException if {@code values} or any of the elements of |
||||
* {@code values} is null. When that happens, some elements of |
||||
* {@code values} may have already been added to the result {@code list}. |
||||
*/ |
||||
protected static <T> void addAll(final Iterable<T> values, |
||||
final Collection<? super T> list) { |
||||
if (values == null) { |
||||
throw new NullPointerException(); |
||||
} |
||||
if (values instanceof LazyStringList) { |
||||
// For StringOrByteStringLists, check the underlying elements to avoid
|
||||
// forcing conversions of ByteStrings to Strings.
|
||||
checkForNullValues(((LazyStringList) values).getUnderlyingElements()); |
||||
list.addAll((Collection<T>) values); |
||||
} else if (values instanceof Collection) { |
||||
checkForNullValues(values); |
||||
list.addAll((Collection<T>) values); |
||||
} else { |
||||
for (final T value : values) { |
||||
if (value == null) { |
||||
throw new NullPointerException(); |
||||
} |
||||
list.add(value); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private static void checkForNullValues(final Iterable<?> values) { |
||||
for (final Object value : values) { |
||||
if (value == null) { |
||||
throw new NullPointerException(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,258 @@ |
||||
// 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.
|
||||
|
||||
package com.google.protobuf; |
||||
|
||||
import com.google.protobuf.AbstractMessageLite.Builder.LimitedInputStream; |
||||
|
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
|
||||
/** |
||||
* A partial implementation of the {@link Parser} interface which implements |
||||
* as many methods of that interface as possible in terms of other methods. |
||||
* |
||||
* Note: This class implements all the convenience methods in the |
||||
* {@link Parser} interface. See {@link Parser} for related javadocs. |
||||
* Subclasses need to implement |
||||
* {@link Parser#parsePartialFrom(CodedInputStream, ExtensionRegistryLite)} |
||||
* |
||||
* @author liujisi@google.com (Pherl Liu) |
||||
*/ |
||||
public abstract class AbstractParser<MessageType extends MessageLite> |
||||
implements Parser<MessageType> { |
||||
/** |
||||
* Creates an UninitializedMessageException for MessageType. |
||||
*/ |
||||
private UninitializedMessageException |
||||
newUninitializedMessageException(MessageType message) { |
||||
if (message instanceof AbstractMessageLite) { |
||||
return ((AbstractMessageLite) message).newUninitializedMessageException(); |
||||
} |
||||
return new UninitializedMessageException(message); |
||||
} |
||||
|
||||
/** |
||||
* Helper method to check if message is initialized. |
||||
* |
||||
* @throws InvalidProtocolBufferException if it is not initialized. |
||||
* @return The message to check. |
||||
*/ |
||||
private MessageType checkMessageInitialized(MessageType message) |
||||
throws InvalidProtocolBufferException { |
||||
if (message != null && !message.isInitialized()) { |
||||
throw newUninitializedMessageException(message) |
||||
.asInvalidProtocolBufferException() |
||||
.setUnfinishedMessage(message); |
||||
} |
||||
return message; |
||||
} |
||||
|
||||
private static final ExtensionRegistryLite EMPTY_REGISTRY |
||||
= ExtensionRegistryLite.getEmptyRegistry(); |
||||
|
||||
@Override |
||||
public MessageType parsePartialFrom(CodedInputStream input) |
||||
throws InvalidProtocolBufferException { |
||||
return parsePartialFrom(input, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return checkMessageInitialized( |
||||
parsePartialFrom(input, extensionRegistry)); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom(CodedInputStream input) throws InvalidProtocolBufferException { |
||||
return parseFrom(input, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialFrom(ByteString data, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
MessageType message; |
||||
try { |
||||
CodedInputStream input = data.newCodedInput(); |
||||
message = parsePartialFrom(input, extensionRegistry); |
||||
try { |
||||
input.checkLastTagWas(0); |
||||
} catch (InvalidProtocolBufferException e) { |
||||
throw e.setUnfinishedMessage(message); |
||||
} |
||||
return message; |
||||
} catch (InvalidProtocolBufferException e) { |
||||
throw e; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialFrom(ByteString data) throws InvalidProtocolBufferException { |
||||
return parsePartialFrom(data, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return checkMessageInitialized(parsePartialFrom(data, extensionRegistry)); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom(ByteString data) throws InvalidProtocolBufferException { |
||||
return parseFrom(data, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialFrom( |
||||
byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
try { |
||||
CodedInputStream input = CodedInputStream.newInstance(data, off, len); |
||||
MessageType message = parsePartialFrom(input, extensionRegistry); |
||||
try { |
||||
input.checkLastTagWas(0); |
||||
} catch (InvalidProtocolBufferException e) { |
||||
throw e.setUnfinishedMessage(message); |
||||
} |
||||
return message; |
||||
} catch (InvalidProtocolBufferException e) { |
||||
throw e; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialFrom(byte[] data, int off, int len) |
||||
throws InvalidProtocolBufferException { |
||||
return parsePartialFrom(data, off, len, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialFrom(byte[] data, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return parsePartialFrom(data, 0, data.length, extensionRegistry); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialFrom(byte[] data) throws InvalidProtocolBufferException { |
||||
return parsePartialFrom(data, 0, data.length, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom( |
||||
byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return checkMessageInitialized( |
||||
parsePartialFrom(data, off, len, extensionRegistry)); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom(byte[] data, int off, int len) |
||||
throws InvalidProtocolBufferException { |
||||
return parseFrom(data, off, len, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return parseFrom(data, 0, data.length, extensionRegistry); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom(byte[] data) throws InvalidProtocolBufferException { |
||||
return parseFrom(data, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialFrom(InputStream input, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
CodedInputStream codedInput = CodedInputStream.newInstance(input); |
||||
MessageType message = parsePartialFrom(codedInput, extensionRegistry); |
||||
try { |
||||
codedInput.checkLastTagWas(0); |
||||
} catch (InvalidProtocolBufferException e) { |
||||
throw e.setUnfinishedMessage(message); |
||||
} |
||||
return message; |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialFrom(InputStream input) throws InvalidProtocolBufferException { |
||||
return parsePartialFrom(input, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return checkMessageInitialized( |
||||
parsePartialFrom(input, extensionRegistry)); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseFrom(InputStream input) throws InvalidProtocolBufferException { |
||||
return parseFrom(input, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialDelimitedFrom( |
||||
InputStream input, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
int size; |
||||
try { |
||||
int firstByte = input.read(); |
||||
if (firstByte == -1) { |
||||
return null; |
||||
} |
||||
size = CodedInputStream.readRawVarint32(firstByte, input); |
||||
} catch (IOException e) { |
||||
throw new InvalidProtocolBufferException(e.getMessage()); |
||||
} |
||||
InputStream limitedInput = new LimitedInputStream(input, size); |
||||
return parsePartialFrom(limitedInput, extensionRegistry); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parsePartialDelimitedFrom(InputStream input) |
||||
throws InvalidProtocolBufferException { |
||||
return parsePartialDelimitedFrom(input, EMPTY_REGISTRY); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) |
||||
throws InvalidProtocolBufferException { |
||||
return checkMessageInitialized( |
||||
parsePartialDelimitedFrom(input, extensionRegistry)); |
||||
} |
||||
|
||||
@Override |
||||
public MessageType parseDelimitedFrom(InputStream input) throws InvalidProtocolBufferException { |
||||
return parseDelimitedFrom(input, EMPTY_REGISTRY); |
||||
} |
||||
} |
@ -0,0 +1,180 @@ |
||||
// 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.
|
||||
|
||||
package com.google.protobuf; |
||||
|
||||
import com.google.protobuf.Internal.ProtobufList; |
||||
|
||||
import java.util.AbstractList; |
||||
import java.util.Collection; |
||||
import java.util.List; |
||||
import java.util.RandomAccess; |
||||
|
||||
/** |
||||
* An abstract implementation of {@link ProtobufList} which manages mutability semantics. All mutate |
||||
* methods must check if the list is mutable before proceeding. Subclasses must invoke |
||||
* {@link #ensureIsMutable()} manually when overriding those methods. |
||||
* <p> |
||||
* This implementation assumes all subclasses are array based, supporting random access. |
||||
*/ |
||||
abstract class AbstractProtobufList<E> extends AbstractList<E> implements ProtobufList<E> { |
||||
|
||||
protected static final int DEFAULT_CAPACITY = 10; |
||||
|
||||
/** |
||||
* Whether or not this list is modifiable. |
||||
*/ |
||||
private boolean isMutable; |
||||
|
||||
/** |
||||
* Constructs a mutable list by default. |
||||
*/ |
||||
AbstractProtobufList() { |
||||
isMutable = true; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object o) { |
||||
if (o == this) { |
||||
return true; |
||||
} |
||||
if (!(o instanceof List)) { |
||||
return false; |
||||
} |
||||
// Handle lists that do not support RandomAccess as efficiently as possible by using an iterator
|
||||
// based approach in our super class. Otherwise our index based approach will avoid those
|
||||
// allocations.
|
||||
if (!(o instanceof RandomAccess)) { |
||||
return super.equals(o); |
||||
} |
||||
|
||||
List<?> other = (List<?>) o; |
||||
final int size = size(); |
||||
if (size != other.size()) { |
||||
return false; |
||||
} |
||||
for (int i = 0; i < size; i++) { |
||||
if (!get(i).equals(other.get(i))) { |
||||
return false; |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int size = size(); |
||||
int hashCode = 1; |
||||
for (int i = 0; i < size; i++) { |
||||
hashCode = (31 * hashCode) + get(i).hashCode(); |
||||
} |
||||
return hashCode; |
||||
} |
||||
|
||||
@Override |
||||
public boolean add(E e) { |
||||
ensureIsMutable(); |
||||
return super.add(e); |
||||
} |
||||
|
||||
@Override |
||||
public void add(int index, E element) { |
||||
ensureIsMutable(); |
||||
super.add(index, element); |
||||
} |
||||
|
||||
@Override |
||||
public boolean addAll(Collection<? extends E> c) { |
||||
ensureIsMutable(); |
||||
return super.addAll(c); |
||||
} |
||||
|
||||
@Override |
||||
public boolean addAll(int index, Collection<? extends E> c) { |
||||
ensureIsMutable(); |
||||
return super.addAll(index, c); |
||||
} |
||||
|
||||
@Override |
||||
public void clear() { |
||||
ensureIsMutable(); |
||||
super.clear(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isModifiable() { |
||||
return isMutable; |
||||
} |
||||
|
||||
@Override |
||||
public final void makeImmutable() { |
||||
isMutable = false; |
||||
} |
||||
|
||||
@Override |
||||
public E remove(int index) { |
||||
ensureIsMutable(); |
||||
return super.remove(index); |
||||
} |
||||
|
||||
@Override |
||||
public boolean remove(Object o) { |
||||
ensureIsMutable(); |
||||
return super.remove(o); |
||||
} |
||||
|
||||
@Override |
||||
public boolean removeAll(Collection<?> c) { |
||||
ensureIsMutable(); |
||||
return super.removeAll(c); |
||||
} |
||||
|
||||
@Override |
||||
public boolean retainAll(Collection<?> c) { |
||||
ensureIsMutable(); |
||||
return super.retainAll(c); |
||||
} |
||||
|
||||
@Override |
||||
public E set(int index, E element) { |
||||
ensureIsMutable(); |
||||
return super.set(index, element); |
||||
} |
||||
|
||||
/** |
||||
* Throws an {@link UnsupportedOperationException} if the list is immutable. Subclasses are |
||||
* responsible for invoking this method on mutate operations. |
||||
*/ |
||||
protected void ensureIsMutable() { |
||||
if (!isMutable) { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,51 @@ |
||||
// 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.
|
||||
|
||||
package com.google.protobuf; |
||||
|
||||
/** |
||||
* <p>Abstract interface for a blocking RPC channel. {@code BlockingRpcChannel} |
||||
* is the blocking equivalent to {@link RpcChannel}. |
||||
* |
||||
* @author kenton@google.com Kenton Varda |
||||
* @author cpovirk@google.com Chris Povirk |
||||
*/ |
||||
public interface BlockingRpcChannel { |
||||
/** |
||||
* Call the given method of the remote service and blocks until it returns. |
||||
* {@code callBlockingMethod()} is the blocking equivalent to |
||||
* {@link RpcChannel#callMethod}. |
||||
*/ |
||||
Message callBlockingMethod( |
||||
Descriptors.MethodDescriptor method, |
||||
RpcController controller, |
||||
Message request, |
||||
Message responsePrototype) throws ServiceException; |
||||
} |
@ -0,0 +1,64 @@ |
||||
// 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.
|
||||
|
||||
package com.google.protobuf; |
||||
|
||||
/** |
||||
* Blocking equivalent to {@link Service}. |
||||
* |
||||
* @author kenton@google.com Kenton Varda |
||||
* @author cpovirk@google.com Chris Povirk |
||||
*/ |
||||
public interface BlockingService { |
||||
/** |
||||
* Equivalent to {@link Service#getDescriptorForType}. |
||||
*/ |
||||
Descriptors.ServiceDescriptor getDescriptorForType(); |
||||
|
||||
/** |
||||
* Equivalent to {@link Service#callMethod}, except that |
||||
* {@code callBlockingMethod()} returns the result of the RPC or throws a |
||||
* {@link ServiceException} if there is a failure, rather than passing the |
||||
* information to a callback. |
||||
*/ |
||||
Message callBlockingMethod(Descriptors.MethodDescriptor method, |
||||
RpcController controller, |
||||
Message request) throws ServiceException; |
||||
|
||||
/** |
||||
* Equivalent to {@link Service#getRequestPrototype}. |
||||
*/ |
||||
Message getRequestPrototype(Descriptors.MethodDescriptor method); |
||||
|
||||
/** |
||||
* Equivalent to {@link Service#getResponsePrototype}. |
||||
*/ |
||||
Message getResponsePrototype(Descriptors.MethodDescriptor method); |
||||
} |
@ -0,0 +1,134 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/any.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - GPBAnyRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBAnyRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBAny |
||||
|
||||
typedef GPB_ENUM(GPBAny_FieldNumber) { |
||||
GPBAny_FieldNumber_TypeURL = 1, |
||||
GPBAny_FieldNumber_Value = 2, |
||||
}; |
||||
|
||||
/// `Any` contains an arbitrary serialized protocol buffer message along with a
|
||||
/// URL that describes the type of the serialized message.
|
||||
///
|
||||
/// Protobuf library provides support to pack/unpack Any values in the form
|
||||
/// of utility functions or additional generated methods of the Any type.
|
||||
///
|
||||
/// Example 1: Pack and unpack a message in C++.
|
||||
///
|
||||
/// Foo foo = ...;
|
||||
/// Any any;
|
||||
/// any.PackFrom(foo);
|
||||
/// ...
|
||||
/// if (any.UnpackTo(&foo)) {
|
||||
/// ...
|
||||
/// }
|
||||
///
|
||||
/// Example 2: Pack and unpack a message in Java.
|
||||
///
|
||||
/// Foo foo = ...;
|
||||
/// Any any = Any.pack(foo);
|
||||
/// ...
|
||||
/// if (any.is(Foo.class)) {
|
||||
/// foo = any.unpack(Foo.class);
|
||||
/// }
|
||||
///
|
||||
/// The pack methods provided by protobuf library will by default use
|
||||
/// 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
||||
/// methods only use the fully qualified type name after the last '/'
|
||||
/// in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
||||
/// name "y.z".
|
||||
///
|
||||
///
|
||||
/// JSON
|
||||
/// ====
|
||||
/// The JSON representation of an `Any` value uses the regular
|
||||
/// representation of the deserialized, embedded message, with an
|
||||
/// additional field `\@type` which contains the type URL. Example:
|
||||
///
|
||||
/// package google.profile;
|
||||
/// message Person {
|
||||
/// string first_name = 1;
|
||||
/// string last_name = 2;
|
||||
/// }
|
||||
///
|
||||
/// {
|
||||
/// "\@type": "type.googleapis.com/google.profile.Person",
|
||||
/// "firstName": <string>,
|
||||
/// "lastName": <string>
|
||||
/// }
|
||||
///
|
||||
/// If the embedded message type is well-known and has a custom JSON
|
||||
/// representation, that representation will be embedded adding a field
|
||||
/// `value` which holds the custom JSON in addition to the `\@type`
|
||||
/// field. Example (for message [google.protobuf.Duration][]):
|
||||
///
|
||||
/// {
|
||||
/// "\@type": "type.googleapis.com/google.protobuf.Duration",
|
||||
/// "value": "1.212s"
|
||||
/// }
|
||||
@interface GPBAny : GPBMessage |
||||
|
||||
/// A URL/resource name whose content describes the type of the
|
||||
/// serialized protocol buffer message.
|
||||
///
|
||||
/// For URLs which use the schema `http`, `https`, or no schema, the
|
||||
/// following restrictions and interpretations apply:
|
||||
///
|
||||
/// * If no schema is provided, `https` is assumed.
|
||||
/// * The last segment of the URL's path must represent the fully
|
||||
/// qualified name of the type (as in `path/google.protobuf.Duration`).
|
||||
/// The name should be in a canonical form (e.g., leading "." is
|
||||
/// not accepted).
|
||||
/// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
||||
/// value in binary format, or produce an error.
|
||||
/// * Applications are allowed to cache lookup results based on the
|
||||
/// URL, or have them precompiled into a binary to avoid any
|
||||
/// lookup. Therefore, binary compatibility needs to be preserved
|
||||
/// on changes to types. (Use versioned type names to manage
|
||||
/// breaking changes.)
|
||||
///
|
||||
/// Schemas other than `http`, `https` (or the empty schema) might be
|
||||
/// used with implementation specific semantics.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *typeURL; |
||||
|
||||
/// Must be a valid serialized protocol buffer of the above specified type.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSData *value; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,93 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/any.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/Any.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBAnyRoot |
||||
|
||||
@implementation GPBAnyRoot |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBAnyRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBAnyRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - GPBAny |
||||
|
||||
@implementation GPBAny |
||||
|
||||
@dynamic typeURL; |
||||
@dynamic value; |
||||
|
||||
typedef struct GPBAny__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
NSString *typeURL; |
||||
NSData *value; |
||||
} GPBAny__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "typeURL", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBAny_FieldNumber_TypeURL, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBAny__storage_, typeURL), |
||||
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBAny_FieldNumber_Value, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBAny__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeBytes, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBAny class] |
||||
rootClass:[GPBAnyRoot class] |
||||
file:GPBAnyRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBAny__storage_) |
||||
flags:0]; |
||||
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS |
||||
static const char *extraTextFormatInfo = |
||||
"\001\001\004\241!!\000"; |
||||
[localDescriptor setupExtraTextInfo:extraTextFormatInfo]; |
||||
#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,262 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/api.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
@class GPBMethod; |
||||
@class GPBMixin; |
||||
@class GPBOption; |
||||
@class GPBSourceContext; |
||||
GPB_ENUM_FWD_DECLARE(GPBSyntax); |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - GPBApiRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBApiRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBApi |
||||
|
||||
typedef GPB_ENUM(GPBApi_FieldNumber) { |
||||
GPBApi_FieldNumber_Name = 1, |
||||
GPBApi_FieldNumber_MethodsArray = 2, |
||||
GPBApi_FieldNumber_OptionsArray = 3, |
||||
GPBApi_FieldNumber_Version = 4, |
||||
GPBApi_FieldNumber_SourceContext = 5, |
||||
GPBApi_FieldNumber_MixinsArray = 6, |
||||
GPBApi_FieldNumber_Syntax = 7, |
||||
}; |
||||
|
||||
/// Api is a light-weight descriptor for a protocol buffer service.
|
||||
@interface GPBApi : GPBMessage |
||||
|
||||
/// The fully qualified name of this api, including package name
|
||||
/// followed by the api's simple name.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *name; |
||||
|
||||
/// The methods of this api, in unspecified order.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBMethod*> *methodsArray; |
||||
/// The number of items in @c methodsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger methodsArray_Count; |
||||
|
||||
/// Any metadata attached to the API.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBOption*> *optionsArray; |
||||
/// The number of items in @c optionsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger optionsArray_Count; |
||||
|
||||
/// A version string for this api. If specified, must have the form
|
||||
/// `major-version.minor-version`, as in `1.10`. If the minor version
|
||||
/// is omitted, it defaults to zero. If the entire version field is
|
||||
/// empty, the major version is derived from the package name, as
|
||||
/// outlined below. If the field is not empty, the version in the
|
||||
/// package name will be verified to be consistent with what is
|
||||
/// provided here.
|
||||
///
|
||||
/// The versioning schema uses [semantic
|
||||
/// versioning](http://semver.org) where the major version number
|
||||
/// indicates a breaking change and the minor version an additive,
|
||||
/// non-breaking change. Both version numbers are signals to users
|
||||
/// what to expect from different versions, and should be carefully
|
||||
/// chosen based on the product plan.
|
||||
///
|
||||
/// The major version is also reflected in the package name of the
|
||||
/// API, which must end in `v<major-version>`, as in
|
||||
/// `google.feature.v1`. For major versions 0 and 1, the suffix can
|
||||
/// be omitted. Zero major versions must only be used for
|
||||
/// experimental, none-GA apis.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *version; |
||||
|
||||
/// Source context for the protocol buffer service represented by this
|
||||
/// message.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) GPBSourceContext *sourceContext; |
||||
/// Test to see if @c sourceContext has been set.
|
||||
@property(nonatomic, readwrite) BOOL hasSourceContext; |
||||
|
||||
/// Included APIs. See [Mixin][].
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBMixin*> *mixinsArray; |
||||
/// The number of items in @c mixinsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger mixinsArray_Count; |
||||
|
||||
/// The source syntax of the service.
|
||||
@property(nonatomic, readwrite) enum GPBSyntax syntax; |
||||
|
||||
@end |
||||
|
||||
/// Fetches the raw value of a @c GPBApi's @c syntax property, even
|
||||
/// if the value was not defined by the enum at the time the code was generated.
|
||||
int32_t GPBApi_Syntax_RawValue(GPBApi *message); |
||||
/// Sets the raw value of an @c GPBApi's @c syntax property, allowing
|
||||
/// it to be set to a value that was not defined by the enum at the time the code
|
||||
/// was generated.
|
||||
void SetGPBApi_Syntax_RawValue(GPBApi *message, int32_t value); |
||||
|
||||
#pragma mark - GPBMethod |
||||
|
||||
typedef GPB_ENUM(GPBMethod_FieldNumber) { |
||||
GPBMethod_FieldNumber_Name = 1, |
||||
GPBMethod_FieldNumber_RequestTypeURL = 2, |
||||
GPBMethod_FieldNumber_RequestStreaming = 3, |
||||
GPBMethod_FieldNumber_ResponseTypeURL = 4, |
||||
GPBMethod_FieldNumber_ResponseStreaming = 5, |
||||
GPBMethod_FieldNumber_OptionsArray = 6, |
||||
GPBMethod_FieldNumber_Syntax = 7, |
||||
}; |
||||
|
||||
/// Method represents a method of an api.
|
||||
@interface GPBMethod : GPBMessage |
||||
|
||||
/// The simple name of this method.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *name; |
||||
|
||||
/// A URL of the input message type.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *requestTypeURL; |
||||
|
||||
/// If true, the request is streamed.
|
||||
@property(nonatomic, readwrite) BOOL requestStreaming; |
||||
|
||||
/// The URL of the output message type.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *responseTypeURL; |
||||
|
||||
/// If true, the response is streamed.
|
||||
@property(nonatomic, readwrite) BOOL responseStreaming; |
||||
|
||||
/// Any metadata attached to the method.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBOption*> *optionsArray; |
||||
/// The number of items in @c optionsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger optionsArray_Count; |
||||
|
||||
/// The source syntax of this method.
|
||||
@property(nonatomic, readwrite) enum GPBSyntax syntax; |
||||
|
||||
@end |
||||
|
||||
/// Fetches the raw value of a @c GPBMethod's @c syntax property, even
|
||||
/// if the value was not defined by the enum at the time the code was generated.
|
||||
int32_t GPBMethod_Syntax_RawValue(GPBMethod *message); |
||||
/// Sets the raw value of an @c GPBMethod's @c syntax property, allowing
|
||||
/// it to be set to a value that was not defined by the enum at the time the code
|
||||
/// was generated.
|
||||
void SetGPBMethod_Syntax_RawValue(GPBMethod *message, int32_t value); |
||||
|
||||
#pragma mark - GPBMixin |
||||
|
||||
typedef GPB_ENUM(GPBMixin_FieldNumber) { |
||||
GPBMixin_FieldNumber_Name = 1, |
||||
GPBMixin_FieldNumber_Root = 2, |
||||
}; |
||||
|
||||
/// Declares an API to be included in this API. The including API must
|
||||
/// redeclare all the methods from the included API, but documentation
|
||||
/// and options are inherited as follows:
|
||||
///
|
||||
/// - If after comment and whitespace stripping, the documentation
|
||||
/// string of the redeclared method is empty, it will be inherited
|
||||
/// from the original method.
|
||||
///
|
||||
/// - Each annotation belonging to the service config (http,
|
||||
/// visibility) which is not set in the redeclared method will be
|
||||
/// inherited.
|
||||
///
|
||||
/// - If an http annotation is inherited, the path pattern will be
|
||||
/// modified as follows. Any version prefix will be replaced by the
|
||||
/// version of the including API plus the [root][] path if specified.
|
||||
///
|
||||
/// Example of a simple mixin:
|
||||
///
|
||||
/// package google.acl.v1;
|
||||
/// service AccessControl {
|
||||
/// // Get the underlying ACL object.
|
||||
/// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
/// option (google.api.http).get = "/v1/{resource=**}:getAcl";
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// package google.storage.v2;
|
||||
/// service Storage {
|
||||
/// rpc GetAcl(GetAclRequest) returns (Acl);
|
||||
///
|
||||
/// // Get a data record.
|
||||
/// rpc GetData(GetDataRequest) returns (Data) {
|
||||
/// option (google.api.http).get = "/v2/{resource=**}";
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// Example of a mixin configuration:
|
||||
///
|
||||
/// apis:
|
||||
/// - name: google.storage.v2.Storage
|
||||
/// mixins:
|
||||
/// - name: google.acl.v1.AccessControl
|
||||
///
|
||||
/// The mixin construct implies that all methods in `AccessControl` are
|
||||
/// also declared with same name and request/response types in
|
||||
/// `Storage`. A documentation generator or annotation processor will
|
||||
/// see the effective `Storage.GetAcl` method after inherting
|
||||
/// documentation and annotations as follows:
|
||||
///
|
||||
/// service Storage {
|
||||
/// // Get the underlying ACL object.
|
||||
/// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
/// option (google.api.http).get = "/v2/{resource=**}:getAcl";
|
||||
/// }
|
||||
/// ...
|
||||
/// }
|
||||
///
|
||||
/// Note how the version in the path pattern changed from `v1` to `v2`.
|
||||
///
|
||||
/// If the `root` field in the mixin is specified, it should be a
|
||||
/// relative path under which inherited HTTP paths are placed. Example:
|
||||
///
|
||||
/// apis:
|
||||
/// - name: google.storage.v2.Storage
|
||||
/// mixins:
|
||||
/// - name: google.acl.v1.AccessControl
|
||||
/// root: acls
|
||||
///
|
||||
/// This implies the following inherited HTTP annotation:
|
||||
///
|
||||
/// service Storage {
|
||||
/// // Get the underlying ACL object.
|
||||
/// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
/// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
|
||||
/// }
|
||||
/// ...
|
||||
/// }
|
||||
@interface GPBMixin : GPBMessage |
||||
|
||||
/// The fully qualified name of the API which is included.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *name; |
||||
|
||||
/// If non-empty specifies a path under which inherited HTTP paths
|
||||
/// are rooted.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *root; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,348 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/api.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/Api.pbobjc.h" |
||||
#import "google/protobuf/SourceContext.pbobjc.h" |
||||
#import "google/protobuf/Type.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBApiRoot |
||||
|
||||
@implementation GPBApiRoot |
||||
|
||||
+ (GPBExtensionRegistry*)extensionRegistry { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety and initialization of registry. |
||||
static GPBExtensionRegistry* registry = nil; |
||||
if (!registry) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
registry = [[GPBExtensionRegistry alloc] init]; |
||||
[registry addExtensions:[GPBSourceContextRoot extensionRegistry]]; |
||||
[registry addExtensions:[GPBTypeRoot extensionRegistry]]; |
||||
} |
||||
return registry; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBApiRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBApiRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - GPBApi |
||||
|
||||
@implementation GPBApi |
||||
|
||||
@dynamic name; |
||||
@dynamic methodsArray, methodsArray_Count; |
||||
@dynamic optionsArray, optionsArray_Count; |
||||
@dynamic version; |
||||
@dynamic hasSourceContext, sourceContext; |
||||
@dynamic mixinsArray, mixinsArray_Count; |
||||
@dynamic syntax; |
||||
|
||||
typedef struct GPBApi__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
GPBSyntax syntax; |
||||
NSString *name; |
||||
NSMutableArray *methodsArray; |
||||
NSMutableArray *optionsArray; |
||||
NSString *version; |
||||
GPBSourceContext *sourceContext; |
||||
NSMutableArray *mixinsArray; |
||||
} GPBApi__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "name", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBApi_FieldNumber_Name, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBApi__storage_, name), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "methodsArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBMethod), |
||||
.number = GPBApi_FieldNumber_MethodsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBApi__storage_, methodsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "optionsArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption), |
||||
.number = GPBApi_FieldNumber_OptionsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBApi__storage_, optionsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "version", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBApi_FieldNumber_Version, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBApi__storage_, version), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "sourceContext", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext), |
||||
.number = GPBApi_FieldNumber_SourceContext, |
||||
.hasIndex = 2, |
||||
.offset = (uint32_t)offsetof(GPBApi__storage_, sourceContext), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "mixinsArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBMixin), |
||||
.number = GPBApi_FieldNumber_MixinsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBApi__storage_, mixinsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "syntax", |
||||
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor, |
||||
.number = GPBApi_FieldNumber_Syntax, |
||||
.hasIndex = 3, |
||||
.offset = (uint32_t)offsetof(GPBApi__storage_, syntax), |
||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, |
||||
.dataType = GPBDataTypeEnum, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBApi class] |
||||
rootClass:[GPBApiRoot class] |
||||
file:GPBApiRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBApi__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
int32_t GPBApi_Syntax_RawValue(GPBApi *message) { |
||||
GPBDescriptor *descriptor = [GPBApi descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBApi_FieldNumber_Syntax]; |
||||
return GPBGetMessageInt32Field(message, field); |
||||
} |
||||
|
||||
void SetGPBApi_Syntax_RawValue(GPBApi *message, int32_t value) { |
||||
GPBDescriptor *descriptor = [GPBApi descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBApi_FieldNumber_Syntax]; |
||||
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); |
||||
} |
||||
|
||||
#pragma mark - GPBMethod |
||||
|
||||
@implementation GPBMethod |
||||
|
||||
@dynamic name; |
||||
@dynamic requestTypeURL; |
||||
@dynamic requestStreaming; |
||||
@dynamic responseTypeURL; |
||||
@dynamic responseStreaming; |
||||
@dynamic optionsArray, optionsArray_Count; |
||||
@dynamic syntax; |
||||
|
||||
typedef struct GPBMethod__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
GPBSyntax syntax; |
||||
NSString *name; |
||||
NSString *requestTypeURL; |
||||
NSString *responseTypeURL; |
||||
NSMutableArray *optionsArray; |
||||
} GPBMethod__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "name", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBMethod_FieldNumber_Name, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBMethod__storage_, name), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "requestTypeURL", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBMethod_FieldNumber_RequestTypeURL, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBMethod__storage_, requestTypeURL), |
||||
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "requestStreaming", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBMethod_FieldNumber_RequestStreaming, |
||||
.hasIndex = 2, |
||||
.offset = 3, // Stored in _has_storage_ to save space. |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeBool, |
||||
}, |
||||
{ |
||||
.name = "responseTypeURL", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBMethod_FieldNumber_ResponseTypeURL, |
||||
.hasIndex = 4, |
||||
.offset = (uint32_t)offsetof(GPBMethod__storage_, responseTypeURL), |
||||
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "responseStreaming", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBMethod_FieldNumber_ResponseStreaming, |
||||
.hasIndex = 5, |
||||
.offset = 6, // Stored in _has_storage_ to save space. |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeBool, |
||||
}, |
||||
{ |
||||
.name = "optionsArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption), |
||||
.number = GPBMethod_FieldNumber_OptionsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBMethod__storage_, optionsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "syntax", |
||||
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor, |
||||
.number = GPBMethod_FieldNumber_Syntax, |
||||
.hasIndex = 7, |
||||
.offset = (uint32_t)offsetof(GPBMethod__storage_, syntax), |
||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, |
||||
.dataType = GPBDataTypeEnum, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBMethod class] |
||||
rootClass:[GPBApiRoot class] |
||||
file:GPBApiRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBMethod__storage_) |
||||
flags:0]; |
||||
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS |
||||
static const char *extraTextFormatInfo = |
||||
"\002\002\007\244\241!!\000\004\010\244\241!!\000"; |
||||
[localDescriptor setupExtraTextInfo:extraTextFormatInfo]; |
||||
#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
int32_t GPBMethod_Syntax_RawValue(GPBMethod *message) { |
||||
GPBDescriptor *descriptor = [GPBMethod descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBMethod_FieldNumber_Syntax]; |
||||
return GPBGetMessageInt32Field(message, field); |
||||
} |
||||
|
||||
void SetGPBMethod_Syntax_RawValue(GPBMethod *message, int32_t value) { |
||||
GPBDescriptor *descriptor = [GPBMethod descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBMethod_FieldNumber_Syntax]; |
||||
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); |
||||
} |
||||
|
||||
#pragma mark - GPBMixin |
||||
|
||||
@implementation GPBMixin |
||||
|
||||
@dynamic name; |
||||
@dynamic root; |
||||
|
||||
typedef struct GPBMixin__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
NSString *name; |
||||
NSString *root; |
||||
} GPBMixin__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "name", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBMixin_FieldNumber_Name, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBMixin__storage_, name), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "root", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBMixin_FieldNumber_Root, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBMixin__storage_, root), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBMixin class] |
||||
rootClass:[GPBApiRoot class] |
||||
file:GPBApiRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBMixin__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,101 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/duration.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - GPBDurationRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBDurationRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBDuration |
||||
|
||||
typedef GPB_ENUM(GPBDuration_FieldNumber) { |
||||
GPBDuration_FieldNumber_Seconds = 1, |
||||
GPBDuration_FieldNumber_Nanos = 2, |
||||
}; |
||||
|
||||
/// A Duration represents a signed, fixed-length span of time represented
|
||||
/// as a count of seconds and fractions of seconds at nanosecond
|
||||
/// resolution. It is independent of any calendar and concepts like "day"
|
||||
/// or "month". It is related to Timestamp in that the difference between
|
||||
/// two Timestamp values is a Duration and it can be added or subtracted
|
||||
/// from a Timestamp. Range is approximately +-10,000 years.
|
||||
///
|
||||
/// Example 1: Compute Duration from two Timestamps in pseudo code.
|
||||
///
|
||||
/// Timestamp start = ...;
|
||||
/// Timestamp end = ...;
|
||||
/// Duration duration = ...;
|
||||
///
|
||||
/// duration.seconds = end.seconds - start.seconds;
|
||||
/// duration.nanos = end.nanos - start.nanos;
|
||||
///
|
||||
/// if (duration.seconds < 0 && duration.nanos > 0) {
|
||||
/// duration.seconds += 1;
|
||||
/// duration.nanos -= 1000000000;
|
||||
/// } else if (durations.seconds > 0 && duration.nanos < 0) {
|
||||
/// duration.seconds -= 1;
|
||||
/// duration.nanos += 1000000000;
|
||||
/// }
|
||||
///
|
||||
/// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
||||
///
|
||||
/// Timestamp start = ...;
|
||||
/// Duration duration = ...;
|
||||
/// Timestamp end = ...;
|
||||
///
|
||||
/// end.seconds = start.seconds + duration.seconds;
|
||||
/// end.nanos = start.nanos + duration.nanos;
|
||||
///
|
||||
/// if (end.nanos < 0) {
|
||||
/// end.seconds -= 1;
|
||||
/// end.nanos += 1000000000;
|
||||
/// } else if (end.nanos >= 1000000000) {
|
||||
/// end.seconds += 1;
|
||||
/// end.nanos -= 1000000000;
|
||||
/// }
|
||||
@interface GPBDuration : GPBMessage |
||||
|
||||
/// Signed seconds of the span of time. Must be from -315,576,000,000
|
||||
/// to +315,576,000,000 inclusive.
|
||||
@property(nonatomic, readwrite) int64_t seconds; |
||||
|
||||
/// Signed fractions of a second at nanosecond resolution of the span
|
||||
/// of time. Durations less than one second are represented with a 0
|
||||
/// `seconds` field and a positive or negative `nanos` field. For durations
|
||||
/// of one second or more, a non-zero value for the `nanos` field must be
|
||||
/// of the same sign as the `seconds` field. Must be from -999,999,999
|
||||
/// to +999,999,999 inclusive.
|
||||
@property(nonatomic, readwrite) int32_t nanos; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,88 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/duration.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/Duration.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBDurationRoot |
||||
|
||||
@implementation GPBDurationRoot |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBDurationRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBDurationRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - GPBDuration |
||||
|
||||
@implementation GPBDuration |
||||
|
||||
@dynamic seconds; |
||||
@dynamic nanos; |
||||
|
||||
typedef struct GPBDuration__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
int32_t nanos; |
||||
int64_t seconds; |
||||
} GPBDuration__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "seconds", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBDuration_FieldNumber_Seconds, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBDuration__storage_, seconds), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeInt64, |
||||
}, |
||||
{ |
||||
.name = "nanos", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBDuration_FieldNumber_Nanos, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBDuration__storage_, nanos), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeInt32, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBDuration class] |
||||
rootClass:[GPBDurationRoot class] |
||||
file:GPBDurationRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBDuration__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,53 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/empty.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - GPBEmptyRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBEmptyRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBEmpty |
||||
|
||||
/// A generic empty message that you can re-use to avoid defining duplicated
|
||||
/// empty messages in your APIs. A typical example is to use it as the request
|
||||
/// or the response type of an API method. For instance:
|
||||
///
|
||||
/// service Foo {
|
||||
/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
/// }
|
||||
///
|
||||
/// The JSON representation for `Empty` is empty JSON object `{}`.
|
||||
@interface GPBEmpty : GPBMessage |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,64 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/empty.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/Empty.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBEmptyRoot |
||||
|
||||
@implementation GPBEmptyRoot |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBEmptyRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBEmptyRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - GPBEmpty |
||||
|
||||
@implementation GPBEmpty |
||||
|
||||
|
||||
typedef struct GPBEmpty__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
} GPBEmpty__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBEmpty class] |
||||
rootClass:[GPBEmptyRoot class] |
||||
file:GPBEmptyRoot_FileDescriptor() |
||||
fields:NULL |
||||
fieldCount:0 |
||||
storageSize:sizeof(GPBEmpty__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,202 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/field_mask.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - GPBFieldMaskRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBFieldMaskRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBFieldMask |
||||
|
||||
typedef GPB_ENUM(GPBFieldMask_FieldNumber) { |
||||
GPBFieldMask_FieldNumber_PathsArray = 1, |
||||
}; |
||||
|
||||
/// `FieldMask` represents a set of symbolic field paths, for example:
|
||||
///
|
||||
/// paths: "f.a"
|
||||
/// paths: "f.b.d"
|
||||
///
|
||||
/// Here `f` represents a field in some root message, `a` and `b`
|
||||
/// fields in the message found in `f`, and `d` a field found in the
|
||||
/// message in `f.b`.
|
||||
///
|
||||
/// Field masks are used to specify a subset of fields that should be
|
||||
/// returned by a get operation or modified by an update operation.
|
||||
/// Field masks also have a custom JSON encoding (see below).
|
||||
///
|
||||
/// # Field Masks in Projections
|
||||
///
|
||||
/// When used in the context of a projection, a response message or
|
||||
/// sub-message is filtered by the API to only contain those fields as
|
||||
/// specified in the mask. For example, if the mask in the previous
|
||||
/// example is applied to a response message as follows:
|
||||
///
|
||||
/// f {
|
||||
/// a : 22
|
||||
/// b {
|
||||
/// d : 1
|
||||
/// x : 2
|
||||
/// }
|
||||
/// y : 13
|
||||
/// }
|
||||
/// z: 8
|
||||
///
|
||||
/// The result will not contain specific values for fields x,y and z
|
||||
/// (their value will be set to the default, and omitted in proto text
|
||||
/// output):
|
||||
///
|
||||
///
|
||||
/// f {
|
||||
/// a : 22
|
||||
/// b {
|
||||
/// d : 1
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// A repeated field is not allowed except at the last position of a
|
||||
/// field mask.
|
||||
///
|
||||
/// If a FieldMask object is not present in a get operation, the
|
||||
/// operation applies to all fields (as if a FieldMask of all fields
|
||||
/// had been specified).
|
||||
///
|
||||
/// Note that a field mask does not necessarily apply to the
|
||||
/// top-level response message. In case of a REST get operation, the
|
||||
/// field mask applies directly to the response, but in case of a REST
|
||||
/// list operation, the mask instead applies to each individual message
|
||||
/// in the returned resource list. In case of a REST custom method,
|
||||
/// other definitions may be used. Where the mask applies will be
|
||||
/// clearly documented together with its declaration in the API. In
|
||||
/// any case, the effect on the returned resource/resources is required
|
||||
/// behavior for APIs.
|
||||
///
|
||||
/// # Field Masks in Update Operations
|
||||
///
|
||||
/// A field mask in update operations specifies which fields of the
|
||||
/// targeted resource are going to be updated. The API is required
|
||||
/// to only change the values of the fields as specified in the mask
|
||||
/// and leave the others untouched. If a resource is passed in to
|
||||
/// describe the updated values, the API ignores the values of all
|
||||
/// fields not covered by the mask.
|
||||
///
|
||||
/// In order to reset a field's value to the default, the field must
|
||||
/// be in the mask and set to the default value in the provided resource.
|
||||
/// Hence, in order to reset all fields of a resource, provide a default
|
||||
/// instance of the resource and set all fields in the mask, or do
|
||||
/// not provide a mask as described below.
|
||||
///
|
||||
/// If a field mask is not present on update, the operation applies to
|
||||
/// all fields (as if a field mask of all fields has been specified).
|
||||
/// Note that in the presence of schema evolution, this may mean that
|
||||
/// fields the client does not know and has therefore not filled into
|
||||
/// the request will be reset to their default. If this is unwanted
|
||||
/// behavior, a specific service may require a client to always specify
|
||||
/// a field mask, producing an error if not.
|
||||
///
|
||||
/// As with get operations, the location of the resource which
|
||||
/// describes the updated values in the request message depends on the
|
||||
/// operation kind. In any case, the effect of the field mask is
|
||||
/// required to be honored by the API.
|
||||
///
|
||||
/// ## Considerations for HTTP REST
|
||||
///
|
||||
/// The HTTP kind of an update operation which uses a field mask must
|
||||
/// be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
||||
/// (PUT must only be used for full updates).
|
||||
///
|
||||
/// # JSON Encoding of Field Masks
|
||||
///
|
||||
/// In JSON, a field mask is encoded as a single string where paths are
|
||||
/// separated by a comma. Fields name in each path are converted
|
||||
/// to/from lower-camel naming conventions.
|
||||
///
|
||||
/// As an example, consider the following message declarations:
|
||||
///
|
||||
/// message Profile {
|
||||
/// User user = 1;
|
||||
/// Photo photo = 2;
|
||||
/// }
|
||||
/// message User {
|
||||
/// string display_name = 1;
|
||||
/// string address = 2;
|
||||
/// }
|
||||
///
|
||||
/// In proto a field mask for `Profile` may look as such:
|
||||
///
|
||||
/// mask {
|
||||
/// paths: "user.display_name"
|
||||
/// paths: "photo"
|
||||
/// }
|
||||
///
|
||||
/// In JSON, the same mask is represented as below:
|
||||
///
|
||||
/// {
|
||||
/// mask: "user.displayName,photo"
|
||||
/// }
|
||||
///
|
||||
/// # Field Masks and Oneof Fields
|
||||
///
|
||||
/// Field masks treat fields in oneofs just as regular fields. Consider the
|
||||
/// following message:
|
||||
///
|
||||
/// message SampleMessage {
|
||||
/// oneof test_oneof {
|
||||
/// string name = 4;
|
||||
/// SubMessage sub_message = 9;
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// The field mask can be:
|
||||
///
|
||||
/// mask {
|
||||
/// paths: "name"
|
||||
/// }
|
||||
///
|
||||
/// Or:
|
||||
///
|
||||
/// mask {
|
||||
/// paths: "sub_message"
|
||||
/// }
|
||||
///
|
||||
/// Note that oneof type names ("test_oneof" in this case) cannot be used in
|
||||
/// paths.
|
||||
@interface GPBFieldMask : GPBMessage |
||||
|
||||
/// The set of field mask paths.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<NSString*> *pathsArray; |
||||
/// The number of items in @c pathsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger pathsArray_Count; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,77 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/field_mask.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/FieldMask.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBFieldMaskRoot |
||||
|
||||
@implementation GPBFieldMaskRoot |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBFieldMaskRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBFieldMaskRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - GPBFieldMask |
||||
|
||||
@implementation GPBFieldMask |
||||
|
||||
@dynamic pathsArray, pathsArray_Count; |
||||
|
||||
typedef struct GPBFieldMask__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
NSMutableArray *pathsArray; |
||||
} GPBFieldMask__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "pathsArray", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBFieldMask_FieldNumber_PathsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBFieldMask__storage_, pathsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBFieldMask class] |
||||
rootClass:[GPBFieldMaskRoot class] |
||||
file:GPBFieldMaskRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBFieldMask__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,54 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/source_context.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - GPBSourceContextRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBSourceContextRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBSourceContext |
||||
|
||||
typedef GPB_ENUM(GPBSourceContext_FieldNumber) { |
||||
GPBSourceContext_FieldNumber_FileName = 1, |
||||
}; |
||||
|
||||
/// `SourceContext` represents information about the source of a
|
||||
/// protobuf element, like the file in which it is defined.
|
||||
@interface GPBSourceContext : GPBMessage |
||||
|
||||
/// The path-qualified name of the .proto file that contained the associated
|
||||
/// protobuf element. For example: `"google/protobuf/source.proto"`.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *fileName; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,77 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/source_context.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/SourceContext.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBSourceContextRoot |
||||
|
||||
@implementation GPBSourceContextRoot |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBSourceContextRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBSourceContextRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - GPBSourceContext |
||||
|
||||
@implementation GPBSourceContext |
||||
|
||||
@dynamic fileName; |
||||
|
||||
typedef struct GPBSourceContext__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
NSString *fileName; |
||||
} GPBSourceContext__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "fileName", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBSourceContext_FieldNumber_FileName, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBSourceContext__storage_, fileName), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBSourceContext class] |
||||
rootClass:[GPBSourceContextRoot class] |
||||
file:GPBSourceContextRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBSourceContext__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,167 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/struct.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
@class GPBListValue; |
||||
@class GPBStruct; |
||||
@class GPBValue; |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - Enum GPBNullValue |
||||
|
||||
/// `NullValue` is a singleton enumeration to represent the null value for the
|
||||
/// `Value` type union.
|
||||
///
|
||||
/// The JSON representation for `NullValue` is JSON `null`.
|
||||
typedef GPB_ENUM(GPBNullValue) { |
||||
/// Value used if any message's field encounters a value that is not defined
|
||||
/// by this enum. The message will also have C functions to get/set the rawValue
|
||||
/// of the field.
|
||||
GPBNullValue_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, |
||||
/// Null value.
|
||||
GPBNullValue_NullValue = 0, |
||||
}; |
||||
|
||||
GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void); |
||||
|
||||
/// Checks to see if the given value is defined by the enum or was not known at
|
||||
/// the time this source was generated.
|
||||
BOOL GPBNullValue_IsValidValue(int32_t value); |
||||
|
||||
#pragma mark - GPBStructRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBStructRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBStruct |
||||
|
||||
typedef GPB_ENUM(GPBStruct_FieldNumber) { |
||||
GPBStruct_FieldNumber_Fields = 1, |
||||
}; |
||||
|
||||
/// `Struct` represents a structured data value, consisting of fields
|
||||
/// which map to dynamically typed values. In some languages, `Struct`
|
||||
/// might be supported by a native representation. For example, in
|
||||
/// scripting languages like JS a struct is represented as an
|
||||
/// object. The details of that representation are described together
|
||||
/// with the proto support for the language.
|
||||
///
|
||||
/// The JSON representation for `Struct` is JSON object.
|
||||
@interface GPBStruct : GPBMessage |
||||
|
||||
/// Unordered map of dynamically typed values.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableDictionary<NSString*, GPBValue*> *fields; |
||||
/// The number of items in @c fields without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger fields_Count; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBValue |
||||
|
||||
typedef GPB_ENUM(GPBValue_FieldNumber) { |
||||
GPBValue_FieldNumber_NullValue = 1, |
||||
GPBValue_FieldNumber_NumberValue = 2, |
||||
GPBValue_FieldNumber_StringValue = 3, |
||||
GPBValue_FieldNumber_BoolValue = 4, |
||||
GPBValue_FieldNumber_StructValue = 5, |
||||
GPBValue_FieldNumber_ListValue = 6, |
||||
}; |
||||
|
||||
typedef GPB_ENUM(GPBValue_Kind_OneOfCase) { |
||||
GPBValue_Kind_OneOfCase_GPBUnsetOneOfCase = 0, |
||||
GPBValue_Kind_OneOfCase_NullValue = 1, |
||||
GPBValue_Kind_OneOfCase_NumberValue = 2, |
||||
GPBValue_Kind_OneOfCase_StringValue = 3, |
||||
GPBValue_Kind_OneOfCase_BoolValue = 4, |
||||
GPBValue_Kind_OneOfCase_StructValue = 5, |
||||
GPBValue_Kind_OneOfCase_ListValue = 6, |
||||
}; |
||||
|
||||
/// `Value` represents a dynamically typed value which can be either
|
||||
/// null, a number, a string, a boolean, a recursive struct value, or a
|
||||
/// list of values. A producer of value is expected to set one of that
|
||||
/// variants, absence of any variant indicates an error.
|
||||
///
|
||||
/// The JSON representation for `Value` is JSON value.
|
||||
@interface GPBValue : GPBMessage |
||||
|
||||
/// The kind of value.
|
||||
@property(nonatomic, readonly) GPBValue_Kind_OneOfCase kindOneOfCase; |
||||
|
||||
/// Represents a null value.
|
||||
@property(nonatomic, readwrite) GPBNullValue nullValue; |
||||
|
||||
/// Represents a double value.
|
||||
@property(nonatomic, readwrite) double numberValue; |
||||
|
||||
/// Represents a string value.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *stringValue; |
||||
|
||||
/// Represents a boolean value.
|
||||
@property(nonatomic, readwrite) BOOL boolValue; |
||||
|
||||
/// Represents a structured value.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) GPBStruct *structValue; |
||||
|
||||
/// Represents a repeated `Value`.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) GPBListValue *listValue; |
||||
|
||||
@end |
||||
|
||||
/// Fetches the raw value of a @c GPBValue's @c nullValue property, even
|
||||
/// if the value was not defined by the enum at the time the code was generated.
|
||||
int32_t GPBValue_NullValue_RawValue(GPBValue *message); |
||||
/// Sets the raw value of an @c GPBValue's @c nullValue property, allowing
|
||||
/// it to be set to a value that was not defined by the enum at the time the code
|
||||
/// was generated.
|
||||
void SetGPBValue_NullValue_RawValue(GPBValue *message, int32_t value); |
||||
|
||||
/// Clears whatever value was set for the oneof 'kind'.
|
||||
void GPBValue_ClearKindOneOfCase(GPBValue *message); |
||||
|
||||
#pragma mark - GPBListValue |
||||
|
||||
typedef GPB_ENUM(GPBListValue_FieldNumber) { |
||||
GPBListValue_FieldNumber_ValuesArray = 1, |
||||
}; |
||||
|
||||
/// `ListValue` is a wrapper around a repeated field of values.
|
||||
///
|
||||
/// The JSON representation for `ListValue` is JSON array.
|
||||
@interface GPBListValue : GPBMessage |
||||
|
||||
/// Repeated field of dynamically typed values.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBValue*> *valuesArray; |
||||
/// The number of items in @c valuesArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger valuesArray_Count; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,273 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/struct.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/Struct.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBStructRoot |
||||
|
||||
@implementation GPBStructRoot |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBStructRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBStructRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - Enum GPBNullValue |
||||
|
||||
GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void) { |
||||
static GPBEnumDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
static const char *valueNames = |
||||
"NullValue\000"; |
||||
static const int32_t values[] = { |
||||
GPBNullValue_NullValue, |
||||
}; |
||||
GPBEnumDescriptor *worker = |
||||
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBNullValue) |
||||
valueNames:valueNames |
||||
values:values |
||||
count:(uint32_t)(sizeof(values) / sizeof(int32_t)) |
||||
enumVerifier:GPBNullValue_IsValidValue]; |
||||
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { |
||||
[worker release]; |
||||
} |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
BOOL GPBNullValue_IsValidValue(int32_t value__) { |
||||
switch (value__) { |
||||
case GPBNullValue_NullValue: |
||||
return YES; |
||||
default: |
||||
return NO; |
||||
} |
||||
} |
||||
|
||||
#pragma mark - GPBStruct |
||||
|
||||
@implementation GPBStruct |
||||
|
||||
@dynamic fields, fields_Count; |
||||
|
||||
typedef struct GPBStruct__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
NSMutableDictionary *fields; |
||||
} GPBStruct__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "fields", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBValue), |
||||
.number = GPBStruct_FieldNumber_Fields, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBStruct__storage_, fields), |
||||
.flags = GPBFieldMapKeyString, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBStruct class] |
||||
rootClass:[GPBStructRoot class] |
||||
file:GPBStructRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBStruct__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBValue |
||||
|
||||
@implementation GPBValue |
||||
|
||||
@dynamic kindOneOfCase; |
||||
@dynamic nullValue; |
||||
@dynamic numberValue; |
||||
@dynamic stringValue; |
||||
@dynamic boolValue; |
||||
@dynamic structValue; |
||||
@dynamic listValue; |
||||
|
||||
typedef struct GPBValue__storage_ { |
||||
uint32_t _has_storage_[2]; |
||||
GPBNullValue nullValue; |
||||
NSString *stringValue; |
||||
GPBStruct *structValue; |
||||
GPBListValue *listValue; |
||||
double numberValue; |
||||
} GPBValue__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "nullValue", |
||||
.dataTypeSpecific.enumDescFunc = GPBNullValue_EnumDescriptor, |
||||
.number = GPBValue_FieldNumber_NullValue, |
||||
.hasIndex = -1, |
||||
.offset = (uint32_t)offsetof(GPBValue__storage_, nullValue), |
||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, |
||||
.dataType = GPBDataTypeEnum, |
||||
}, |
||||
{ |
||||
.name = "numberValue", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBValue_FieldNumber_NumberValue, |
||||
.hasIndex = -1, |
||||
.offset = (uint32_t)offsetof(GPBValue__storage_, numberValue), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeDouble, |
||||
}, |
||||
{ |
||||
.name = "stringValue", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBValue_FieldNumber_StringValue, |
||||
.hasIndex = -1, |
||||
.offset = (uint32_t)offsetof(GPBValue__storage_, stringValue), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "boolValue", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBValue_FieldNumber_BoolValue, |
||||
.hasIndex = -1, |
||||
.offset = 0, // Stored in _has_storage_ to save space. |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeBool, |
||||
}, |
||||
{ |
||||
.name = "structValue", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBStruct), |
||||
.number = GPBValue_FieldNumber_StructValue, |
||||
.hasIndex = -1, |
||||
.offset = (uint32_t)offsetof(GPBValue__storage_, structValue), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "listValue", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBListValue), |
||||
.number = GPBValue_FieldNumber_ListValue, |
||||
.hasIndex = -1, |
||||
.offset = (uint32_t)offsetof(GPBValue__storage_, listValue), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBValue class] |
||||
rootClass:[GPBStructRoot class] |
||||
file:GPBStructRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBValue__storage_) |
||||
flags:0]; |
||||
static const char *oneofs[] = { |
||||
"kind", |
||||
}; |
||||
[localDescriptor setupOneofs:oneofs |
||||
count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) |
||||
firstHasIndex:-1]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
int32_t GPBValue_NullValue_RawValue(GPBValue *message) { |
||||
GPBDescriptor *descriptor = [GPBValue descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBValue_FieldNumber_NullValue]; |
||||
return GPBGetMessageInt32Field(message, field); |
||||
} |
||||
|
||||
void SetGPBValue_NullValue_RawValue(GPBValue *message, int32_t value) { |
||||
GPBDescriptor *descriptor = [GPBValue descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBValue_FieldNumber_NullValue]; |
||||
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); |
||||
} |
||||
|
||||
void GPBValue_ClearKindOneOfCase(GPBValue *message) { |
||||
GPBDescriptor *descriptor = [message descriptor]; |
||||
GPBOneofDescriptor *oneof = descriptor->oneofs_[0]; |
||||
GPBMaybeClearOneof(message, oneof, -1, 0); |
||||
} |
||||
#pragma mark - GPBListValue |
||||
|
||||
@implementation GPBListValue |
||||
|
||||
@dynamic valuesArray, valuesArray_Count; |
||||
|
||||
typedef struct GPBListValue__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
NSMutableArray *valuesArray; |
||||
} GPBListValue__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "valuesArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBValue), |
||||
.number = GPBListValue_FieldNumber_ValuesArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBListValue__storage_, valuesArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBListValue class] |
||||
rootClass:[GPBStructRoot class] |
||||
file:GPBStructRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBListValue__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,113 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/timestamp.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - GPBTimestampRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBTimestampRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBTimestamp |
||||
|
||||
typedef GPB_ENUM(GPBTimestamp_FieldNumber) { |
||||
GPBTimestamp_FieldNumber_Seconds = 1, |
||||
GPBTimestamp_FieldNumber_Nanos = 2, |
||||
}; |
||||
|
||||
/// A Timestamp represents a point in time independent of any time zone
|
||||
/// or calendar, represented as seconds and fractions of seconds at
|
||||
/// nanosecond resolution in UTC Epoch time. It is encoded using the
|
||||
/// Proleptic Gregorian Calendar which extends the Gregorian calendar
|
||||
/// backwards to year one. It is encoded assuming all minutes are 60
|
||||
/// seconds long, i.e. leap seconds are "smeared" so that no leap second
|
||||
/// table is needed for interpretation. Range is from
|
||||
/// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
||||
/// By restricting to that range, we ensure that we can convert to
|
||||
/// and from RFC 3339 date strings.
|
||||
/// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
|
||||
///
|
||||
/// Example 1: Compute Timestamp from POSIX `time()`.
|
||||
///
|
||||
/// Timestamp timestamp;
|
||||
/// timestamp.set_seconds(time(NULL));
|
||||
/// timestamp.set_nanos(0);
|
||||
///
|
||||
/// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||
///
|
||||
/// struct timeval tv;
|
||||
/// gettimeofday(&tv, NULL);
|
||||
///
|
||||
/// Timestamp timestamp;
|
||||
/// timestamp.set_seconds(tv.tv_sec);
|
||||
/// timestamp.set_nanos(tv.tv_usec * 1000);
|
||||
///
|
||||
/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||
///
|
||||
/// FILETIME ft;
|
||||
/// GetSystemTimeAsFileTime(&ft);
|
||||
/// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||
///
|
||||
/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||
/// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||
/// Timestamp timestamp;
|
||||
/// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||
/// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||
///
|
||||
/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||
///
|
||||
/// long millis = System.currentTimeMillis();
|
||||
///
|
||||
/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||
/// .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||
///
|
||||
///
|
||||
/// Example 5: Compute Timestamp from current time in Python.
|
||||
///
|
||||
/// now = time.time()
|
||||
/// seconds = int(now)
|
||||
/// nanos = int((now - seconds) * 10**9)
|
||||
/// timestamp = Timestamp(seconds=seconds, nanos=nanos)
|
||||
@interface GPBTimestamp : GPBMessage |
||||
|
||||
/// Represents seconds of UTC time since Unix epoch
|
||||
/// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
|
||||
/// 9999-12-31T23:59:59Z inclusive.
|
||||
@property(nonatomic, readwrite) int64_t seconds; |
||||
|
||||
/// Non-negative fractions of a second at nanosecond resolution. Negative
|
||||
/// second values with fractions must still have non-negative nanos values
|
||||
/// that count forward in time. Must be from 0 to 999,999,999
|
||||
/// inclusive.
|
||||
@property(nonatomic, readwrite) int32_t nanos; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,88 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/timestamp.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/Timestamp.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBTimestampRoot |
||||
|
||||
@implementation GPBTimestampRoot |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBTimestampRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBTimestampRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - GPBTimestamp |
||||
|
||||
@implementation GPBTimestamp |
||||
|
||||
@dynamic seconds; |
||||
@dynamic nanos; |
||||
|
||||
typedef struct GPBTimestamp__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
int32_t nanos; |
||||
int64_t seconds; |
||||
} GPBTimestamp__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "seconds", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBTimestamp_FieldNumber_Seconds, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBTimestamp__storage_, seconds), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeInt64, |
||||
}, |
||||
{ |
||||
.name = "nanos", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBTimestamp_FieldNumber_Nanos, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBTimestamp__storage_, nanos), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeInt32, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBTimestamp class] |
||||
rootClass:[GPBTimestampRoot class] |
||||
file:GPBTimestampRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBTimestamp__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,373 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/type.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
@class GPBAny; |
||||
@class GPBEnumValue; |
||||
@class GPBField; |
||||
@class GPBOption; |
||||
@class GPBSourceContext; |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - Enum GPBSyntax |
||||
|
||||
/// The syntax in which a protocol buffer element is defined.
|
||||
typedef GPB_ENUM(GPBSyntax) { |
||||
/// Value used if any message's field encounters a value that is not defined
|
||||
/// by this enum. The message will also have C functions to get/set the rawValue
|
||||
/// of the field.
|
||||
GPBSyntax_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, |
||||
/// Syntax `proto2`.
|
||||
GPBSyntax_SyntaxProto2 = 0, |
||||
|
||||
/// Syntax `proto3`.
|
||||
GPBSyntax_SyntaxProto3 = 1, |
||||
}; |
||||
|
||||
GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void); |
||||
|
||||
/// Checks to see if the given value is defined by the enum or was not known at
|
||||
/// the time this source was generated.
|
||||
BOOL GPBSyntax_IsValidValue(int32_t value); |
||||
|
||||
#pragma mark - Enum GPBField_Kind |
||||
|
||||
/// Basic field types.
|
||||
typedef GPB_ENUM(GPBField_Kind) { |
||||
/// Value used if any message's field encounters a value that is not defined
|
||||
/// by this enum. The message will also have C functions to get/set the rawValue
|
||||
/// of the field.
|
||||
GPBField_Kind_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, |
||||
/// Field type unknown.
|
||||
GPBField_Kind_TypeUnknown = 0, |
||||
|
||||
/// Field type double.
|
||||
GPBField_Kind_TypeDouble = 1, |
||||
|
||||
/// Field type float.
|
||||
GPBField_Kind_TypeFloat = 2, |
||||
|
||||
/// Field type int64.
|
||||
GPBField_Kind_TypeInt64 = 3, |
||||
|
||||
/// Field type uint64.
|
||||
GPBField_Kind_TypeUint64 = 4, |
||||
|
||||
/// Field type int32.
|
||||
GPBField_Kind_TypeInt32 = 5, |
||||
|
||||
/// Field type fixed64.
|
||||
GPBField_Kind_TypeFixed64 = 6, |
||||
|
||||
/// Field type fixed32.
|
||||
GPBField_Kind_TypeFixed32 = 7, |
||||
|
||||
/// Field type bool.
|
||||
GPBField_Kind_TypeBool = 8, |
||||
|
||||
/// Field type string.
|
||||
GPBField_Kind_TypeString = 9, |
||||
|
||||
/// Field type group. Proto2 syntax only, and deprecated.
|
||||
GPBField_Kind_TypeGroup = 10, |
||||
|
||||
/// Field type message.
|
||||
GPBField_Kind_TypeMessage = 11, |
||||
|
||||
/// Field type bytes.
|
||||
GPBField_Kind_TypeBytes = 12, |
||||
|
||||
/// Field type uint32.
|
||||
GPBField_Kind_TypeUint32 = 13, |
||||
|
||||
/// Field type enum.
|
||||
GPBField_Kind_TypeEnum = 14, |
||||
|
||||
/// Field type sfixed32.
|
||||
GPBField_Kind_TypeSfixed32 = 15, |
||||
|
||||
/// Field type sfixed64.
|
||||
GPBField_Kind_TypeSfixed64 = 16, |
||||
|
||||
/// Field type sint32.
|
||||
GPBField_Kind_TypeSint32 = 17, |
||||
|
||||
/// Field type sint64.
|
||||
GPBField_Kind_TypeSint64 = 18, |
||||
}; |
||||
|
||||
GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void); |
||||
|
||||
/// Checks to see if the given value is defined by the enum or was not known at
|
||||
/// the time this source was generated.
|
||||
BOOL GPBField_Kind_IsValidValue(int32_t value); |
||||
|
||||
#pragma mark - Enum GPBField_Cardinality |
||||
|
||||
/// Whether a field is optional, required, or repeated.
|
||||
typedef GPB_ENUM(GPBField_Cardinality) { |
||||
/// Value used if any message's field encounters a value that is not defined
|
||||
/// by this enum. The message will also have C functions to get/set the rawValue
|
||||
/// of the field.
|
||||
GPBField_Cardinality_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, |
||||
/// For fields with unknown cardinality.
|
||||
GPBField_Cardinality_CardinalityUnknown = 0, |
||||
|
||||
/// For optional fields.
|
||||
GPBField_Cardinality_CardinalityOptional = 1, |
||||
|
||||
/// For required fields. Proto2 syntax only.
|
||||
GPBField_Cardinality_CardinalityRequired = 2, |
||||
|
||||
/// For repeated fields.
|
||||
GPBField_Cardinality_CardinalityRepeated = 3, |
||||
}; |
||||
|
||||
GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void); |
||||
|
||||
/// Checks to see if the given value is defined by the enum or was not known at
|
||||
/// the time this source was generated.
|
||||
BOOL GPBField_Cardinality_IsValidValue(int32_t value); |
||||
|
||||
#pragma mark - GPBTypeRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBTypeRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBType |
||||
|
||||
typedef GPB_ENUM(GPBType_FieldNumber) { |
||||
GPBType_FieldNumber_Name = 1, |
||||
GPBType_FieldNumber_FieldsArray = 2, |
||||
GPBType_FieldNumber_OneofsArray = 3, |
||||
GPBType_FieldNumber_OptionsArray = 4, |
||||
GPBType_FieldNumber_SourceContext = 5, |
||||
GPBType_FieldNumber_Syntax = 6, |
||||
}; |
||||
|
||||
/// A protocol buffer message type.
|
||||
@interface GPBType : GPBMessage |
||||
|
||||
/// The fully qualified message name.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *name; |
||||
|
||||
/// The list of fields.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBField*> *fieldsArray; |
||||
/// The number of items in @c fieldsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger fieldsArray_Count; |
||||
|
||||
/// The list of types appearing in `oneof` definitions in this type.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<NSString*> *oneofsArray; |
||||
/// The number of items in @c oneofsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger oneofsArray_Count; |
||||
|
||||
/// The protocol buffer options.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBOption*> *optionsArray; |
||||
/// The number of items in @c optionsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger optionsArray_Count; |
||||
|
||||
/// The source context.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) GPBSourceContext *sourceContext; |
||||
/// Test to see if @c sourceContext has been set.
|
||||
@property(nonatomic, readwrite) BOOL hasSourceContext; |
||||
|
||||
/// The source syntax.
|
||||
@property(nonatomic, readwrite) GPBSyntax syntax; |
||||
|
||||
@end |
||||
|
||||
/// Fetches the raw value of a @c GPBType's @c syntax property, even
|
||||
/// if the value was not defined by the enum at the time the code was generated.
|
||||
int32_t GPBType_Syntax_RawValue(GPBType *message); |
||||
/// Sets the raw value of an @c GPBType's @c syntax property, allowing
|
||||
/// it to be set to a value that was not defined by the enum at the time the code
|
||||
/// was generated.
|
||||
void SetGPBType_Syntax_RawValue(GPBType *message, int32_t value); |
||||
|
||||
#pragma mark - GPBField |
||||
|
||||
typedef GPB_ENUM(GPBField_FieldNumber) { |
||||
GPBField_FieldNumber_Kind = 1, |
||||
GPBField_FieldNumber_Cardinality = 2, |
||||
GPBField_FieldNumber_Number = 3, |
||||
GPBField_FieldNumber_Name = 4, |
||||
GPBField_FieldNumber_TypeURL = 6, |
||||
GPBField_FieldNumber_OneofIndex = 7, |
||||
GPBField_FieldNumber_Packed = 8, |
||||
GPBField_FieldNumber_OptionsArray = 9, |
||||
GPBField_FieldNumber_JsonName = 10, |
||||
GPBField_FieldNumber_DefaultValue = 11, |
||||
}; |
||||
|
||||
/// A single field of a message type.
|
||||
@interface GPBField : GPBMessage |
||||
|
||||
/// The field type.
|
||||
@property(nonatomic, readwrite) GPBField_Kind kind; |
||||
|
||||
/// The field cardinality.
|
||||
@property(nonatomic, readwrite) GPBField_Cardinality cardinality; |
||||
|
||||
/// The field number.
|
||||
@property(nonatomic, readwrite) int32_t number; |
||||
|
||||
/// The field name.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *name; |
||||
|
||||
/// The field type URL, without the scheme, for message or enumeration
|
||||
/// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *typeURL; |
||||
|
||||
/// The index of the field type in `Type.oneofs`, for message or enumeration
|
||||
/// types. The first type has index 1; zero means the type is not in the list.
|
||||
@property(nonatomic, readwrite) int32_t oneofIndex; |
||||
|
||||
/// Whether to use alternative packed wire representation.
|
||||
@property(nonatomic, readwrite) BOOL packed; |
||||
|
||||
/// The protocol buffer options.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBOption*> *optionsArray; |
||||
/// The number of items in @c optionsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger optionsArray_Count; |
||||
|
||||
/// The field JSON name.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *jsonName; |
||||
|
||||
/// The string value of the default value of this field. Proto2 syntax only.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *defaultValue; |
||||
|
||||
@end |
||||
|
||||
/// Fetches the raw value of a @c GPBField's @c kind property, even
|
||||
/// if the value was not defined by the enum at the time the code was generated.
|
||||
int32_t GPBField_Kind_RawValue(GPBField *message); |
||||
/// Sets the raw value of an @c GPBField's @c kind property, allowing
|
||||
/// it to be set to a value that was not defined by the enum at the time the code
|
||||
/// was generated.
|
||||
void SetGPBField_Kind_RawValue(GPBField *message, int32_t value); |
||||
|
||||
/// Fetches the raw value of a @c GPBField's @c cardinality property, even
|
||||
/// if the value was not defined by the enum at the time the code was generated.
|
||||
int32_t GPBField_Cardinality_RawValue(GPBField *message); |
||||
/// Sets the raw value of an @c GPBField's @c cardinality property, allowing
|
||||
/// it to be set to a value that was not defined by the enum at the time the code
|
||||
/// was generated.
|
||||
void SetGPBField_Cardinality_RawValue(GPBField *message, int32_t value); |
||||
|
||||
#pragma mark - GPBEnum |
||||
|
||||
typedef GPB_ENUM(GPBEnum_FieldNumber) { |
||||
GPBEnum_FieldNumber_Name = 1, |
||||
GPBEnum_FieldNumber_EnumvalueArray = 2, |
||||
GPBEnum_FieldNumber_OptionsArray = 3, |
||||
GPBEnum_FieldNumber_SourceContext = 4, |
||||
GPBEnum_FieldNumber_Syntax = 5, |
||||
}; |
||||
|
||||
/// Enum type definition.
|
||||
@interface GPBEnum : GPBMessage |
||||
|
||||
/// Enum type name.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *name; |
||||
|
||||
/// Enum value definitions.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBEnumValue*> *enumvalueArray; |
||||
/// The number of items in @c enumvalueArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger enumvalueArray_Count; |
||||
|
||||
/// Protocol buffer options.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBOption*> *optionsArray; |
||||
/// The number of items in @c optionsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger optionsArray_Count; |
||||
|
||||
/// The source context.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) GPBSourceContext *sourceContext; |
||||
/// Test to see if @c sourceContext has been set.
|
||||
@property(nonatomic, readwrite) BOOL hasSourceContext; |
||||
|
||||
/// The source syntax.
|
||||
@property(nonatomic, readwrite) GPBSyntax syntax; |
||||
|
||||
@end |
||||
|
||||
/// Fetches the raw value of a @c GPBEnum's @c syntax property, even
|
||||
/// if the value was not defined by the enum at the time the code was generated.
|
||||
int32_t GPBEnum_Syntax_RawValue(GPBEnum *message); |
||||
/// Sets the raw value of an @c GPBEnum's @c syntax property, allowing
|
||||
/// it to be set to a value that was not defined by the enum at the time the code
|
||||
/// was generated.
|
||||
void SetGPBEnum_Syntax_RawValue(GPBEnum *message, int32_t value); |
||||
|
||||
#pragma mark - GPBEnumValue |
||||
|
||||
typedef GPB_ENUM(GPBEnumValue_FieldNumber) { |
||||
GPBEnumValue_FieldNumber_Name = 1, |
||||
GPBEnumValue_FieldNumber_Number = 2, |
||||
GPBEnumValue_FieldNumber_OptionsArray = 3, |
||||
}; |
||||
|
||||
/// Enum value definition.
|
||||
@interface GPBEnumValue : GPBMessage |
||||
|
||||
/// Enum value name.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *name; |
||||
|
||||
/// Enum value number.
|
||||
@property(nonatomic, readwrite) int32_t number; |
||||
|
||||
/// Protocol buffer options.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GPBOption*> *optionsArray; |
||||
/// The number of items in @c optionsArray without causing the array to be created.
|
||||
@property(nonatomic, readonly) NSUInteger optionsArray_Count; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBOption |
||||
|
||||
typedef GPB_ENUM(GPBOption_FieldNumber) { |
||||
GPBOption_FieldNumber_Name = 1, |
||||
GPBOption_FieldNumber_Value = 2, |
||||
}; |
||||
|
||||
/// A protocol buffer option, which can be attached to a message, field,
|
||||
/// enumeration, etc.
|
||||
@interface GPBOption : GPBMessage |
||||
|
||||
/// The option's name. For example, `"java_package"`.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *name; |
||||
|
||||
/// The option's value. For example, `"com.google.protobuf"`.
|
||||
@property(nonatomic, readwrite, strong, null_resettable) GPBAny *value; |
||||
/// Test to see if @c value has been set.
|
||||
@property(nonatomic, readwrite) BOOL hasValue; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,693 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/type.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/Type.pbobjc.h" |
||||
#import "google/protobuf/Any.pbobjc.h" |
||||
#import "google/protobuf/SourceContext.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBTypeRoot |
||||
|
||||
@implementation GPBTypeRoot |
||||
|
||||
+ (GPBExtensionRegistry*)extensionRegistry { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety and initialization of registry. |
||||
static GPBExtensionRegistry* registry = nil; |
||||
if (!registry) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
registry = [[GPBExtensionRegistry alloc] init]; |
||||
[registry addExtensions:[GPBAnyRoot extensionRegistry]]; |
||||
[registry addExtensions:[GPBSourceContextRoot extensionRegistry]]; |
||||
} |
||||
return registry; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBTypeRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBTypeRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - Enum GPBSyntax |
||||
|
||||
GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void) { |
||||
static GPBEnumDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
static const char *valueNames = |
||||
"SyntaxProto2\000SyntaxProto3\000"; |
||||
static const int32_t values[] = { |
||||
GPBSyntax_SyntaxProto2, |
||||
GPBSyntax_SyntaxProto3, |
||||
}; |
||||
GPBEnumDescriptor *worker = |
||||
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBSyntax) |
||||
valueNames:valueNames |
||||
values:values |
||||
count:(uint32_t)(sizeof(values) / sizeof(int32_t)) |
||||
enumVerifier:GPBSyntax_IsValidValue]; |
||||
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { |
||||
[worker release]; |
||||
} |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
BOOL GPBSyntax_IsValidValue(int32_t value__) { |
||||
switch (value__) { |
||||
case GPBSyntax_SyntaxProto2: |
||||
case GPBSyntax_SyntaxProto3: |
||||
return YES; |
||||
default: |
||||
return NO; |
||||
} |
||||
} |
||||
|
||||
#pragma mark - GPBType |
||||
|
||||
@implementation GPBType |
||||
|
||||
@dynamic name; |
||||
@dynamic fieldsArray, fieldsArray_Count; |
||||
@dynamic oneofsArray, oneofsArray_Count; |
||||
@dynamic optionsArray, optionsArray_Count; |
||||
@dynamic hasSourceContext, sourceContext; |
||||
@dynamic syntax; |
||||
|
||||
typedef struct GPBType__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
GPBSyntax syntax; |
||||
NSString *name; |
||||
NSMutableArray *fieldsArray; |
||||
NSMutableArray *oneofsArray; |
||||
NSMutableArray *optionsArray; |
||||
GPBSourceContext *sourceContext; |
||||
} GPBType__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "name", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBType_FieldNumber_Name, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBType__storage_, name), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "fieldsArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBField), |
||||
.number = GPBType_FieldNumber_FieldsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBType__storage_, fieldsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "oneofsArray", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBType_FieldNumber_OneofsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBType__storage_, oneofsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "optionsArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption), |
||||
.number = GPBType_FieldNumber_OptionsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBType__storage_, optionsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "sourceContext", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext), |
||||
.number = GPBType_FieldNumber_SourceContext, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBType__storage_, sourceContext), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "syntax", |
||||
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor, |
||||
.number = GPBType_FieldNumber_Syntax, |
||||
.hasIndex = 2, |
||||
.offset = (uint32_t)offsetof(GPBType__storage_, syntax), |
||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, |
||||
.dataType = GPBDataTypeEnum, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBType class] |
||||
rootClass:[GPBTypeRoot class] |
||||
file:GPBTypeRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBType__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
int32_t GPBType_Syntax_RawValue(GPBType *message) { |
||||
GPBDescriptor *descriptor = [GPBType descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBType_FieldNumber_Syntax]; |
||||
return GPBGetMessageInt32Field(message, field); |
||||
} |
||||
|
||||
void SetGPBType_Syntax_RawValue(GPBType *message, int32_t value) { |
||||
GPBDescriptor *descriptor = [GPBType descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBType_FieldNumber_Syntax]; |
||||
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); |
||||
} |
||||
|
||||
#pragma mark - GPBField |
||||
|
||||
@implementation GPBField |
||||
|
||||
@dynamic kind; |
||||
@dynamic cardinality; |
||||
@dynamic number; |
||||
@dynamic name; |
||||
@dynamic typeURL; |
||||
@dynamic oneofIndex; |
||||
@dynamic packed; |
||||
@dynamic optionsArray, optionsArray_Count; |
||||
@dynamic jsonName; |
||||
@dynamic defaultValue; |
||||
|
||||
typedef struct GPBField__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
GPBField_Kind kind; |
||||
GPBField_Cardinality cardinality; |
||||
int32_t number; |
||||
int32_t oneofIndex; |
||||
NSString *name; |
||||
NSString *typeURL; |
||||
NSMutableArray *optionsArray; |
||||
NSString *jsonName; |
||||
NSString *defaultValue; |
||||
} GPBField__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "kind", |
||||
.dataTypeSpecific.enumDescFunc = GPBField_Kind_EnumDescriptor, |
||||
.number = GPBField_FieldNumber_Kind, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBField__storage_, kind), |
||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, |
||||
.dataType = GPBDataTypeEnum, |
||||
}, |
||||
{ |
||||
.name = "cardinality", |
||||
.dataTypeSpecific.enumDescFunc = GPBField_Cardinality_EnumDescriptor, |
||||
.number = GPBField_FieldNumber_Cardinality, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBField__storage_, cardinality), |
||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, |
||||
.dataType = GPBDataTypeEnum, |
||||
}, |
||||
{ |
||||
.name = "number", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBField_FieldNumber_Number, |
||||
.hasIndex = 2, |
||||
.offset = (uint32_t)offsetof(GPBField__storage_, number), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeInt32, |
||||
}, |
||||
{ |
||||
.name = "name", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBField_FieldNumber_Name, |
||||
.hasIndex = 3, |
||||
.offset = (uint32_t)offsetof(GPBField__storage_, name), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "typeURL", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBField_FieldNumber_TypeURL, |
||||
.hasIndex = 4, |
||||
.offset = (uint32_t)offsetof(GPBField__storage_, typeURL), |
||||
.flags = GPBFieldOptional | GPBFieldTextFormatNameCustom, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "oneofIndex", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBField_FieldNumber_OneofIndex, |
||||
.hasIndex = 5, |
||||
.offset = (uint32_t)offsetof(GPBField__storage_, oneofIndex), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeInt32, |
||||
}, |
||||
{ |
||||
.name = "packed", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBField_FieldNumber_Packed, |
||||
.hasIndex = 6, |
||||
.offset = 7, // Stored in _has_storage_ to save space. |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeBool, |
||||
}, |
||||
{ |
||||
.name = "optionsArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption), |
||||
.number = GPBField_FieldNumber_OptionsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBField__storage_, optionsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "jsonName", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBField_FieldNumber_JsonName, |
||||
.hasIndex = 8, |
||||
.offset = (uint32_t)offsetof(GPBField__storage_, jsonName), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "defaultValue", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBField_FieldNumber_DefaultValue, |
||||
.hasIndex = 9, |
||||
.offset = (uint32_t)offsetof(GPBField__storage_, defaultValue), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBField class] |
||||
rootClass:[GPBTypeRoot class] |
||||
file:GPBTypeRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBField__storage_) |
||||
flags:0]; |
||||
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS |
||||
static const char *extraTextFormatInfo = |
||||
"\001\006\004\241!!\000"; |
||||
[localDescriptor setupExtraTextInfo:extraTextFormatInfo]; |
||||
#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
int32_t GPBField_Kind_RawValue(GPBField *message) { |
||||
GPBDescriptor *descriptor = [GPBField descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Kind]; |
||||
return GPBGetMessageInt32Field(message, field); |
||||
} |
||||
|
||||
void SetGPBField_Kind_RawValue(GPBField *message, int32_t value) { |
||||
GPBDescriptor *descriptor = [GPBField descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Kind]; |
||||
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); |
||||
} |
||||
|
||||
int32_t GPBField_Cardinality_RawValue(GPBField *message) { |
||||
GPBDescriptor *descriptor = [GPBField descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Cardinality]; |
||||
return GPBGetMessageInt32Field(message, field); |
||||
} |
||||
|
||||
void SetGPBField_Cardinality_RawValue(GPBField *message, int32_t value) { |
||||
GPBDescriptor *descriptor = [GPBField descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Cardinality]; |
||||
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); |
||||
} |
||||
|
||||
#pragma mark - Enum GPBField_Kind |
||||
|
||||
GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) { |
||||
static GPBEnumDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
static const char *valueNames = |
||||
"TypeUnknown\000TypeDouble\000TypeFloat\000TypeInt" |
||||
"64\000TypeUint64\000TypeInt32\000TypeFixed64\000Type" |
||||
"Fixed32\000TypeBool\000TypeString\000TypeGroup\000Ty" |
||||
"peMessage\000TypeBytes\000TypeUint32\000TypeEnum\000" |
||||
"TypeSfixed32\000TypeSfixed64\000TypeSint32\000Typ" |
||||
"eSint64\000"; |
||||
static const int32_t values[] = { |
||||
GPBField_Kind_TypeUnknown, |
||||
GPBField_Kind_TypeDouble, |
||||
GPBField_Kind_TypeFloat, |
||||
GPBField_Kind_TypeInt64, |
||||
GPBField_Kind_TypeUint64, |
||||
GPBField_Kind_TypeInt32, |
||||
GPBField_Kind_TypeFixed64, |
||||
GPBField_Kind_TypeFixed32, |
||||
GPBField_Kind_TypeBool, |
||||
GPBField_Kind_TypeString, |
||||
GPBField_Kind_TypeGroup, |
||||
GPBField_Kind_TypeMessage, |
||||
GPBField_Kind_TypeBytes, |
||||
GPBField_Kind_TypeUint32, |
||||
GPBField_Kind_TypeEnum, |
||||
GPBField_Kind_TypeSfixed32, |
||||
GPBField_Kind_TypeSfixed64, |
||||
GPBField_Kind_TypeSint32, |
||||
GPBField_Kind_TypeSint64, |
||||
}; |
||||
GPBEnumDescriptor *worker = |
||||
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Kind) |
||||
valueNames:valueNames |
||||
values:values |
||||
count:(uint32_t)(sizeof(values) / sizeof(int32_t)) |
||||
enumVerifier:GPBField_Kind_IsValidValue]; |
||||
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { |
||||
[worker release]; |
||||
} |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
BOOL GPBField_Kind_IsValidValue(int32_t value__) { |
||||
switch (value__) { |
||||
case GPBField_Kind_TypeUnknown: |
||||
case GPBField_Kind_TypeDouble: |
||||
case GPBField_Kind_TypeFloat: |
||||
case GPBField_Kind_TypeInt64: |
||||
case GPBField_Kind_TypeUint64: |
||||
case GPBField_Kind_TypeInt32: |
||||
case GPBField_Kind_TypeFixed64: |
||||
case GPBField_Kind_TypeFixed32: |
||||
case GPBField_Kind_TypeBool: |
||||
case GPBField_Kind_TypeString: |
||||
case GPBField_Kind_TypeGroup: |
||||
case GPBField_Kind_TypeMessage: |
||||
case GPBField_Kind_TypeBytes: |
||||
case GPBField_Kind_TypeUint32: |
||||
case GPBField_Kind_TypeEnum: |
||||
case GPBField_Kind_TypeSfixed32: |
||||
case GPBField_Kind_TypeSfixed64: |
||||
case GPBField_Kind_TypeSint32: |
||||
case GPBField_Kind_TypeSint64: |
||||
return YES; |
||||
default: |
||||
return NO; |
||||
} |
||||
} |
||||
|
||||
#pragma mark - Enum GPBField_Cardinality |
||||
|
||||
GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) { |
||||
static GPBEnumDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
static const char *valueNames = |
||||
"CardinalityUnknown\000CardinalityOptional\000C" |
||||
"ardinalityRequired\000CardinalityRepeated\000"; |
||||
static const int32_t values[] = { |
||||
GPBField_Cardinality_CardinalityUnknown, |
||||
GPBField_Cardinality_CardinalityOptional, |
||||
GPBField_Cardinality_CardinalityRequired, |
||||
GPBField_Cardinality_CardinalityRepeated, |
||||
}; |
||||
GPBEnumDescriptor *worker = |
||||
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Cardinality) |
||||
valueNames:valueNames |
||||
values:values |
||||
count:(uint32_t)(sizeof(values) / sizeof(int32_t)) |
||||
enumVerifier:GPBField_Cardinality_IsValidValue]; |
||||
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) { |
||||
[worker release]; |
||||
} |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
BOOL GPBField_Cardinality_IsValidValue(int32_t value__) { |
||||
switch (value__) { |
||||
case GPBField_Cardinality_CardinalityUnknown: |
||||
case GPBField_Cardinality_CardinalityOptional: |
||||
case GPBField_Cardinality_CardinalityRequired: |
||||
case GPBField_Cardinality_CardinalityRepeated: |
||||
return YES; |
||||
default: |
||||
return NO; |
||||
} |
||||
} |
||||
|
||||
#pragma mark - GPBEnum |
||||
|
||||
@implementation GPBEnum |
||||
|
||||
@dynamic name; |
||||
@dynamic enumvalueArray, enumvalueArray_Count; |
||||
@dynamic optionsArray, optionsArray_Count; |
||||
@dynamic hasSourceContext, sourceContext; |
||||
@dynamic syntax; |
||||
|
||||
typedef struct GPBEnum__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
GPBSyntax syntax; |
||||
NSString *name; |
||||
NSMutableArray *enumvalueArray; |
||||
NSMutableArray *optionsArray; |
||||
GPBSourceContext *sourceContext; |
||||
} GPBEnum__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "name", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBEnum_FieldNumber_Name, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBEnum__storage_, name), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "enumvalueArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBEnumValue), |
||||
.number = GPBEnum_FieldNumber_EnumvalueArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBEnum__storage_, enumvalueArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "optionsArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption), |
||||
.number = GPBEnum_FieldNumber_OptionsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBEnum__storage_, optionsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "sourceContext", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext), |
||||
.number = GPBEnum_FieldNumber_SourceContext, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBEnum__storage_, sourceContext), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
{ |
||||
.name = "syntax", |
||||
.dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor, |
||||
.number = GPBEnum_FieldNumber_Syntax, |
||||
.hasIndex = 2, |
||||
.offset = (uint32_t)offsetof(GPBEnum__storage_, syntax), |
||||
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, |
||||
.dataType = GPBDataTypeEnum, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBEnum class] |
||||
rootClass:[GPBTypeRoot class] |
||||
file:GPBTypeRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBEnum__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
int32_t GPBEnum_Syntax_RawValue(GPBEnum *message) { |
||||
GPBDescriptor *descriptor = [GPBEnum descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBEnum_FieldNumber_Syntax]; |
||||
return GPBGetMessageInt32Field(message, field); |
||||
} |
||||
|
||||
void SetGPBEnum_Syntax_RawValue(GPBEnum *message, int32_t value) { |
||||
GPBDescriptor *descriptor = [GPBEnum descriptor]; |
||||
GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBEnum_FieldNumber_Syntax]; |
||||
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); |
||||
} |
||||
|
||||
#pragma mark - GPBEnumValue |
||||
|
||||
@implementation GPBEnumValue |
||||
|
||||
@dynamic name; |
||||
@dynamic number; |
||||
@dynamic optionsArray, optionsArray_Count; |
||||
|
||||
typedef struct GPBEnumValue__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
int32_t number; |
||||
NSString *name; |
||||
NSMutableArray *optionsArray; |
||||
} GPBEnumValue__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "name", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBEnumValue_FieldNumber_Name, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, name), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "number", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBEnumValue_FieldNumber_Number, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, number), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeInt32, |
||||
}, |
||||
{ |
||||
.name = "optionsArray", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBOption), |
||||
.number = GPBEnumValue_FieldNumber_OptionsArray, |
||||
.hasIndex = GPBNoHasBit, |
||||
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, optionsArray), |
||||
.flags = GPBFieldRepeated, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBEnumValue class] |
||||
rootClass:[GPBTypeRoot class] |
||||
file:GPBTypeRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBEnumValue__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBOption |
||||
|
||||
@implementation GPBOption |
||||
|
||||
@dynamic name; |
||||
@dynamic hasValue, value; |
||||
|
||||
typedef struct GPBOption__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
NSString *name; |
||||
GPBAny *value; |
||||
} GPBOption__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "name", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBOption_FieldNumber_Name, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBOption__storage_, name), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = GPBStringifySymbol(GPBAny), |
||||
.number = GPBOption_FieldNumber_Value, |
||||
.hasIndex = 1, |
||||
.offset = (uint32_t)offsetof(GPBOption__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeMessage, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBOption class] |
||||
rootClass:[GPBTypeRoot class] |
||||
file:GPBTypeRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBOption__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,182 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: google/protobuf/wrappers.proto
|
||||
|
||||
#import "GPBProtocolBuffers.h" |
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 |
||||
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
||||
#endif |
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
CF_EXTERN_C_BEGIN |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
#pragma mark - GPBWrappersRoot |
||||
|
||||
/// Exposes the extension registry for this file.
|
||||
///
|
||||
/// The base class provides:
|
||||
/// @code
|
||||
/// + (GPBExtensionRegistry *)extensionRegistry;
|
||||
/// @endcode
|
||||
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
/// this file and all files that it depends on.
|
||||
@interface GPBWrappersRoot : GPBRootObject |
||||
@end |
||||
|
||||
#pragma mark - GPBDoubleValue |
||||
|
||||
typedef GPB_ENUM(GPBDoubleValue_FieldNumber) { |
||||
GPBDoubleValue_FieldNumber_Value = 1, |
||||
}; |
||||
|
||||
/// Wrapper message for `double`.
|
||||
///
|
||||
/// The JSON representation for `DoubleValue` is JSON number.
|
||||
@interface GPBDoubleValue : GPBMessage |
||||
|
||||
/// The double value.
|
||||
@property(nonatomic, readwrite) double value; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBFloatValue |
||||
|
||||
typedef GPB_ENUM(GPBFloatValue_FieldNumber) { |
||||
GPBFloatValue_FieldNumber_Value = 1, |
||||
}; |
||||
|
||||
/// Wrapper message for `float`.
|
||||
///
|
||||
/// The JSON representation for `FloatValue` is JSON number.
|
||||
@interface GPBFloatValue : GPBMessage |
||||
|
||||
/// The float value.
|
||||
@property(nonatomic, readwrite) float value; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBInt64Value |
||||
|
||||
typedef GPB_ENUM(GPBInt64Value_FieldNumber) { |
||||
GPBInt64Value_FieldNumber_Value = 1, |
||||
}; |
||||
|
||||
/// Wrapper message for `int64`.
|
||||
///
|
||||
/// The JSON representation for `Int64Value` is JSON string.
|
||||
@interface GPBInt64Value : GPBMessage |
||||
|
||||
/// The int64 value.
|
||||
@property(nonatomic, readwrite) int64_t value; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBUInt64Value |
||||
|
||||
typedef GPB_ENUM(GPBUInt64Value_FieldNumber) { |
||||
GPBUInt64Value_FieldNumber_Value = 1, |
||||
}; |
||||
|
||||
/// Wrapper message for `uint64`.
|
||||
///
|
||||
/// The JSON representation for `UInt64Value` is JSON string.
|
||||
@interface GPBUInt64Value : GPBMessage |
||||
|
||||
/// The uint64 value.
|
||||
@property(nonatomic, readwrite) uint64_t value; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBInt32Value |
||||
|
||||
typedef GPB_ENUM(GPBInt32Value_FieldNumber) { |
||||
GPBInt32Value_FieldNumber_Value = 1, |
||||
}; |
||||
|
||||
/// Wrapper message for `int32`.
|
||||
///
|
||||
/// The JSON representation for `Int32Value` is JSON number.
|
||||
@interface GPBInt32Value : GPBMessage |
||||
|
||||
/// The int32 value.
|
||||
@property(nonatomic, readwrite) int32_t value; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBUInt32Value |
||||
|
||||
typedef GPB_ENUM(GPBUInt32Value_FieldNumber) { |
||||
GPBUInt32Value_FieldNumber_Value = 1, |
||||
}; |
||||
|
||||
/// Wrapper message for `uint32`.
|
||||
///
|
||||
/// The JSON representation for `UInt32Value` is JSON number.
|
||||
@interface GPBUInt32Value : GPBMessage |
||||
|
||||
/// The uint32 value.
|
||||
@property(nonatomic, readwrite) uint32_t value; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBBoolValue |
||||
|
||||
typedef GPB_ENUM(GPBBoolValue_FieldNumber) { |
||||
GPBBoolValue_FieldNumber_Value = 1, |
||||
}; |
||||
|
||||
/// Wrapper message for `bool`.
|
||||
///
|
||||
/// The JSON representation for `BoolValue` is JSON `true` and `false`.
|
||||
@interface GPBBoolValue : GPBMessage |
||||
|
||||
/// The bool value.
|
||||
@property(nonatomic, readwrite) BOOL value; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBStringValue |
||||
|
||||
typedef GPB_ENUM(GPBStringValue_FieldNumber) { |
||||
GPBStringValue_FieldNumber_Value = 1, |
||||
}; |
||||
|
||||
/// Wrapper message for `string`.
|
||||
///
|
||||
/// The JSON representation for `StringValue` is JSON string.
|
||||
@interface GPBStringValue : GPBMessage |
||||
|
||||
/// The string value.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *value; |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBBytesValue |
||||
|
||||
typedef GPB_ENUM(GPBBytesValue_FieldNumber) { |
||||
GPBBytesValue_FieldNumber_Value = 1, |
||||
}; |
||||
|
||||
/// Wrapper message for `bytes`.
|
||||
///
|
||||
/// The JSON representation for `BytesValue` is JSON string.
|
||||
@interface GPBBytesValue : GPBMessage |
||||
|
||||
/// The bytes value.
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSData *value; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
||||
|
||||
CF_EXTERN_C_END |
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,420 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: google/protobuf/wrappers.proto |
||||
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h" |
||||
#import "google/protobuf/Wrappers.pbobjc.h" |
||||
// @@protoc_insertion_point(imports) |
||||
|
||||
#pragma clang diagnostic push |
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
||||
|
||||
#pragma mark - GPBWrappersRoot |
||||
|
||||
@implementation GPBWrappersRoot |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBWrappersRoot_FileDescriptor |
||||
|
||||
static GPBFileDescriptor *GPBWrappersRoot_FileDescriptor(void) { |
||||
// This is called by +initialize so there is no need to worry |
||||
// about thread safety of the singleton. |
||||
static GPBFileDescriptor *descriptor = NULL; |
||||
if (!descriptor) { |
||||
GPBDebugCheckRuntimeVersion(); |
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" |
||||
syntax:GPBFileSyntaxProto3]; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
#pragma mark - GPBDoubleValue |
||||
|
||||
@implementation GPBDoubleValue |
||||
|
||||
@dynamic value; |
||||
|
||||
typedef struct GPBDoubleValue__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
double value; |
||||
} GPBDoubleValue__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBDoubleValue_FieldNumber_Value, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBDoubleValue__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeDouble, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBDoubleValue class] |
||||
rootClass:[GPBWrappersRoot class] |
||||
file:GPBWrappersRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBDoubleValue__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBFloatValue |
||||
|
||||
@implementation GPBFloatValue |
||||
|
||||
@dynamic value; |
||||
|
||||
typedef struct GPBFloatValue__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
float value; |
||||
} GPBFloatValue__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBFloatValue_FieldNumber_Value, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBFloatValue__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeFloat, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBFloatValue class] |
||||
rootClass:[GPBWrappersRoot class] |
||||
file:GPBWrappersRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBFloatValue__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBInt64Value |
||||
|
||||
@implementation GPBInt64Value |
||||
|
||||
@dynamic value; |
||||
|
||||
typedef struct GPBInt64Value__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
int64_t value; |
||||
} GPBInt64Value__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBInt64Value_FieldNumber_Value, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBInt64Value__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeInt64, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBInt64Value class] |
||||
rootClass:[GPBWrappersRoot class] |
||||
file:GPBWrappersRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBInt64Value__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBUInt64Value |
||||
|
||||
@implementation GPBUInt64Value |
||||
|
||||
@dynamic value; |
||||
|
||||
typedef struct GPBUInt64Value__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
uint64_t value; |
||||
} GPBUInt64Value__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBUInt64Value_FieldNumber_Value, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBUInt64Value__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeUInt64, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBUInt64Value class] |
||||
rootClass:[GPBWrappersRoot class] |
||||
file:GPBWrappersRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBUInt64Value__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBInt32Value |
||||
|
||||
@implementation GPBInt32Value |
||||
|
||||
@dynamic value; |
||||
|
||||
typedef struct GPBInt32Value__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
int32_t value; |
||||
} GPBInt32Value__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBInt32Value_FieldNumber_Value, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBInt32Value__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeInt32, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBInt32Value class] |
||||
rootClass:[GPBWrappersRoot class] |
||||
file:GPBWrappersRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBInt32Value__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBUInt32Value |
||||
|
||||
@implementation GPBUInt32Value |
||||
|
||||
@dynamic value; |
||||
|
||||
typedef struct GPBUInt32Value__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
uint32_t value; |
||||
} GPBUInt32Value__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBUInt32Value_FieldNumber_Value, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBUInt32Value__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeUInt32, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBUInt32Value class] |
||||
rootClass:[GPBWrappersRoot class] |
||||
file:GPBWrappersRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBUInt32Value__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBBoolValue |
||||
|
||||
@implementation GPBBoolValue |
||||
|
||||
@dynamic value; |
||||
|
||||
typedef struct GPBBoolValue__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
} GPBBoolValue__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBBoolValue_FieldNumber_Value, |
||||
.hasIndex = 0, |
||||
.offset = 1, // Stored in _has_storage_ to save space. |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeBool, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBBoolValue class] |
||||
rootClass:[GPBWrappersRoot class] |
||||
file:GPBWrappersRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBBoolValue__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBStringValue |
||||
|
||||
@implementation GPBStringValue |
||||
|
||||
@dynamic value; |
||||
|
||||
typedef struct GPBStringValue__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
NSString *value; |
||||
} GPBStringValue__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBStringValue_FieldNumber_Value, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBStringValue__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeString, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBStringValue class] |
||||
rootClass:[GPBWrappersRoot class] |
||||
file:GPBWrappersRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBStringValue__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
#pragma mark - GPBBytesValue |
||||
|
||||
@implementation GPBBytesValue |
||||
|
||||
@dynamic value; |
||||
|
||||
typedef struct GPBBytesValue__storage_ { |
||||
uint32_t _has_storage_[1]; |
||||
NSData *value; |
||||
} GPBBytesValue__storage_; |
||||
|
||||
// This method is threadsafe because it is initially called |
||||
// in +initialize for each subclass. |
||||
+ (GPBDescriptor *)descriptor { |
||||
static GPBDescriptor *descriptor = nil; |
||||
if (!descriptor) { |
||||
static GPBMessageFieldDescription fields[] = { |
||||
{ |
||||
.name = "value", |
||||
.dataTypeSpecific.className = NULL, |
||||
.number = GPBBytesValue_FieldNumber_Value, |
||||
.hasIndex = 0, |
||||
.offset = (uint32_t)offsetof(GPBBytesValue__storage_, value), |
||||
.flags = GPBFieldOptional, |
||||
.dataType = GPBDataTypeBytes, |
||||
}, |
||||
}; |
||||
GPBDescriptor *localDescriptor = |
||||
[GPBDescriptor allocDescriptorForClass:[GPBBytesValue class] |
||||
rootClass:[GPBWrappersRoot class] |
||||
file:GPBWrappersRoot_FileDescriptor() |
||||
fields:fields |
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) |
||||
storageSize:sizeof(GPBBytesValue__storage_) |
||||
flags:0]; |
||||
NSAssert(descriptor == nil, @"Startup recursed!"); |
||||
descriptor = localDescriptor; |
||||
} |
||||
return descriptor; |
||||
} |
||||
|
||||
@end |
||||
|
||||
|
||||
#pragma clang diagnostic pop |
||||
|
||||
// @@protoc_insertion_point(global_scope) |
@ -0,0 +1,4 @@ |
||||
<?php |
||||
|
||||
require_once('test.pb.php'); |
||||
require_once('test_util.php'); |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue