diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2016-07-26 17:15:35 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2016-07-26 17:15:35 -0700 |
commit | eb0e6e9397db3f83b381d0c71d42a222f1aa2ca6 (patch) | |
tree | e31783be8ea02cf99f0ee7a4c63db485a8300718 /csharp/src/Google.Protobuf/WellKnownTypes | |
parent | 4b36284bdfdc77896d7c4cb9645433cf86efb069 (diff) | |
download | protobuf-eb0e6e9397db3f83b381d0c71d42a222f1aa2ca6.tar.gz protobuf-eb0e6e9397db3f83b381d0c71d42a222f1aa2ca6.tar.bz2 protobuf-eb0e6e9397db3f83b381d0c71d42a222f1aa2ca6.zip |
Remove languages other than C++, Java and Python.
Change-Id: I348b9796cef6f5f3d3f038ae0de38095cd6c2b7d
Diffstat (limited to 'csharp/src/Google.Protobuf/WellKnownTypes')
17 files changed, 0 insertions, 6585 deletions
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs deleted file mode 100644 index 6f91507b..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs +++ /dev/null @@ -1,285 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/any.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/any.proto</summary> - public static partial class AnyReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/any.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static AnyReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYi", - "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQnIKE2Nv", - "bS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaJWdpdGh1Yi5jb20vZ29s", - "YW5nL3Byb3RvYnVmL3B0eXBlcy9hbnmgAQGiAgNHUEKqAh5Hb29nbGUuUHJv", - "dG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Any), global::Google.Protobuf.WellKnownTypes.Any.Parser, new[]{ "TypeUrl", "Value" }, null, null, null) - })); - } - #endregion - - } - #region Messages - /// <summary> - /// `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); - /// } - /// - /// Example 3: Pack and unpack a message in Python. - /// - /// foo = Foo(...) - /// any = Any() - /// any.Pack(foo) - /// ... - /// if any.Is(Foo.DESCRIPTOR): - /// any.Unpack(foo) - /// ... - /// - /// 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" - /// } - /// </summary> - public sealed partial class Any : pb::IMessage<Any> { - private static readonly pb::MessageParser<Any> _parser = new pb::MessageParser<Any>(() => new Any()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Any> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Any() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Any(Any other) : this() { - typeUrl_ = other.typeUrl_; - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Any Clone() { - return new Any(this); - } - - /// <summary>Field number for the "type_url" field.</summary> - public const int TypeUrlFieldNumber = 1; - private string typeUrl_ = ""; - /// <summary> - /// A URL/resource name whose content describes the type of the - /// serialized protocol buffer message. - /// - /// For URLs which use the scheme `http`, `https`, or no scheme, the - /// following restrictions and interpretations apply: - /// - /// * If no scheme 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.) - /// - /// Schemes other than `http`, `https` (or the empty scheme) might be - /// used with implementation specific semantics. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TypeUrl { - get { return typeUrl_; } - set { - typeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 2; - private pb::ByteString value_ = pb::ByteString.Empty; - /// <summary> - /// Must be a valid serialized protocol buffer of the above specified type. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Value { - get { return value_; } - set { - value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Any); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Any other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (TypeUrl != other.TypeUrl) return false; - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (TypeUrl.Length != 0) hash ^= TypeUrl.GetHashCode(); - if (Value.Length != 0) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (TypeUrl.Length != 0) { - output.WriteRawTag(10); - output.WriteString(TypeUrl); - } - if (Value.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (TypeUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeUrl); - } - if (Value.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Any other) { - if (other == null) { - return; - } - if (other.TypeUrl.Length != 0) { - TypeUrl = other.TypeUrl; - } - if (other.Value.Length != 0) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - TypeUrl = input.ReadString(); - break; - } - case 18: { - Value = input.ReadBytes(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs deleted file mode 100644 index f4fac738..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs +++ /dev/null @@ -1,107 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2015 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. -#endregion - -using Google.Protobuf.Reflection; - -namespace Google.Protobuf.WellKnownTypes -{ - public partial class Any - { - private const string DefaultPrefix = "type.googleapis.com"; - - // This could be moved to MessageDescriptor if we wanted to, but keeping it here means - // all the Any-specific code is in the same place. - private static string GetTypeUrl(MessageDescriptor descriptor, string prefix) => - prefix.EndsWith("/") ? prefix + descriptor.FullName : prefix + "/" + descriptor.FullName; - - /// <summary> - /// Retrieves the type name for a type URL. This is always just the last part of the URL, - /// after the trailing slash. No validation of anything before the trailing slash is performed. - /// If the type URL does not include a slash, an empty string is returned rather than an exception - /// being thrown; this won't match any types, and the calling code is probably in a better position - /// to give a meaningful error. - /// There is no handling of fragments or queries at the moment. - /// </summary> - /// <param name="typeUrl">The URL to extract the type name from</param> - /// <returns>The type name</returns> - internal static string GetTypeName(string typeUrl) - { - int lastSlash = typeUrl.LastIndexOf('/'); - return lastSlash == -1 ? "" : typeUrl.Substring(lastSlash + 1); - } - - /// <summary> - /// Unpacks the content of this Any message into the target message type, - /// which must match the type URL within this Any message. - /// </summary> - /// <typeparam name="T">The type of message to unpack the content into.</typeparam> - /// <returns>The unpacked message.</returns> - /// <exception cref="InvalidProtocolBufferException">The target message type doesn't match the type URL in this message</exception> - public T Unpack<T>() where T : IMessage, new() - { - // Note: this doesn't perform as well is it might. We could take a MessageParser<T> in an alternative overload, - // which would be expected to perform slightly better... although the difference is likely to be negligible. - T target = new T(); - if (GetTypeName(TypeUrl) != target.Descriptor.FullName) - { - throw new InvalidProtocolBufferException( - $"Full type name for {target.Descriptor.Name} is {target.Descriptor.FullName}; Any message's type url is {TypeUrl}"); - } - target.MergeFrom(Value); - return target; - } - - /// <summary> - /// Packs the specified message into an Any message using a type URL prefix of "type.googleapis.com". - /// </summary> - /// <param name="message">The message to pack.</param> - /// <returns>An Any message with the content and type URL of <paramref name="message"/>.</returns> - public static Any Pack(IMessage message) => Pack(message, DefaultPrefix); - - /// <summary> - /// Packs the specified message into an Any message using the specified type URL prefix. - /// </summary> - /// <param name="message">The message to pack.</param> - /// <param name="typeUrlPrefix">The prefix for the type URL.</param> - /// <returns>An Any message with the content and type URL of <paramref name="message"/>.</returns> - public static Any Pack(IMessage message, string typeUrlPrefix) - { - ProtoPreconditions.CheckNotNull(message, nameof(message)); - ProtoPreconditions.CheckNotNull(typeUrlPrefix, nameof(typeUrlPrefix)); - return new Any - { - TypeUrl = GetTypeUrl(message.Descriptor, typeUrlPrefix), - Value = message.ToByteString() - }; - } - } -} diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs deleted file mode 100644 index a9fc51d2..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs +++ /dev/null @@ -1,901 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/api.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/api.proto</summary> - public static partial class ApiReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/api.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static ApiReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chlnb29nbGUvcHJvdG9idWYvYXBpLnByb3RvEg9nb29nbGUucHJvdG9idWYa", - "JGdvb2dsZS9wcm90b2J1Zi9zb3VyY2VfY29udGV4dC5wcm90bxoaZ29vZ2xl", - "L3Byb3RvYnVmL3R5cGUucHJvdG8igQIKA0FwaRIMCgRuYW1lGAEgASgJEigK", - "B21ldGhvZHMYAiADKAsyFy5nb29nbGUucHJvdG9idWYuTWV0aG9kEigKB29w", - "dGlvbnMYAyADKAsyFy5nb29nbGUucHJvdG9idWYuT3B0aW9uEg8KB3ZlcnNp", - "b24YBCABKAkSNgoOc291cmNlX2NvbnRleHQYBSABKAsyHi5nb29nbGUucHJv", - "dG9idWYuU291cmNlQ29udGV4dBImCgZtaXhpbnMYBiADKAsyFi5nb29nbGUu", - "cHJvdG9idWYuTWl4aW4SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3Rv", - "YnVmLlN5bnRheCLVAQoGTWV0aG9kEgwKBG5hbWUYASABKAkSGAoQcmVxdWVz", - "dF90eXBlX3VybBgCIAEoCRIZChFyZXF1ZXN0X3N0cmVhbWluZxgDIAEoCBIZ", - "ChFyZXNwb25zZV90eXBlX3VybBgEIAEoCRIaChJyZXNwb25zZV9zdHJlYW1p", - "bmcYBSABKAgSKAoHb3B0aW9ucxgGIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5P", - "cHRpb24SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3RvYnVmLlN5bnRh", - "eCIjCgVNaXhpbhIMCgRuYW1lGAEgASgJEgwKBHJvb3QYAiABKAlCSwoTY29t", - "Lmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJvdG9QAaABAaICA0dQQqoCHkdvb2ds", - "ZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Api), global::Google.Protobuf.WellKnownTypes.Api.Parser, new[]{ "Name", "Methods", "Options", "Version", "SourceContext", "Mixins", "Syntax" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Method), global::Google.Protobuf.WellKnownTypes.Method.Parser, new[]{ "Name", "RequestTypeUrl", "RequestStreaming", "ResponseTypeUrl", "ResponseStreaming", "Options", "Syntax" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Mixin), global::Google.Protobuf.WellKnownTypes.Mixin.Parser, new[]{ "Name", "Root" }, null, null, null) - })); - } - #endregion - - } - #region Messages - /// <summary> - /// Api is a light-weight descriptor for a protocol buffer service. - /// </summary> - public sealed partial class Api : pb::IMessage<Api> { - private static readonly pb::MessageParser<Api> _parser = new pb::MessageParser<Api>(() => new Api()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Api> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Api() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Api(Api other) : this() { - name_ = other.name_; - methods_ = other.methods_.Clone(); - options_ = other.options_.Clone(); - version_ = other.version_; - SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; - mixins_ = other.mixins_.Clone(); - syntax_ = other.syntax_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Api Clone() { - return new Api(this); - } - - /// <summary>Field number for the "name" field.</summary> - public const int NameFieldNumber = 1; - private string name_ = ""; - /// <summary> - /// The fully qualified name of this api, including package name - /// followed by the api's simple name. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "methods" field.</summary> - public const int MethodsFieldNumber = 2; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Method> _repeated_methods_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Method.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Method> methods_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Method>(); - /// <summary> - /// The methods of this api, in unspecified order. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Method> Methods { - get { return methods_; } - } - - /// <summary>Field number for the "options" field.</summary> - public const int OptionsFieldNumber = 3; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec - = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); - /// <summary> - /// Any metadata attached to the API. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { - get { return options_; } - } - - /// <summary>Field number for the "version" field.</summary> - public const int VersionFieldNumber = 4; - private string version_ = ""; - /// <summary> - /// 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. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Version { - get { return version_; } - set { - version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "source_context" field.</summary> - public const int SourceContextFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; - /// <summary> - /// Source context for the protocol buffer service represented by this - /// message. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { - get { return sourceContext_; } - set { - sourceContext_ = value; - } - } - - /// <summary>Field number for the "mixins" field.</summary> - public const int MixinsFieldNumber = 6; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Mixin> _repeated_mixins_codec - = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Mixin.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Mixin> mixins_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Mixin>(); - /// <summary> - /// Included APIs. See [Mixin][]. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Mixin> Mixins { - get { return mixins_; } - } - - /// <summary>Field number for the "syntax" field.</summary> - public const int SyntaxFieldNumber = 7; - private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; - /// <summary> - /// The source syntax of the service. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { - get { return syntax_; } - set { - syntax_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Api); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Api other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if(!methods_.Equals(other.methods_)) return false; - if(!options_.Equals(other.options_)) return false; - if (Version != other.Version) return false; - if (!object.Equals(SourceContext, other.SourceContext)) return false; - if(!mixins_.Equals(other.mixins_)) return false; - if (Syntax != other.Syntax) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - hash ^= methods_.GetHashCode(); - hash ^= options_.GetHashCode(); - if (Version.Length != 0) hash ^= Version.GetHashCode(); - if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); - hash ^= mixins_.GetHashCode(); - if (Syntax != 0) hash ^= Syntax.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - methods_.WriteTo(output, _repeated_methods_codec); - options_.WriteTo(output, _repeated_options_codec); - if (Version.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Version); - } - if (sourceContext_ != null) { - output.WriteRawTag(42); - output.WriteMessage(SourceContext); - } - mixins_.WriteTo(output, _repeated_mixins_codec); - if (Syntax != 0) { - output.WriteRawTag(56); - output.WriteEnum((int) Syntax); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += methods_.CalculateSize(_repeated_methods_codec); - size += options_.CalculateSize(_repeated_options_codec); - if (Version.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); - } - if (sourceContext_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); - } - size += mixins_.CalculateSize(_repeated_mixins_codec); - if (Syntax != 0) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Api other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - methods_.Add(other.methods_); - options_.Add(other.options_); - if (other.Version.Length != 0) { - Version = other.Version; - } - if (other.sourceContext_ != null) { - if (sourceContext_ == null) { - sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - SourceContext.MergeFrom(other.SourceContext); - } - mixins_.Add(other.mixins_); - if (other.Syntax != 0) { - Syntax = other.Syntax; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - methods_.AddEntriesFrom(input, _repeated_methods_codec); - break; - } - case 26: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 34: { - Version = input.ReadString(); - break; - } - case 42: { - if (sourceContext_ == null) { - sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - input.ReadMessage(sourceContext_); - break; - } - case 50: { - mixins_.AddEntriesFrom(input, _repeated_mixins_codec); - break; - } - case 56: { - syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - } - - } - - /// <summary> - /// Method represents a method of an api. - /// </summary> - public sealed partial class Method : pb::IMessage<Method> { - private static readonly pb::MessageParser<Method> _parser = new pb::MessageParser<Method>(() => new Method()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Method> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Method() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Method(Method other) : this() { - name_ = other.name_; - requestTypeUrl_ = other.requestTypeUrl_; - requestStreaming_ = other.requestStreaming_; - responseTypeUrl_ = other.responseTypeUrl_; - responseStreaming_ = other.responseStreaming_; - options_ = other.options_.Clone(); - syntax_ = other.syntax_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Method Clone() { - return new Method(this); - } - - /// <summary>Field number for the "name" field.</summary> - public const int NameFieldNumber = 1; - private string name_ = ""; - /// <summary> - /// The simple name of this method. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "request_type_url" field.</summary> - public const int RequestTypeUrlFieldNumber = 2; - private string requestTypeUrl_ = ""; - /// <summary> - /// A URL of the input message type. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string RequestTypeUrl { - get { return requestTypeUrl_; } - set { - requestTypeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "request_streaming" field.</summary> - public const int RequestStreamingFieldNumber = 3; - private bool requestStreaming_; - /// <summary> - /// If true, the request is streamed. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool RequestStreaming { - get { return requestStreaming_; } - set { - requestStreaming_ = value; - } - } - - /// <summary>Field number for the "response_type_url" field.</summary> - public const int ResponseTypeUrlFieldNumber = 4; - private string responseTypeUrl_ = ""; - /// <summary> - /// The URL of the output message type. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ResponseTypeUrl { - get { return responseTypeUrl_; } - set { - responseTypeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "response_streaming" field.</summary> - public const int ResponseStreamingFieldNumber = 5; - private bool responseStreaming_; - /// <summary> - /// If true, the response is streamed. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool ResponseStreaming { - get { return responseStreaming_; } - set { - responseStreaming_ = value; - } - } - - /// <summary>Field number for the "options" field.</summary> - public const int OptionsFieldNumber = 6; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec - = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); - /// <summary> - /// Any metadata attached to the method. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { - get { return options_; } - } - - /// <summary>Field number for the "syntax" field.</summary> - public const int SyntaxFieldNumber = 7; - private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; - /// <summary> - /// The source syntax of this method. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { - get { return syntax_; } - set { - syntax_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Method); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Method other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (RequestTypeUrl != other.RequestTypeUrl) return false; - if (RequestStreaming != other.RequestStreaming) return false; - if (ResponseTypeUrl != other.ResponseTypeUrl) return false; - if (ResponseStreaming != other.ResponseStreaming) return false; - if(!options_.Equals(other.options_)) return false; - if (Syntax != other.Syntax) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (RequestTypeUrl.Length != 0) hash ^= RequestTypeUrl.GetHashCode(); - if (RequestStreaming != false) hash ^= RequestStreaming.GetHashCode(); - if (ResponseTypeUrl.Length != 0) hash ^= ResponseTypeUrl.GetHashCode(); - if (ResponseStreaming != false) hash ^= ResponseStreaming.GetHashCode(); - hash ^= options_.GetHashCode(); - if (Syntax != 0) hash ^= Syntax.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (RequestTypeUrl.Length != 0) { - output.WriteRawTag(18); - output.WriteString(RequestTypeUrl); - } - if (RequestStreaming != false) { - output.WriteRawTag(24); - output.WriteBool(RequestStreaming); - } - if (ResponseTypeUrl.Length != 0) { - output.WriteRawTag(34); - output.WriteString(ResponseTypeUrl); - } - if (ResponseStreaming != false) { - output.WriteRawTag(40); - output.WriteBool(ResponseStreaming); - } - options_.WriteTo(output, _repeated_options_codec); - if (Syntax != 0) { - output.WriteRawTag(56); - output.WriteEnum((int) Syntax); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (RequestTypeUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(RequestTypeUrl); - } - if (RequestStreaming != false) { - size += 1 + 1; - } - if (ResponseTypeUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ResponseTypeUrl); - } - if (ResponseStreaming != false) { - size += 1 + 1; - } - size += options_.CalculateSize(_repeated_options_codec); - if (Syntax != 0) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Method other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.RequestTypeUrl.Length != 0) { - RequestTypeUrl = other.RequestTypeUrl; - } - if (other.RequestStreaming != false) { - RequestStreaming = other.RequestStreaming; - } - if (other.ResponseTypeUrl.Length != 0) { - ResponseTypeUrl = other.ResponseTypeUrl; - } - if (other.ResponseStreaming != false) { - ResponseStreaming = other.ResponseStreaming; - } - options_.Add(other.options_); - if (other.Syntax != 0) { - Syntax = other.Syntax; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - RequestTypeUrl = input.ReadString(); - break; - } - case 24: { - RequestStreaming = input.ReadBool(); - break; - } - case 34: { - ResponseTypeUrl = input.ReadString(); - break; - } - case 40: { - ResponseStreaming = input.ReadBool(); - break; - } - case 50: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 56: { - syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - } - - } - - /// <summary> - /// 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"; - /// } - /// ... - /// } - /// </summary> - public sealed partial class Mixin : pb::IMessage<Mixin> { - private static readonly pb::MessageParser<Mixin> _parser = new pb::MessageParser<Mixin>(() => new Mixin()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Mixin> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Mixin() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Mixin(Mixin other) : this() { - name_ = other.name_; - root_ = other.root_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Mixin Clone() { - return new Mixin(this); - } - - /// <summary>Field number for the "name" field.</summary> - public const int NameFieldNumber = 1; - private string name_ = ""; - /// <summary> - /// The fully qualified name of the API which is included. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "root" field.</summary> - public const int RootFieldNumber = 2; - private string root_ = ""; - /// <summary> - /// If non-empty specifies a path under which inherited HTTP paths - /// are rooted. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Root { - get { return root_; } - set { - root_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Mixin); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Mixin other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (Root != other.Root) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Root.Length != 0) hash ^= Root.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (Root.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Root); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (Root.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Root); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Mixin other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.Root.Length != 0) { - Root = other.Root; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - Root = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs deleted file mode 100644 index 5d52330c..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs +++ /dev/null @@ -1,244 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/duration.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/duration.proto</summary> - public static partial class DurationReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/duration.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static DurationReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90", - "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg", - "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq", - "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9uoAEB", - "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90", - "bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, null, null, null) - })); - } - #endregion - - } - #region Messages - /// <summary> - /// 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; - /// } - /// </summary> - public sealed partial class Duration : pb::IMessage<Duration> { - private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Duration> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Duration() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Duration(Duration other) : this() { - seconds_ = other.seconds_; - nanos_ = other.nanos_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Duration Clone() { - return new Duration(this); - } - - /// <summary>Field number for the "seconds" field.</summary> - public const int SecondsFieldNumber = 1; - private long seconds_; - /// <summary> - /// Signed seconds of the span of time. Must be from -315,576,000,000 - /// to +315,576,000,000 inclusive. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Seconds { - get { return seconds_; } - set { - seconds_ = value; - } - } - - /// <summary>Field number for the "nanos" field.</summary> - public const int NanosFieldNumber = 2; - private int nanos_; - /// <summary> - /// 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. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Nanos { - get { return nanos_; } - set { - nanos_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Duration); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Duration other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Seconds != other.Seconds) return false; - if (Nanos != other.Nanos) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Seconds != 0L) hash ^= Seconds.GetHashCode(); - if (Nanos != 0) hash ^= Nanos.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Seconds != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Seconds); - } - if (Nanos != 0) { - output.WriteRawTag(16); - output.WriteInt32(Nanos); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Seconds != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds); - } - if (Nanos != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Duration other) { - if (other == null) { - return; - } - if (other.Seconds != 0L) { - Seconds = other.Seconds; - } - if (other.Nanos != 0) { - Nanos = other.Nanos; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - Seconds = input.ReadInt64(); - break; - } - case 16: { - Nanos = input.ReadInt32(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs deleted file mode 100644 index f164bfd1..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs +++ /dev/null @@ -1,270 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2015 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. -#endregion - -using System; -using System.Globalization; -using System.Text; - -namespace Google.Protobuf.WellKnownTypes -{ - // Manually-written partial class for the Duration well-known type, - // providing a conversion to TimeSpan and convenience operators. - public partial class Duration : ICustomDiagnosticMessage - { - /// <summary> - /// The number of nanoseconds in a second. - /// </summary> - public const int NanosecondsPerSecond = 1000000000; - /// <summary> - /// The number of nanoseconds in a BCL tick (as used by <see cref="TimeSpan"/> and <see cref="DateTime"/>). - /// </summary> - public const int NanosecondsPerTick = 100; - - /// <summary> - /// The maximum permitted number of seconds. - /// </summary> - public const long MaxSeconds = 315576000000L; - - /// <summary> - /// The minimum permitted number of seconds. - /// </summary> - public const long MinSeconds = -315576000000L; - - internal const int MaxNanoseconds = NanosecondsPerSecond - 1; - internal const int MinNanoseconds = -NanosecondsPerSecond + 1; - - internal static bool IsNormalized(long seconds, int nanoseconds) - { - // Simple boundaries - if (seconds < MinSeconds || seconds > MaxSeconds || - nanoseconds < MinNanoseconds || nanoseconds > MaxNanoseconds) - { - return false; - } - // We only have a problem is one is strictly negative and the other is - // strictly positive. - return Math.Sign(seconds) * Math.Sign(nanoseconds) != -1; - } - - /// <summary> - /// Converts this <see cref="Duration"/> to a <see cref="TimeSpan"/>. - /// </summary> - /// <remarks>If the duration is not a precise number of ticks, it is truncated towards 0.</remarks> - /// <returns>The value of this duration, as a <c>TimeSpan</c>.</returns> - /// <exception cref="InvalidOperationException">This value isn't a valid normalized duration, as - /// described in the documentation.</exception> - public TimeSpan ToTimeSpan() - { - checked - { - if (!IsNormalized(Seconds, Nanos)) - { - throw new InvalidOperationException("Duration was not a valid normalized duration"); - } - long ticks = Seconds * TimeSpan.TicksPerSecond + Nanos / NanosecondsPerTick; - return TimeSpan.FromTicks(ticks); - } - } - - /// <summary> - /// Converts the given <see cref="TimeSpan"/> to a <see cref="Duration"/>. - /// </summary> - /// <param name="timeSpan">The <c>TimeSpan</c> to convert.</param> - /// <returns>The value of the given <c>TimeSpan</c>, as a <c>Duration</c>.</returns> - public static Duration FromTimeSpan(TimeSpan timeSpan) - { - checked - { - long ticks = timeSpan.Ticks; - long seconds = ticks / TimeSpan.TicksPerSecond; - int nanos = (int) (ticks % TimeSpan.TicksPerSecond) * NanosecondsPerTick; - return new Duration { Seconds = seconds, Nanos = nanos }; - } - } - - /// <summary> - /// Returns the result of negating the duration. For example, the negation of 5 minutes is -5 minutes. - /// </summary> - /// <param name="value">The duration to negate. Must not be null.</param> - /// <returns>The negated value of this duration.</returns> - public static Duration operator -(Duration value) - { - ProtoPreconditions.CheckNotNull(value, "value"); - checked - { - return Normalize(-value.Seconds, -value.Nanos); - } - } - - /// <summary> - /// Adds the two specified <see cref="Duration"/> values together. - /// </summary> - /// <param name="lhs">The first value to add. Must not be null.</param> - /// <param name="rhs">The second value to add. Must not be null.</param> - /// <returns></returns> - public static Duration operator +(Duration lhs, Duration rhs) - { - ProtoPreconditions.CheckNotNull(lhs, "lhs"); - ProtoPreconditions.CheckNotNull(rhs, "rhs"); - checked - { - return Normalize(lhs.Seconds + rhs.Seconds, lhs.Nanos + rhs.Nanos); - } - } - - /// <summary> - /// Subtracts one <see cref="Duration"/> from another. - /// </summary> - /// <param name="lhs">The duration to subtract from. Must not be null.</param> - /// <param name="rhs">The duration to subtract. Must not be null.</param> - /// <returns>The difference between the two specified durations.</returns> - public static Duration operator -(Duration lhs, Duration rhs) - { - ProtoPreconditions.CheckNotNull(lhs, "lhs"); - ProtoPreconditions.CheckNotNull(rhs, "rhs"); - checked - { - return Normalize(lhs.Seconds - rhs.Seconds, lhs.Nanos - rhs.Nanos); - } - } - - /// <summary> - /// Creates a duration with the normalized values from the given number of seconds and - /// nanoseconds, conforming with the description in the proto file. - /// </summary> - internal static Duration Normalize(long seconds, int nanoseconds) - { - // Ensure that nanoseconds is in the range (-1,000,000,000, +1,000,000,000) - int extraSeconds = nanoseconds / NanosecondsPerSecond; - seconds += extraSeconds; - nanoseconds -= extraSeconds * NanosecondsPerSecond; - - // Now make sure that Sign(seconds) == Sign(nanoseconds) if Sign(seconds) != 0. - if (seconds < 0 && nanoseconds > 0) - { - seconds += 1; - nanoseconds -= NanosecondsPerSecond; - } - else if (seconds > 0 && nanoseconds < 0) - { - seconds -= 1; - nanoseconds += NanosecondsPerSecond; - } - return new Duration { Seconds = seconds, Nanos = nanoseconds }; - } - - /// <summary> - /// Converts a duration specified in seconds/nanoseconds to a string. - /// </summary> - /// <remarks> - /// If the value is a normalized duration in the range described in <c>duration.proto</c>, - /// <paramref name="diagnosticOnly"/> is ignored. Otherwise, if the parameter is <c>true</c>, - /// a JSON object with a warning is returned; if it is <c>false</c>, an <see cref="InvalidOperationException"/> is thrown. - /// </remarks> - /// <param name="seconds">Seconds portion of the duration.</param> - /// <param name="nanoseconds">Nanoseconds portion of the duration.</param> - /// <param name="diagnosticOnly">Determines the handling of non-normalized values</param> - /// <exception cref="InvalidOperationException">The represented duration is invalid, and <paramref name="diagnosticOnly"/> is <c>false</c>.</exception> - internal static string ToJson(long seconds, int nanoseconds, bool diagnosticOnly) - { - if (IsNormalized(seconds, nanoseconds)) - { - var builder = new StringBuilder(); - builder.Append('"'); - // The seconds part will normally provide the minus sign if we need it, but not if it's 0... - if (seconds == 0 && nanoseconds < 0) - { - builder.Append('-'); - } - - builder.Append(seconds.ToString("d", CultureInfo.InvariantCulture)); - AppendNanoseconds(builder, Math.Abs(nanoseconds)); - builder.Append("s\""); - return builder.ToString(); - } - if (diagnosticOnly) - { - // Note: the double braces here are escaping for braces in format strings. - return string.Format(CultureInfo.InvariantCulture, - "{{ \"@warning\": \"Invalid Duration\", \"seconds\": \"{0}\", \"nanos\": {1} }}", - seconds, - nanoseconds); - } - else - { - throw new InvalidOperationException("Non-normalized duration value"); - } - } - - /// <summary> - /// Returns a string representation of this <see cref="Duration"/> for diagnostic purposes. - /// </summary> - /// <remarks> - /// Normally the returned value will be a JSON string value (including leading and trailing quotes) but - /// when the value is non-normalized or out of range, a JSON object representation will be returned - /// instead, including a warning. This is to avoid exceptions being thrown when trying to - /// diagnose problems - the regular JSON formatter will still throw an exception for non-normalized - /// values. - /// </remarks> - /// <returns>A string representation of this value.</returns> - public string ToDiagnosticString() - { - return ToJson(Seconds, Nanos, true); - } - - /// <summary> - /// Appends a number of nanoseconds to a StringBuilder. Either 0 digits are added (in which - /// case no "." is appended), or 3 6 or 9 digits. This is internal for use in Timestamp as well - /// as Duration. - /// </summary> - internal static void AppendNanoseconds(StringBuilder builder, int nanos) - { - if (nanos != 0) - { - builder.Append('.'); - // Output to 3, 6 or 9 digits. - if (nanos % 1000000 == 0) - { - builder.Append((nanos / 1000000).ToString("d3", CultureInfo.InvariantCulture)); - } - else if (nanos % 1000 == 0) - { - builder.Append((nanos / 1000).ToString("d6", CultureInfo.InvariantCulture)); - } - else - { - builder.Append(nanos.ToString("d9", CultureInfo.InvariantCulture)); - } - } - } - } -} diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs deleted file mode 100644 index 1d3376ee..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/empty.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/empty.proto</summary> - public static partial class EmptyReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/empty.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static EmptyReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1", - "ZiIHCgVFbXB0eUJ5ChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv", - "UAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0eaAB", - "AfgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", - "cHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Empty), global::Google.Protobuf.WellKnownTypes.Empty.Parser, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// <summary> - /// 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 `{}`. - /// </summary> - public sealed partial class Empty : pb::IMessage<Empty> { - private static readonly pb::MessageParser<Empty> _parser = new pb::MessageParser<Empty>(() => new Empty()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Empty> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Empty() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Empty(Empty other) : this() { - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Empty Clone() { - return new Empty(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Empty); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Empty other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Empty other) { - if (other == null) { - return; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs deleted file mode 100644 index 3b146822..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs +++ /dev/null @@ -1,357 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/field_mask.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/field_mask.proto</summary> - public static partial class FieldMaskReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/field_mask.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static FieldMaskReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnBy", - "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUJRChNjb20uZ29v", - "Z2xlLnByb3RvYnVmQg5GaWVsZE1hc2tQcm90b1ABoAEBogIDR1BCqgIeR29v", - "Z2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.FieldMask), global::Google.Protobuf.WellKnownTypes.FieldMask.Parser, new[]{ "Paths" }, null, null, null) - })); - } - #endregion - - } - #region Messages - /// <summary> - /// `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. - /// - /// If a repeated field is specified for an update operation, the existing - /// repeated values in the target resource will be overwritten by the new values. - /// Note that a repeated field is only allowed in the last position of a field - /// mask. - /// - /// If a sub-message is specified in the last position of the field mask for an - /// update operation, then the existing sub-message in the target resource is - /// overwritten. Given the target message: - /// - /// f { - /// b { - /// d : 1 - /// x : 2 - /// } - /// c : 1 - /// } - /// - /// And an update message: - /// - /// f { - /// b { - /// d : 10 - /// } - /// } - /// - /// then if the field mask is: - /// - /// paths: "f.b" - /// - /// then the result will be: - /// - /// f { - /// b { - /// d : 10 - /// } - /// c : 1 - /// } - /// - /// However, if the update mask was: - /// - /// paths: "f.b.d" - /// - /// then the result would be: - /// - /// f { - /// b { - /// d : 10 - /// x : 2 - /// } - /// c : 1 - /// } - /// - /// 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. - /// </summary> - public sealed partial class FieldMask : pb::IMessage<FieldMask> { - private static readonly pb::MessageParser<FieldMask> _parser = new pb::MessageParser<FieldMask>(() => new FieldMask()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<FieldMask> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldMask() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldMask(FieldMask other) : this() { - paths_ = other.paths_.Clone(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldMask Clone() { - return new FieldMask(this); - } - - /// <summary>Field number for the "paths" field.</summary> - public const int PathsFieldNumber = 1; - private static readonly pb::FieldCodec<string> _repeated_paths_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField<string> paths_ = new pbc::RepeatedField<string>(); - /// <summary> - /// The set of field mask paths. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<string> Paths { - get { return paths_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FieldMask); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FieldMask other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!paths_.Equals(other.paths_)) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= paths_.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - paths_.WriteTo(output, _repeated_paths_codec); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += paths_.CalculateSize(_repeated_paths_codec); - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FieldMask other) { - if (other == null) { - return; - } - paths_.Add(other.paths_); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - paths_.AddEntriesFrom(input, _repeated_paths_codec); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs deleted file mode 100644 index f9cdb8af..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs +++ /dev/null @@ -1,128 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2016 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. -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; - -namespace Google.Protobuf.WellKnownTypes -{ - // Manually-written partial class for the FieldMask well-known type. - public partial class FieldMask : ICustomDiagnosticMessage - { - /// <summary> - /// Converts a timestamp specified in seconds/nanoseconds to a string. - /// </summary> - /// <remarks> - /// If the value is a normalized duration in the range described in <c>field_mask.proto</c>, - /// <paramref name="diagnosticOnly"/> is ignored. Otherwise, if the parameter is <c>true</c>, - /// a JSON object with a warning is returned; if it is <c>false</c>, an <see cref="InvalidOperationException"/> is thrown. - /// </remarks> - /// <param name="paths">Paths in the field mask</param> - /// <param name="diagnosticOnly">Determines the handling of non-normalized values</param> - /// <exception cref="InvalidOperationException">The represented duration is invalid, and <paramref name="diagnosticOnly"/> is <c>false</c>.</exception> - internal static string ToJson(IList<string> paths, bool diagnosticOnly) - { - var firstInvalid = paths.FirstOrDefault(p => !ValidatePath(p)); - if (firstInvalid == null) - { - var writer = new StringWriter(); -#if DOTNET35 - var query = paths.Select(JsonFormatter.ToCamelCase); - JsonFormatter.WriteString(writer, string.Join(",", query.ToArray())); -#else - JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToCamelCase))); -#endif - return writer.ToString(); - } - else - { - if (diagnosticOnly) - { - var writer = new StringWriter(); - writer.Write("{ \"@warning\": \"Invalid FieldMask\", \"paths\": "); - JsonFormatter.Default.WriteList(writer, (IList)paths); - writer.Write(" }"); - return writer.ToString(); - } - else - { - throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {firstInvalid}"); - } - } - } - - /// <summary> - /// Camel-case converter with added strictness for field mask formatting. - /// </summary> - /// <exception cref="InvalidOperationException">The field mask is invalid for JSON representation</exception> - private static bool ValidatePath(string input) - { - for (int i = 0; i < input.Length; i++) - { - char c = input[i]; - if (c >= 'A' && c <= 'Z') - { - return false; - } - if (c == '_' && i < input.Length - 1) - { - char next = input[i + 1]; - if (next < 'a' || next > 'z') - { - return false; - } - } - } - return true; - } - - /// <summary> - /// Returns a string representation of this <see cref="FieldMask"/> for diagnostic purposes. - /// </summary> - /// <remarks> - /// Normally the returned value will be a JSON string value (including leading and trailing quotes) but - /// when the value is non-normalized or out of range, a JSON object representation will be returned - /// instead, including a warning. This is to avoid exceptions being thrown when trying to - /// diagnose problems - the regular JSON formatter will still throw an exception for non-normalized - /// values. - /// </remarks> - /// <returns>A string representation of this value.</returns> - public string ToDiagnosticString() - { - return ToJson(Paths, true); - } - } -} diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs deleted file mode 100644 index c9992d2d..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs +++ /dev/null @@ -1,169 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/source_context.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/source_context.proto</summary> - public static partial class SourceContextReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/source_context.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static SourceContextReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2ds", - "ZS5wcm90b2J1ZiIiCg1Tb3VyY2VDb250ZXh0EhEKCWZpbGVfbmFtZRgBIAEo", - "CUJVChNjb20uZ29vZ2xlLnByb3RvYnVmQhJTb3VyY2VDb250ZXh0UHJvdG9Q", - "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", - "cHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.SourceContext), global::Google.Protobuf.WellKnownTypes.SourceContext.Parser, new[]{ "FileName" }, null, null, null) - })); - } - #endregion - - } - #region Messages - /// <summary> - /// `SourceContext` represents information about the source of a - /// protobuf element, like the file in which it is defined. - /// </summary> - public sealed partial class SourceContext : pb::IMessage<SourceContext> { - private static readonly pb::MessageParser<SourceContext> _parser = new pb::MessageParser<SourceContext>(() => new SourceContext()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<SourceContext> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SourceContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SourceContext(SourceContext other) : this() { - fileName_ = other.fileName_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SourceContext Clone() { - return new SourceContext(this); - } - - /// <summary>Field number for the "file_name" field.</summary> - public const int FileNameFieldNumber = 1; - private string fileName_ = ""; - /// <summary> - /// The path-qualified name of the .proto file that contained the associated - /// protobuf element. For example: `"google/protobuf/source_context.proto"`. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string FileName { - get { return fileName_; } - set { - fileName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SourceContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SourceContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (FileName != other.FileName) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (FileName.Length != 0) hash ^= FileName.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (FileName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(FileName); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (FileName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(FileName); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SourceContext other) { - if (other == null) { - return; - } - if (other.FileName.Length != 0) { - FileName = other.FileName; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - FileName = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs deleted file mode 100644 index b3d62fbf..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs +++ /dev/null @@ -1,648 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/struct.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/struct.proto</summary> - public static partial class StructReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/struct.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static StructReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9i", - "dWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9i", - "dWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgB", - "IAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToC", - "OAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJv", - "dG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoM", - "c3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8K", - "DHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RI", - "ABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RW", - "YWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIW", - "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W", - "QUxVRRAAQoEBChNjb20uZ29vZ2xlLnByb3RvYnVmQgtTdHJ1Y3RQcm90b1AB", - "WjFnaXRodWIuY29tL2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvc3RydWN0O3N0", - "cnVjdHBioAEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5", - "cGVzYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.NullValue), }, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Struct), global::Google.Protobuf.WellKnownTypes.Struct.Parser, new[]{ "Fields" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Value), global::Google.Protobuf.WellKnownTypes.Value.Parser, new[]{ "NullValue", "NumberValue", "StringValue", "BoolValue", "StructValue", "ListValue" }, new[]{ "Kind" }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.ListValue), global::Google.Protobuf.WellKnownTypes.ListValue.Parser, new[]{ "Values" }, null, null, null) - })); - } - #endregion - - } - #region Enums - /// <summary> - /// `NullValue` is a singleton enumeration to represent the null value for the - /// `Value` type union. - /// - /// The JSON representation for `NullValue` is JSON `null`. - /// </summary> - public enum NullValue { - /// <summary> - /// Null value. - /// </summary> - [pbr::OriginalName("NULL_VALUE")] NullValue = 0, - } - - #endregion - - #region Messages - /// <summary> - /// `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. - /// </summary> - public sealed partial class Struct : pb::IMessage<Struct> { - private static readonly pb::MessageParser<Struct> _parser = new pb::MessageParser<Struct>(() => new Struct()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Struct> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Struct() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Struct(Struct other) : this() { - fields_ = other.fields_.Clone(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Struct Clone() { - return new Struct(this); - } - - /// <summary>Field number for the "fields" field.</summary> - public const int FieldsFieldNumber = 1; - private static readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec _map_fields_codec - = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10); - private readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> fields_ = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>(); - /// <summary> - /// Unordered map of dynamically typed values. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> Fields { - get { return fields_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Struct); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Struct other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Fields.Equals(other.Fields)) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= Fields.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - fields_.WriteTo(output, _map_fields_codec); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += fields_.CalculateSize(_map_fields_codec); - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Struct other) { - if (other == null) { - return; - } - fields_.Add(other.fields_); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - fields_.AddEntriesFrom(input, _map_fields_codec); - break; - } - } - } - } - - } - - /// <summary> - /// `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. - /// </summary> - public sealed partial class Value : pb::IMessage<Value> { - private static readonly pb::MessageParser<Value> _parser = new pb::MessageParser<Value>(() => new Value()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Value> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Value() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Value(Value other) : this() { - switch (other.KindCase) { - case KindOneofCase.NullValue: - NullValue = other.NullValue; - break; - case KindOneofCase.NumberValue: - NumberValue = other.NumberValue; - break; - case KindOneofCase.StringValue: - StringValue = other.StringValue; - break; - case KindOneofCase.BoolValue: - BoolValue = other.BoolValue; - break; - case KindOneofCase.StructValue: - StructValue = other.StructValue.Clone(); - break; - case KindOneofCase.ListValue: - ListValue = other.ListValue.Clone(); - break; - } - - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Value Clone() { - return new Value(this); - } - - /// <summary>Field number for the "null_value" field.</summary> - public const int NullValueFieldNumber = 1; - /// <summary> - /// Represents a null value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.NullValue NullValue { - get { return kindCase_ == KindOneofCase.NullValue ? (global::Google.Protobuf.WellKnownTypes.NullValue) kind_ : 0; } - set { - kind_ = value; - kindCase_ = KindOneofCase.NullValue; - } - } - - /// <summary>Field number for the "number_value" field.</summary> - public const int NumberValueFieldNumber = 2; - /// <summary> - /// Represents a double value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double NumberValue { - get { return kindCase_ == KindOneofCase.NumberValue ? (double) kind_ : 0D; } - set { - kind_ = value; - kindCase_ = KindOneofCase.NumberValue; - } - } - - /// <summary>Field number for the "string_value" field.</summary> - public const int StringValueFieldNumber = 3; - /// <summary> - /// Represents a string value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string StringValue { - get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; } - set { - kind_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - kindCase_ = KindOneofCase.StringValue; - } - } - - /// <summary>Field number for the "bool_value" field.</summary> - public const int BoolValueFieldNumber = 4; - /// <summary> - /// Represents a boolean value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool BoolValue { - get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; } - set { - kind_ = value; - kindCase_ = KindOneofCase.BoolValue; - } - } - - /// <summary>Field number for the "struct_value" field.</summary> - public const int StructValueFieldNumber = 5; - /// <summary> - /// Represents a structured value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Struct StructValue { - get { return kindCase_ == KindOneofCase.StructValue ? (global::Google.Protobuf.WellKnownTypes.Struct) kind_ : null; } - set { - kind_ = value; - kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.StructValue; - } - } - - /// <summary>Field number for the "list_value" field.</summary> - public const int ListValueFieldNumber = 6; - /// <summary> - /// Represents a repeated `Value`. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.ListValue ListValue { - get { return kindCase_ == KindOneofCase.ListValue ? (global::Google.Protobuf.WellKnownTypes.ListValue) kind_ : null; } - set { - kind_ = value; - kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.ListValue; - } - } - - private object kind_; - /// <summary>Enum of possible cases for the "kind" oneof.</summary> - public enum KindOneofCase { - None = 0, - NullValue = 1, - NumberValue = 2, - StringValue = 3, - BoolValue = 4, - StructValue = 5, - ListValue = 6, - } - private KindOneofCase kindCase_ = KindOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public KindOneofCase KindCase { - get { return kindCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearKind() { - kindCase_ = KindOneofCase.None; - kind_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Value); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Value other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (NullValue != other.NullValue) return false; - if (NumberValue != other.NumberValue) return false; - if (StringValue != other.StringValue) return false; - if (BoolValue != other.BoolValue) return false; - if (!object.Equals(StructValue, other.StructValue)) return false; - if (!object.Equals(ListValue, other.ListValue)) return false; - if (KindCase != other.KindCase) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (kindCase_ == KindOneofCase.NullValue) hash ^= NullValue.GetHashCode(); - if (kindCase_ == KindOneofCase.NumberValue) hash ^= NumberValue.GetHashCode(); - if (kindCase_ == KindOneofCase.StringValue) hash ^= StringValue.GetHashCode(); - if (kindCase_ == KindOneofCase.BoolValue) hash ^= BoolValue.GetHashCode(); - if (kindCase_ == KindOneofCase.StructValue) hash ^= StructValue.GetHashCode(); - if (kindCase_ == KindOneofCase.ListValue) hash ^= ListValue.GetHashCode(); - hash ^= (int) kindCase_; - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (kindCase_ == KindOneofCase.NullValue) { - output.WriteRawTag(8); - output.WriteEnum((int) NullValue); - } - if (kindCase_ == KindOneofCase.NumberValue) { - output.WriteRawTag(17); - output.WriteDouble(NumberValue); - } - if (kindCase_ == KindOneofCase.StringValue) { - output.WriteRawTag(26); - output.WriteString(StringValue); - } - if (kindCase_ == KindOneofCase.BoolValue) { - output.WriteRawTag(32); - output.WriteBool(BoolValue); - } - if (kindCase_ == KindOneofCase.StructValue) { - output.WriteRawTag(42); - output.WriteMessage(StructValue); - } - if (kindCase_ == KindOneofCase.ListValue) { - output.WriteRawTag(50); - output.WriteMessage(ListValue); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (kindCase_ == KindOneofCase.NullValue) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) NullValue); - } - if (kindCase_ == KindOneofCase.NumberValue) { - size += 1 + 8; - } - if (kindCase_ == KindOneofCase.StringValue) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(StringValue); - } - if (kindCase_ == KindOneofCase.BoolValue) { - size += 1 + 1; - } - if (kindCase_ == KindOneofCase.StructValue) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(StructValue); - } - if (kindCase_ == KindOneofCase.ListValue) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ListValue); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Value other) { - if (other == null) { - return; - } - switch (other.KindCase) { - case KindOneofCase.NullValue: - NullValue = other.NullValue; - break; - case KindOneofCase.NumberValue: - NumberValue = other.NumberValue; - break; - case KindOneofCase.StringValue: - StringValue = other.StringValue; - break; - case KindOneofCase.BoolValue: - BoolValue = other.BoolValue; - break; - case KindOneofCase.StructValue: - StructValue = other.StructValue; - break; - case KindOneofCase.ListValue: - ListValue = other.ListValue; - break; - } - - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - kind_ = input.ReadEnum(); - kindCase_ = KindOneofCase.NullValue; - break; - } - case 17: { - NumberValue = input.ReadDouble(); - break; - } - case 26: { - StringValue = input.ReadString(); - break; - } - case 32: { - BoolValue = input.ReadBool(); - break; - } - case 42: { - global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); - if (kindCase_ == KindOneofCase.StructValue) { - subBuilder.MergeFrom(StructValue); - } - input.ReadMessage(subBuilder); - StructValue = subBuilder; - break; - } - case 50: { - global::Google.Protobuf.WellKnownTypes.ListValue subBuilder = new global::Google.Protobuf.WellKnownTypes.ListValue(); - if (kindCase_ == KindOneofCase.ListValue) { - subBuilder.MergeFrom(ListValue); - } - input.ReadMessage(subBuilder); - ListValue = subBuilder; - break; - } - } - } - } - - } - - /// <summary> - /// `ListValue` is a wrapper around a repeated field of values. - /// - /// The JSON representation for `ListValue` is JSON array. - /// </summary> - public sealed partial class ListValue : pb::IMessage<ListValue> { - private static readonly pb::MessageParser<ListValue> _parser = new pb::MessageParser<ListValue>(() => new ListValue()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<ListValue> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ListValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ListValue(ListValue other) : this() { - values_ = other.values_.Clone(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ListValue Clone() { - return new ListValue(this); - } - - /// <summary>Field number for the "values" field.</summary> - public const int ValuesFieldNumber = 1; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Value> _repeated_values_codec - = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Value.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> values_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value>(); - /// <summary> - /// Repeated field of dynamically typed values. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> Values { - get { return values_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ListValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ListValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!values_.Equals(other.values_)) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= values_.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - values_.WriteTo(output, _repeated_values_codec); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += values_.CalculateSize(_repeated_values_codec); - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ListValue other) { - if (other == null) { - return; - } - values_.Add(other.values_); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - values_.AddEntriesFrom(input, _repeated_values_codec); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs b/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs deleted file mode 100644 index 8b63d630..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs +++ /dev/null @@ -1,76 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2015 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. -#endregion - -using System; - -namespace Google.Protobuf.WellKnownTypes -{ - /// <summary> - /// Extension methods on BCL time-related types, converting to protobuf types. - /// </summary> - public static class TimeExtensions - { - /// <summary> - /// Converts the given <see cref="DateTime"/> to a <see cref="Timestamp"/>. - /// </summary> - /// <param name="dateTime">The date and time to convert to a timestamp.</param> - /// <exception cref="ArgumentException">The <paramref name="dateTime"/> value has a <see cref="DateTime.Kind"/>other than <c>Utc</c>.</exception> - /// <returns>The converted timestamp.</returns> - public static Timestamp ToTimestamp(this DateTime dateTime) - { - return Timestamp.FromDateTime(dateTime); - } - - /// <summary> - /// Converts the given <see cref="DateTimeOffset"/> to a <see cref="Timestamp"/> - /// </summary> - /// <remarks>The offset is taken into consideration when converting the value (so the same instant in time - /// is represented) but is not a separate part of the resulting value. In other words, there is no - /// roundtrip operation to retrieve the original <c>DateTimeOffset</c>.</remarks> - /// <param name="dateTimeOffset">The date and time (with UTC offset) to convert to a timestamp.</param> - /// <returns>The converted timestamp.</returns> - public static Timestamp ToTimestamp(this DateTimeOffset dateTimeOffset) - { - return Timestamp.FromDateTimeOffset(dateTimeOffset); - } - - /// <summary> - /// Converts the given <see cref="TimeSpan"/> to a <see cref="Duration"/>. - /// </summary> - /// <param name="timeSpan">The time span to convert.</param> - /// <returns>The converted duration.</returns> - public static Duration ToDuration(this TimeSpan timeSpan) - { - return Duration.FromTimeSpan(timeSpan); - } - } -} diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs deleted file mode 100644 index 5157e6d5..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs +++ /dev/null @@ -1,255 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/timestamp.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/timestamp.proto</summary> - public static partial class TimestampReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/timestamp.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static TimestampReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv", - "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY", - "AiABKAVCgQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3Rv", - "UAFaK2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy90aW1lc3Rh", - "bXCgAQH4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlw", - "ZXNiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Timestamp), global::Google.Protobuf.WellKnownTypes.Timestamp.Parser, new[]{ "Seconds", "Nanos" }, null, null, null) - })); - } - #endregion - - } - #region Messages - /// <summary> - /// 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) - /// </summary> - public sealed partial class Timestamp : pb::IMessage<Timestamp> { - private static readonly pb::MessageParser<Timestamp> _parser = new pb::MessageParser<Timestamp>(() => new Timestamp()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Timestamp> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Timestamp() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Timestamp(Timestamp other) : this() { - seconds_ = other.seconds_; - nanos_ = other.nanos_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Timestamp Clone() { - return new Timestamp(this); - } - - /// <summary>Field number for the "seconds" field.</summary> - public const int SecondsFieldNumber = 1; - private long seconds_; - /// <summary> - /// 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. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Seconds { - get { return seconds_; } - set { - seconds_ = value; - } - } - - /// <summary>Field number for the "nanos" field.</summary> - public const int NanosFieldNumber = 2; - private int nanos_; - /// <summary> - /// 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. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Nanos { - get { return nanos_; } - set { - nanos_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Timestamp); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Timestamp other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Seconds != other.Seconds) return false; - if (Nanos != other.Nanos) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Seconds != 0L) hash ^= Seconds.GetHashCode(); - if (Nanos != 0) hash ^= Nanos.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Seconds != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Seconds); - } - if (Nanos != 0) { - output.WriteRawTag(16); - output.WriteInt32(Nanos); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Seconds != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds); - } - if (Nanos != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Timestamp other) { - if (other == null) { - return; - } - if (other.Seconds != 0L) { - Seconds = other.Seconds; - } - if (other.Nanos != 0) { - Nanos = other.Nanos; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - Seconds = input.ReadInt64(); - break; - } - case 16: { - Nanos = input.ReadInt32(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs deleted file mode 100644 index aa403473..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs +++ /dev/null @@ -1,241 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2015 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. -#endregion - -using System; -using System.Globalization; -using System.Text; - -namespace Google.Protobuf.WellKnownTypes -{ - public partial class Timestamp : ICustomDiagnosticMessage - { - private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); - // Constants determined programmatically, but then hard-coded so they can be constant expressions. - private const long BclSecondsAtUnixEpoch = 62135596800; - internal const long UnixSecondsAtBclMaxValue = 253402300799; - internal const long UnixSecondsAtBclMinValue = -BclSecondsAtUnixEpoch; - internal const int MaxNanos = Duration.NanosecondsPerSecond - 1; - - private static bool IsNormalized(long seconds, int nanoseconds) => - nanoseconds >= 0 && - nanoseconds <= MaxNanos && - seconds >= UnixSecondsAtBclMinValue && - seconds <= UnixSecondsAtBclMaxValue; - - /// <summary> - /// Returns the difference between one <see cref="Timestamp"/> and another, as a <see cref="Duration"/>. - /// </summary> - /// <param name="lhs">The timestamp to subtract from. Must not be null.</param> - /// <param name="rhs">The timestamp to subtract. Must not be null.</param> - /// <returns>The difference between the two specified timestamps.</returns> - public static Duration operator -(Timestamp lhs, Timestamp rhs) - { - ProtoPreconditions.CheckNotNull(lhs, "lhs"); - ProtoPreconditions.CheckNotNull(rhs, "rhs"); - checked - { - return Duration.Normalize(lhs.Seconds - rhs.Seconds, lhs.Nanos - rhs.Nanos); - } - } - - /// <summary> - /// Adds a <see cref="Duration"/> to a <see cref="Timestamp"/>, to obtain another <c>Timestamp</c>. - /// </summary> - /// <param name="lhs">The timestamp to add the duration to. Must not be null.</param> - /// <param name="rhs">The duration to add. Must not be null.</param> - /// <returns>The result of adding the duration to the timestamp.</returns> - public static Timestamp operator +(Timestamp lhs, Duration rhs) - { - ProtoPreconditions.CheckNotNull(lhs, "lhs"); - ProtoPreconditions.CheckNotNull(rhs, "rhs"); - checked - { - return Normalize(lhs.Seconds + rhs.Seconds, lhs.Nanos + rhs.Nanos); - } - } - - /// <summary> - /// Subtracts a <see cref="Duration"/> from a <see cref="Timestamp"/>, to obtain another <c>Timestamp</c>. - /// </summary> - /// <param name="lhs">The timestamp to subtract the duration from. Must not be null.</param> - /// <param name="rhs">The duration to subtract.</param> - /// <returns>The result of subtracting the duration from the timestamp.</returns> - public static Timestamp operator -(Timestamp lhs, Duration rhs) - { - ProtoPreconditions.CheckNotNull(lhs, "lhs"); - ProtoPreconditions.CheckNotNull(rhs, "rhs"); - checked - { - return Normalize(lhs.Seconds - rhs.Seconds, lhs.Nanos - rhs.Nanos); - } - } - - /// <summary> - /// Converts this timestamp into a <see cref="DateTime"/>. - /// </summary> - /// <remarks> - /// The resulting <c>DateTime</c> will always have a <c>Kind</c> of <c>Utc</c>. - /// If the timestamp is not a precise number of ticks, it will be truncated towards the start - /// of time. For example, a timestamp with a <see cref="Nanos"/> value of 99 will result in a - /// <see cref="DateTime"/> value precisely on a second. - /// </remarks> - /// <returns>This timestamp as a <c>DateTime</c>.</returns> - /// <exception cref="InvalidOperationException">The timestamp contains invalid values; either it is - /// incorrectly normalized or is outside the valid range.</exception> - public DateTime ToDateTime() - { - if (!IsNormalized(Seconds, Nanos)) - { - throw new InvalidOperationException(@"Timestamp contains invalid values: Seconds={Seconds}; Nanos={Nanos}"); - } - return UnixEpoch.AddSeconds(Seconds).AddTicks(Nanos / Duration.NanosecondsPerTick); - } - - /// <summary> - /// Converts this timestamp into a <see cref="DateTimeOffset"/>. - /// </summary> - /// <remarks> - /// The resulting <c>DateTimeOffset</c> will always have an <c>Offset</c> of zero. - /// If the timestamp is not a precise number of ticks, it will be truncated towards the start - /// of time. For example, a timestamp with a <see cref="Nanos"/> value of 99 will result in a - /// <see cref="DateTimeOffset"/> value precisely on a second. - /// </remarks> - /// <returns>This timestamp as a <c>DateTimeOffset</c>.</returns> - /// <exception cref="InvalidOperationException">The timestamp contains invalid values; either it is - /// incorrectly normalized or is outside the valid range.</exception> - public DateTimeOffset ToDateTimeOffset() - { - return new DateTimeOffset(ToDateTime(), TimeSpan.Zero); - } - - /// <summary> - /// Converts the specified <see cref="DateTime"/> to a <see cref="Timestamp"/>. - /// </summary> - /// <param name="dateTime"></param> - /// <exception cref="ArgumentException">The <c>Kind</c> of <paramref name="dateTime"/> is not <c>DateTimeKind.Utc</c>.</exception> - /// <returns>The converted timestamp.</returns> - public static Timestamp FromDateTime(DateTime dateTime) - { - if (dateTime.Kind != DateTimeKind.Utc) - { - throw new ArgumentException("Conversion from DateTime to Timestamp requires the DateTime kind to be Utc", "dateTime"); - } - // Do the arithmetic using DateTime.Ticks, which is always non-negative, making things simpler. - long secondsSinceBclEpoch = dateTime.Ticks / TimeSpan.TicksPerSecond; - int nanoseconds = (int) (dateTime.Ticks % TimeSpan.TicksPerSecond) * Duration.NanosecondsPerTick; - return new Timestamp { Seconds = secondsSinceBclEpoch - BclSecondsAtUnixEpoch, Nanos = nanoseconds }; - } - - /// <summary> - /// Converts the given <see cref="DateTimeOffset"/> to a <see cref="Timestamp"/> - /// </summary> - /// <remarks>The offset is taken into consideration when converting the value (so the same instant in time - /// is represented) but is not a separate part of the resulting value. In other words, there is no - /// roundtrip operation to retrieve the original <c>DateTimeOffset</c>.</remarks> - /// <param name="dateTimeOffset">The date and time (with UTC offset) to convert to a timestamp.</param> - /// <returns>The converted timestamp.</returns> - public static Timestamp FromDateTimeOffset(DateTimeOffset dateTimeOffset) - { - // We don't need to worry about this having negative ticks: DateTimeOffset is constrained to handle - // values whose *UTC* value is in the range of DateTime. - return FromDateTime(dateTimeOffset.UtcDateTime); - } - - internal static Timestamp Normalize(long seconds, int nanoseconds) - { - int extraSeconds = nanoseconds / Duration.NanosecondsPerSecond; - seconds += extraSeconds; - nanoseconds -= extraSeconds * Duration.NanosecondsPerSecond; - - if (nanoseconds < 0) - { - nanoseconds += Duration.NanosecondsPerSecond; - seconds--; - } - return new Timestamp { Seconds = seconds, Nanos = nanoseconds }; - } - - /// <summary> - /// Converts a timestamp specified in seconds/nanoseconds to a string. - /// </summary> - /// <remarks> - /// If the value is a normalized duration in the range described in <c>timestamp.proto</c>, - /// <paramref name="diagnosticOnly"/> is ignored. Otherwise, if the parameter is <c>true</c>, - /// a JSON object with a warning is returned; if it is <c>false</c>, an <see cref="InvalidOperationException"/> is thrown. - /// </remarks> - /// <param name="seconds">Seconds portion of the duration.</param> - /// <param name="nanoseconds">Nanoseconds portion of the duration.</param> - /// <param name="diagnosticOnly">Determines the handling of non-normalized values</param> - /// <exception cref="InvalidOperationException">The represented duration is invalid, and <paramref name="diagnosticOnly"/> is <c>false</c>.</exception> - internal static string ToJson(long seconds, int nanoseconds, bool diagnosticOnly) - { - if (IsNormalized(seconds, nanoseconds)) - { - // Use .NET's formatting for the value down to the second, including an opening double quote (as it's a string value) - DateTime dateTime = UnixEpoch.AddSeconds(seconds); - var builder = new StringBuilder(); - builder.Append('"'); - builder.Append(dateTime.ToString("yyyy'-'MM'-'dd'T'HH:mm:ss", CultureInfo.InvariantCulture)); - Duration.AppendNanoseconds(builder, nanoseconds); - builder.Append("Z\""); - return builder.ToString(); - } - if (diagnosticOnly) - { - return string.Format(CultureInfo.InvariantCulture, - "{{ \"@warning\": \"Invalid Timestamp\", \"seconds\": \"{0}\", \"nanos\": {1} }}", - seconds, - nanoseconds); - } - else - { - throw new InvalidOperationException("Non-normalized timestamp value"); - } - } - - /// <summary> - /// Returns a string representation of this <see cref="Timestamp"/> for diagnostic purposes. - /// </summary> - /// <remarks> - /// Normally the returned value will be a JSON string value (including leading and trailing quotes) but - /// when the value is non-normalized or out of range, a JSON object representation will be returned - /// instead, including a warning. This is to avoid exceptions being thrown when trying to - /// diagnose problems - the regular JSON formatter will still throw an exception for non-normalized - /// values. - /// </remarks> - /// <returns>A string representation of this value.</returns> - public string ToDiagnosticString() - { - return ToJson(Seconds, Nanos, true); - } - } -} diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs deleted file mode 100644 index 2bad3432..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs +++ /dev/null @@ -1,1437 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/type.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/type.proto</summary> - public static partial class TypeReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/type.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static TypeReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxIPZ29vZ2xlLnByb3RvYnVm", - "Ghlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvGiRnb29nbGUvcHJvdG9idWYv", - "c291cmNlX2NvbnRleHQucHJvdG8i1wEKBFR5cGUSDAoEbmFtZRgBIAEoCRIm", - "CgZmaWVsZHMYAiADKAsyFi5nb29nbGUucHJvdG9idWYuRmllbGQSDgoGb25l", - "b2ZzGAMgAygJEigKB29wdGlvbnMYBCADKAsyFy5nb29nbGUucHJvdG9idWYu", - "T3B0aW9uEjYKDnNvdXJjZV9jb250ZXh0GAUgASgLMh4uZ29vZ2xlLnByb3Rv", - "YnVmLlNvdXJjZUNvbnRleHQSJwoGc3ludGF4GAYgASgOMhcuZ29vZ2xlLnBy", - "b3RvYnVmLlN5bnRheCLVBQoFRmllbGQSKQoEa2luZBgBIAEoDjIbLmdvb2ds", - "ZS5wcm90b2J1Zi5GaWVsZC5LaW5kEjcKC2NhcmRpbmFsaXR5GAIgASgOMiIu", - "Z29vZ2xlLnByb3RvYnVmLkZpZWxkLkNhcmRpbmFsaXR5Eg4KBm51bWJlchgD", - "IAEoBRIMCgRuYW1lGAQgASgJEhAKCHR5cGVfdXJsGAYgASgJEhMKC29uZW9m", - "X2luZGV4GAcgASgFEg4KBnBhY2tlZBgIIAEoCBIoCgdvcHRpb25zGAkgAygL", - "MhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhIRCglqc29uX25hbWUYCiABKAkS", - "FQoNZGVmYXVsdF92YWx1ZRgLIAEoCSLIAgoES2luZBIQCgxUWVBFX1VOS05P", - "V04QABIPCgtUWVBFX0RPVUJMRRABEg4KClRZUEVfRkxPQVQQAhIOCgpUWVBF", - "X0lOVDY0EAMSDwoLVFlQRV9VSU5UNjQQBBIOCgpUWVBFX0lOVDMyEAUSEAoM", - "VFlQRV9GSVhFRDY0EAYSEAoMVFlQRV9GSVhFRDMyEAcSDQoJVFlQRV9CT09M", - "EAgSDwoLVFlQRV9TVFJJTkcQCRIOCgpUWVBFX0dST1VQEAoSEAoMVFlQRV9N", - "RVNTQUdFEAsSDgoKVFlQRV9CWVRFUxAMEg8KC1RZUEVfVUlOVDMyEA0SDQoJ", - "VFlQRV9FTlVNEA4SEQoNVFlQRV9TRklYRUQzMhAPEhEKDVRZUEVfU0ZJWEVE", - "NjQQEBIPCgtUWVBFX1NJTlQzMhAREg8KC1RZUEVfU0lOVDY0EBIidAoLQ2Fy", - "ZGluYWxpdHkSFwoTQ0FSRElOQUxJVFlfVU5LTk9XThAAEhgKFENBUkRJTkFM", - "SVRZX09QVElPTkFMEAESGAoUQ0FSRElOQUxJVFlfUkVRVUlSRUQQAhIYChRD", - "QVJESU5BTElUWV9SRVBFQVRFRBADIs4BCgRFbnVtEgwKBG5hbWUYASABKAkS", - "LQoJZW51bXZhbHVlGAIgAygLMhouZ29vZ2xlLnByb3RvYnVmLkVudW1WYWx1", - "ZRIoCgdvcHRpb25zGAMgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhI2", - "Cg5zb3VyY2VfY29udGV4dBgEIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5Tb3Vy", - "Y2VDb250ZXh0EicKBnN5bnRheBgFIAEoDjIXLmdvb2dsZS5wcm90b2J1Zi5T", - "eW50YXgiUwoJRW51bVZhbHVlEgwKBG5hbWUYASABKAkSDgoGbnVtYmVyGAIg", - "ASgFEigKB29wdGlvbnMYAyADKAsyFy5nb29nbGUucHJvdG9idWYuT3B0aW9u", - "IjsKBk9wdGlvbhIMCgRuYW1lGAEgASgJEiMKBXZhbHVlGAIgASgLMhQuZ29v", - "Z2xlLnByb3RvYnVmLkFueSouCgZTeW50YXgSEQoNU1lOVEFYX1BST1RPMhAA", - "EhEKDVNZTlRBWF9QUk9UTzMQAUJMChNjb20uZ29vZ2xlLnByb3RvYnVmQglU", - "eXBlUHJvdG9QAaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25v", - "d25UeXBlc2IGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), global::Google.Protobuf.WellKnownTypes.Type.Parser, new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext", "Syntax" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Field), global::Google.Protobuf.WellKnownTypes.Field.Parser, new[]{ "Kind", "Cardinality", "Number", "Name", "TypeUrl", "OneofIndex", "Packed", "Options", "JsonName", "DefaultValue" }, null, new[]{ typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Kind), typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) }, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), global::Google.Protobuf.WellKnownTypes.Enum.Parser, new[]{ "Name", "Enumvalue", "Options", "SourceContext", "Syntax" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.EnumValue), global::Google.Protobuf.WellKnownTypes.EnumValue.Parser, new[]{ "Name", "Number", "Options" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Option), global::Google.Protobuf.WellKnownTypes.Option.Parser, new[]{ "Name", "Value" }, null, null, null) - })); - } - #endregion - - } - #region Enums - /// <summary> - /// The syntax in which a protocol buffer element is defined. - /// </summary> - public enum Syntax { - /// <summary> - /// Syntax `proto2`. - /// </summary> - [pbr::OriginalName("SYNTAX_PROTO2")] Proto2 = 0, - /// <summary> - /// Syntax `proto3`. - /// </summary> - [pbr::OriginalName("SYNTAX_PROTO3")] Proto3 = 1, - } - - #endregion - - #region Messages - /// <summary> - /// A protocol buffer message type. - /// </summary> - public sealed partial class Type : pb::IMessage<Type> { - private static readonly pb::MessageParser<Type> _parser = new pb::MessageParser<Type>(() => new Type()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Type> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Type() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Type(Type other) : this() { - name_ = other.name_; - fields_ = other.fields_.Clone(); - oneofs_ = other.oneofs_.Clone(); - options_ = other.options_.Clone(); - SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; - syntax_ = other.syntax_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Type Clone() { - return new Type(this); - } - - /// <summary>Field number for the "name" field.</summary> - public const int NameFieldNumber = 1; - private string name_ = ""; - /// <summary> - /// The fully qualified message name. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "fields" field.</summary> - public const int FieldsFieldNumber = 2; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Field> _repeated_fields_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Field.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field> fields_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field>(); - /// <summary> - /// The list of fields. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field> Fields { - get { return fields_; } - } - - /// <summary>Field number for the "oneofs" field.</summary> - public const int OneofsFieldNumber = 3; - private static readonly pb::FieldCodec<string> _repeated_oneofs_codec - = pb::FieldCodec.ForString(26); - private readonly pbc::RepeatedField<string> oneofs_ = new pbc::RepeatedField<string>(); - /// <summary> - /// The list of types appearing in `oneof` definitions in this type. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<string> Oneofs { - get { return oneofs_; } - } - - /// <summary>Field number for the "options" field.</summary> - public const int OptionsFieldNumber = 4; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec - = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); - /// <summary> - /// The protocol buffer options. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { - get { return options_; } - } - - /// <summary>Field number for the "source_context" field.</summary> - public const int SourceContextFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; - /// <summary> - /// The source context. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { - get { return sourceContext_; } - set { - sourceContext_ = value; - } - } - - /// <summary>Field number for the "syntax" field.</summary> - public const int SyntaxFieldNumber = 6; - private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; - /// <summary> - /// The source syntax. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { - get { return syntax_; } - set { - syntax_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Type); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Type other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if(!fields_.Equals(other.fields_)) return false; - if(!oneofs_.Equals(other.oneofs_)) return false; - if(!options_.Equals(other.options_)) return false; - if (!object.Equals(SourceContext, other.SourceContext)) return false; - if (Syntax != other.Syntax) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - hash ^= fields_.GetHashCode(); - hash ^= oneofs_.GetHashCode(); - hash ^= options_.GetHashCode(); - if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); - if (Syntax != 0) hash ^= Syntax.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - fields_.WriteTo(output, _repeated_fields_codec); - oneofs_.WriteTo(output, _repeated_oneofs_codec); - options_.WriteTo(output, _repeated_options_codec); - if (sourceContext_ != null) { - output.WriteRawTag(42); - output.WriteMessage(SourceContext); - } - if (Syntax != 0) { - output.WriteRawTag(48); - output.WriteEnum((int) Syntax); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += fields_.CalculateSize(_repeated_fields_codec); - size += oneofs_.CalculateSize(_repeated_oneofs_codec); - size += options_.CalculateSize(_repeated_options_codec); - if (sourceContext_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); - } - if (Syntax != 0) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Type other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - fields_.Add(other.fields_); - oneofs_.Add(other.oneofs_); - options_.Add(other.options_); - if (other.sourceContext_ != null) { - if (sourceContext_ == null) { - sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - SourceContext.MergeFrom(other.SourceContext); - } - if (other.Syntax != 0) { - Syntax = other.Syntax; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - fields_.AddEntriesFrom(input, _repeated_fields_codec); - break; - } - case 26: { - oneofs_.AddEntriesFrom(input, _repeated_oneofs_codec); - break; - } - case 34: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 42: { - if (sourceContext_ == null) { - sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - input.ReadMessage(sourceContext_); - break; - } - case 48: { - syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - } - - } - - /// <summary> - /// A single field of a message type. - /// </summary> - public sealed partial class Field : pb::IMessage<Field> { - private static readonly pb::MessageParser<Field> _parser = new pb::MessageParser<Field>(() => new Field()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Field> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Field() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Field(Field other) : this() { - kind_ = other.kind_; - cardinality_ = other.cardinality_; - number_ = other.number_; - name_ = other.name_; - typeUrl_ = other.typeUrl_; - oneofIndex_ = other.oneofIndex_; - packed_ = other.packed_; - options_ = other.options_.Clone(); - jsonName_ = other.jsonName_; - defaultValue_ = other.defaultValue_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Field Clone() { - return new Field(this); - } - - /// <summary>Field number for the "kind" field.</summary> - public const int KindFieldNumber = 1; - private global::Google.Protobuf.WellKnownTypes.Field.Types.Kind kind_ = 0; - /// <summary> - /// The field type. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Field.Types.Kind Kind { - get { return kind_; } - set { - kind_ = value; - } - } - - /// <summary>Field number for the "cardinality" field.</summary> - public const int CardinalityFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality cardinality_ = 0; - /// <summary> - /// The field cardinality. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality Cardinality { - get { return cardinality_; } - set { - cardinality_ = value; - } - } - - /// <summary>Field number for the "number" field.</summary> - public const int NumberFieldNumber = 3; - private int number_; - /// <summary> - /// The field number. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Number { - get { return number_; } - set { - number_ = value; - } - } - - /// <summary>Field number for the "name" field.</summary> - public const int NameFieldNumber = 4; - private string name_ = ""; - /// <summary> - /// The field name. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "type_url" field.</summary> - public const int TypeUrlFieldNumber = 6; - private string typeUrl_ = ""; - /// <summary> - /// The field type URL, without the scheme, for message or enumeration - /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TypeUrl { - get { return typeUrl_; } - set { - typeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "oneof_index" field.</summary> - public const int OneofIndexFieldNumber = 7; - private int oneofIndex_; - /// <summary> - /// 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. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int OneofIndex { - get { return oneofIndex_; } - set { - oneofIndex_ = value; - } - } - - /// <summary>Field number for the "packed" field.</summary> - public const int PackedFieldNumber = 8; - private bool packed_; - /// <summary> - /// Whether to use alternative packed wire representation. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Packed { - get { return packed_; } - set { - packed_ = value; - } - } - - /// <summary>Field number for the "options" field.</summary> - public const int OptionsFieldNumber = 9; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec - = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); - /// <summary> - /// The protocol buffer options. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { - get { return options_; } - } - - /// <summary>Field number for the "json_name" field.</summary> - public const int JsonNameFieldNumber = 10; - private string jsonName_ = ""; - /// <summary> - /// The field JSON name. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string JsonName { - get { return jsonName_; } - set { - jsonName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "default_value" field.</summary> - public const int DefaultValueFieldNumber = 11; - private string defaultValue_ = ""; - /// <summary> - /// The string value of the default value of this field. Proto2 syntax only. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DefaultValue { - get { return defaultValue_; } - set { - defaultValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Field); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Field other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Kind != other.Kind) return false; - if (Cardinality != other.Cardinality) return false; - if (Number != other.Number) return false; - if (Name != other.Name) return false; - if (TypeUrl != other.TypeUrl) return false; - if (OneofIndex != other.OneofIndex) return false; - if (Packed != other.Packed) return false; - if(!options_.Equals(other.options_)) return false; - if (JsonName != other.JsonName) return false; - if (DefaultValue != other.DefaultValue) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Kind != 0) hash ^= Kind.GetHashCode(); - if (Cardinality != 0) hash ^= Cardinality.GetHashCode(); - if (Number != 0) hash ^= Number.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (TypeUrl.Length != 0) hash ^= TypeUrl.GetHashCode(); - if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode(); - if (Packed != false) hash ^= Packed.GetHashCode(); - hash ^= options_.GetHashCode(); - if (JsonName.Length != 0) hash ^= JsonName.GetHashCode(); - if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Kind != 0) { - output.WriteRawTag(8); - output.WriteEnum((int) Kind); - } - if (Cardinality != 0) { - output.WriteRawTag(16); - output.WriteEnum((int) Cardinality); - } - if (Number != 0) { - output.WriteRawTag(24); - output.WriteInt32(Number); - } - if (Name.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Name); - } - if (TypeUrl.Length != 0) { - output.WriteRawTag(50); - output.WriteString(TypeUrl); - } - if (OneofIndex != 0) { - output.WriteRawTag(56); - output.WriteInt32(OneofIndex); - } - if (Packed != false) { - output.WriteRawTag(64); - output.WriteBool(Packed); - } - options_.WriteTo(output, _repeated_options_codec); - if (JsonName.Length != 0) { - output.WriteRawTag(82); - output.WriteString(JsonName); - } - if (DefaultValue.Length != 0) { - output.WriteRawTag(90); - output.WriteString(DefaultValue); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Kind != 0) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Kind); - } - if (Cardinality != 0) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Cardinality); - } - if (Number != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); - } - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (TypeUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeUrl); - } - if (OneofIndex != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofIndex); - } - if (Packed != false) { - size += 1 + 1; - } - size += options_.CalculateSize(_repeated_options_codec); - if (JsonName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonName); - } - if (DefaultValue.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DefaultValue); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Field other) { - if (other == null) { - return; - } - if (other.Kind != 0) { - Kind = other.Kind; - } - if (other.Cardinality != 0) { - Cardinality = other.Cardinality; - } - if (other.Number != 0) { - Number = other.Number; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.TypeUrl.Length != 0) { - TypeUrl = other.TypeUrl; - } - if (other.OneofIndex != 0) { - OneofIndex = other.OneofIndex; - } - if (other.Packed != false) { - Packed = other.Packed; - } - options_.Add(other.options_); - if (other.JsonName.Length != 0) { - JsonName = other.JsonName; - } - if (other.DefaultValue.Length != 0) { - DefaultValue = other.DefaultValue; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - kind_ = (global::Google.Protobuf.WellKnownTypes.Field.Types.Kind) input.ReadEnum(); - break; - } - case 16: { - cardinality_ = (global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) input.ReadEnum(); - break; - } - case 24: { - Number = input.ReadInt32(); - break; - } - case 34: { - Name = input.ReadString(); - break; - } - case 50: { - TypeUrl = input.ReadString(); - break; - } - case 56: { - OneofIndex = input.ReadInt32(); - break; - } - case 64: { - Packed = input.ReadBool(); - break; - } - case 74: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 82: { - JsonName = input.ReadString(); - break; - } - case 90: { - DefaultValue = input.ReadString(); - break; - } - } - } - } - - #region Nested types - /// <summary>Container for nested types declared in the Field message type.</summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - /// <summary> - /// Basic field types. - /// </summary> - public enum Kind { - /// <summary> - /// Field type unknown. - /// </summary> - [pbr::OriginalName("TYPE_UNKNOWN")] TypeUnknown = 0, - /// <summary> - /// Field type double. - /// </summary> - [pbr::OriginalName("TYPE_DOUBLE")] TypeDouble = 1, - /// <summary> - /// Field type float. - /// </summary> - [pbr::OriginalName("TYPE_FLOAT")] TypeFloat = 2, - /// <summary> - /// Field type int64. - /// </summary> - [pbr::OriginalName("TYPE_INT64")] TypeInt64 = 3, - /// <summary> - /// Field type uint64. - /// </summary> - [pbr::OriginalName("TYPE_UINT64")] TypeUint64 = 4, - /// <summary> - /// Field type int32. - /// </summary> - [pbr::OriginalName("TYPE_INT32")] TypeInt32 = 5, - /// <summary> - /// Field type fixed64. - /// </summary> - [pbr::OriginalName("TYPE_FIXED64")] TypeFixed64 = 6, - /// <summary> - /// Field type fixed32. - /// </summary> - [pbr::OriginalName("TYPE_FIXED32")] TypeFixed32 = 7, - /// <summary> - /// Field type bool. - /// </summary> - [pbr::OriginalName("TYPE_BOOL")] TypeBool = 8, - /// <summary> - /// Field type string. - /// </summary> - [pbr::OriginalName("TYPE_STRING")] TypeString = 9, - /// <summary> - /// Field type group. Proto2 syntax only, and deprecated. - /// </summary> - [pbr::OriginalName("TYPE_GROUP")] TypeGroup = 10, - /// <summary> - /// Field type message. - /// </summary> - [pbr::OriginalName("TYPE_MESSAGE")] TypeMessage = 11, - /// <summary> - /// Field type bytes. - /// </summary> - [pbr::OriginalName("TYPE_BYTES")] TypeBytes = 12, - /// <summary> - /// Field type uint32. - /// </summary> - [pbr::OriginalName("TYPE_UINT32")] TypeUint32 = 13, - /// <summary> - /// Field type enum. - /// </summary> - [pbr::OriginalName("TYPE_ENUM")] TypeEnum = 14, - /// <summary> - /// Field type sfixed32. - /// </summary> - [pbr::OriginalName("TYPE_SFIXED32")] TypeSfixed32 = 15, - /// <summary> - /// Field type sfixed64. - /// </summary> - [pbr::OriginalName("TYPE_SFIXED64")] TypeSfixed64 = 16, - /// <summary> - /// Field type sint32. - /// </summary> - [pbr::OriginalName("TYPE_SINT32")] TypeSint32 = 17, - /// <summary> - /// Field type sint64. - /// </summary> - [pbr::OriginalName("TYPE_SINT64")] TypeSint64 = 18, - } - - /// <summary> - /// Whether a field is optional, required, or repeated. - /// </summary> - public enum Cardinality { - /// <summary> - /// For fields with unknown cardinality. - /// </summary> - [pbr::OriginalName("CARDINALITY_UNKNOWN")] Unknown = 0, - /// <summary> - /// For optional fields. - /// </summary> - [pbr::OriginalName("CARDINALITY_OPTIONAL")] Optional = 1, - /// <summary> - /// For required fields. Proto2 syntax only. - /// </summary> - [pbr::OriginalName("CARDINALITY_REQUIRED")] Required = 2, - /// <summary> - /// For repeated fields. - /// </summary> - [pbr::OriginalName("CARDINALITY_REPEATED")] Repeated = 3, - } - - } - #endregion - - } - - /// <summary> - /// Enum type definition. - /// </summary> - public sealed partial class Enum : pb::IMessage<Enum> { - private static readonly pb::MessageParser<Enum> _parser = new pb::MessageParser<Enum>(() => new Enum()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Enum> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Enum() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Enum(Enum other) : this() { - name_ = other.name_; - enumvalue_ = other.enumvalue_.Clone(); - options_ = other.options_.Clone(); - SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; - syntax_ = other.syntax_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Enum Clone() { - return new Enum(this); - } - - /// <summary>Field number for the "name" field.</summary> - public const int NameFieldNumber = 1; - private string name_ = ""; - /// <summary> - /// Enum type name. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "enumvalue" field.</summary> - public const int EnumvalueFieldNumber = 2; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.EnumValue> _repeated_enumvalue_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.EnumValue.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue> enumvalue_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue>(); - /// <summary> - /// Enum value definitions. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue> Enumvalue { - get { return enumvalue_; } - } - - /// <summary>Field number for the "options" field.</summary> - public const int OptionsFieldNumber = 3; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec - = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); - /// <summary> - /// Protocol buffer options. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { - get { return options_; } - } - - /// <summary>Field number for the "source_context" field.</summary> - public const int SourceContextFieldNumber = 4; - private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; - /// <summary> - /// The source context. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { - get { return sourceContext_; } - set { - sourceContext_ = value; - } - } - - /// <summary>Field number for the "syntax" field.</summary> - public const int SyntaxFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; - /// <summary> - /// The source syntax. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { - get { return syntax_; } - set { - syntax_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Enum); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Enum other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if(!enumvalue_.Equals(other.enumvalue_)) return false; - if(!options_.Equals(other.options_)) return false; - if (!object.Equals(SourceContext, other.SourceContext)) return false; - if (Syntax != other.Syntax) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - hash ^= enumvalue_.GetHashCode(); - hash ^= options_.GetHashCode(); - if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); - if (Syntax != 0) hash ^= Syntax.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - enumvalue_.WriteTo(output, _repeated_enumvalue_codec); - options_.WriteTo(output, _repeated_options_codec); - if (sourceContext_ != null) { - output.WriteRawTag(34); - output.WriteMessage(SourceContext); - } - if (Syntax != 0) { - output.WriteRawTag(40); - output.WriteEnum((int) Syntax); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += enumvalue_.CalculateSize(_repeated_enumvalue_codec); - size += options_.CalculateSize(_repeated_options_codec); - if (sourceContext_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); - } - if (Syntax != 0) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Enum other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - enumvalue_.Add(other.enumvalue_); - options_.Add(other.options_); - if (other.sourceContext_ != null) { - if (sourceContext_ == null) { - sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - SourceContext.MergeFrom(other.SourceContext); - } - if (other.Syntax != 0) { - Syntax = other.Syntax; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - enumvalue_.AddEntriesFrom(input, _repeated_enumvalue_codec); - break; - } - case 26: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 34: { - if (sourceContext_ == null) { - sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - input.ReadMessage(sourceContext_); - break; - } - case 40: { - syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - } - - } - - /// <summary> - /// Enum value definition. - /// </summary> - public sealed partial class EnumValue : pb::IMessage<EnumValue> { - private static readonly pb::MessageParser<EnumValue> _parser = new pb::MessageParser<EnumValue>(() => new EnumValue()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<EnumValue> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValue(EnumValue other) : this() { - name_ = other.name_; - number_ = other.number_; - options_ = other.options_.Clone(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValue Clone() { - return new EnumValue(this); - } - - /// <summary>Field number for the "name" field.</summary> - public const int NameFieldNumber = 1; - private string name_ = ""; - /// <summary> - /// Enum value name. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "number" field.</summary> - public const int NumberFieldNumber = 2; - private int number_; - /// <summary> - /// Enum value number. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Number { - get { return number_; } - set { - number_ = value; - } - } - - /// <summary>Field number for the "options" field.</summary> - public const int OptionsFieldNumber = 3; - private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec - = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); - /// <summary> - /// Protocol buffer options. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { - get { return options_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EnumValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EnumValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (Number != other.Number) return false; - if(!options_.Equals(other.options_)) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Number != 0) hash ^= Number.GetHashCode(); - hash ^= options_.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (Number != 0) { - output.WriteRawTag(16); - output.WriteInt32(Number); - } - options_.WriteTo(output, _repeated_options_codec); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (Number != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); - } - size += options_.CalculateSize(_repeated_options_codec); - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EnumValue other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.Number != 0) { - Number = other.Number; - } - options_.Add(other.options_); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Number = input.ReadInt32(); - break; - } - case 26: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - } - } - } - - } - - /// <summary> - /// A protocol buffer option, which can be attached to a message, field, - /// enumeration, etc. - /// </summary> - public sealed partial class Option : pb::IMessage<Option> { - private static readonly pb::MessageParser<Option> _parser = new pb::MessageParser<Option>(() => new Option()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Option> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Option() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Option(Option other) : this() { - name_ = other.name_; - Value = other.value_ != null ? other.Value.Clone() : null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Option Clone() { - return new Option(this); - } - - /// <summary>Field number for the "name" field.</summary> - public const int NameFieldNumber = 1; - private string name_ = ""; - /// <summary> - /// The option's name. For example, `"java_package"`. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Any value_; - /// <summary> - /// The option's value. For example, `"com.google.protobuf"`. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Any Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Option); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Option other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (!object.Equals(Value, other.Value)) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (value_ != null) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (value_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (value_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Value); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Option other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.value_ != null) { - if (value_ == null) { - value_ = new global::Google.Protobuf.WellKnownTypes.Any(); - } - Value.MergeFrom(other.Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - if (value_ == null) { - value_ = new global::Google.Protobuf.WellKnownTypes.Any(); - } - input.ReadMessage(value_); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs deleted file mode 100644 index d34b560d..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs +++ /dev/null @@ -1,99 +0,0 @@ -#region Copyright notice and license -// 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. -#endregion - -namespace Google.Protobuf.WellKnownTypes -{ - public partial class Value - { - /// <summary> - /// Convenience method to create a Value message with a string value. - /// </summary> - /// <param name="value">Value to set for the StringValue property.</param> - /// <returns>A newly-created Value message with the given value.</returns> - public static Value ForString(string value) - { - ProtoPreconditions.CheckNotNull(value, "value"); - return new Value { StringValue = value }; - } - - /// <summary> - /// Convenience method to create a Value message with a number value. - /// </summary> - /// <param name="value">Value to set for the NumberValue property.</param> - /// <returns>A newly-created Value message with the given value.</returns> - public static Value ForNumber(double value) - { - return new Value { NumberValue = value }; - } - - /// <summary> - /// Convenience method to create a Value message with a Boolean value. - /// </summary> - /// <param name="value">Value to set for the BoolValue property.</param> - /// <returns>A newly-created Value message with the given value.</returns> - public static Value ForBool(bool value) - { - return new Value { BoolValue = value }; - } - - /// <summary> - /// Convenience method to create a Value message with a null initial value. - /// </summary> - /// <returns>A newly-created Value message a null initial value.</returns> - public static Value ForNull() - { - return new Value { NullValue = 0 }; - } - - /// <summary> - /// Convenience method to create a Value message with an initial list of values. - /// </summary> - /// <remarks>The values provided are not cloned; the references are copied directly.</remarks> - /// <returns>A newly-created Value message an initial list value.</returns> - public static Value ForList(params Value[] values) - { - ProtoPreconditions.CheckNotNull(values, "values"); - return new Value { ListValue = new ListValue { Values = { values } } }; - } - - /// <summary> - /// Convenience method to create a Value message with an initial struct value - /// </summary> - /// <remarks>The value provided is not cloned; the reference is copied directly.</remarks> - /// <returns>A newly-created Value message an initial struct value.</returns> - public static Value ForStruct(Struct value) - { - ProtoPreconditions.CheckNotNull(value, "value"); - return new Value { StructValue = value }; - } - } -} diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs deleted file mode 100644 index 80f9f98d..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs +++ /dev/null @@ -1,1182 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/wrappers.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// <summary>Holder for reflection information generated from google/protobuf/wrappers.proto</summary> - public static partial class WrappersReflection { - - #region Descriptor - /// <summary>File descriptor for google/protobuf/wrappers.proto</summary> - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static WrappersReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Ch5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8SD2dvb2dsZS5wcm90", - "b2J1ZiIcCgtEb3VibGVWYWx1ZRINCgV2YWx1ZRgBIAEoASIbCgpGbG9hdFZh", - "bHVlEg0KBXZhbHVlGAEgASgCIhsKCkludDY0VmFsdWUSDQoFdmFsdWUYASAB", - "KAMiHAoLVUludDY0VmFsdWUSDQoFdmFsdWUYASABKAQiGwoKSW50MzJWYWx1", - "ZRINCgV2YWx1ZRgBIAEoBSIcCgtVSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEo", - "DSIaCglCb29sVmFsdWUSDQoFdmFsdWUYASABKAgiHAoLU3RyaW5nVmFsdWUS", - "DQoFdmFsdWUYASABKAkiGwoKQnl0ZXNWYWx1ZRINCgV2YWx1ZRgBIAEoDEJ/", - "ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAFaKmdpdGh1", - "Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy93cmFwcGVyc6ABAfgBAaIC", - "A0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.DoubleValue), global::Google.Protobuf.WellKnownTypes.DoubleValue.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.FloatValue), global::Google.Protobuf.WellKnownTypes.FloatValue.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Int64Value), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.UInt64Value), global::Google.Protobuf.WellKnownTypes.UInt64Value.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Int32Value), global::Google.Protobuf.WellKnownTypes.Int32Value.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.UInt32Value), global::Google.Protobuf.WellKnownTypes.UInt32Value.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.BoolValue), global::Google.Protobuf.WellKnownTypes.BoolValue.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.StringValue), global::Google.Protobuf.WellKnownTypes.StringValue.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.BytesValue), global::Google.Protobuf.WellKnownTypes.BytesValue.Parser, new[]{ "Value" }, null, null, null) - })); - } - #endregion - - } - #region Messages - /// <summary> - /// Wrapper message for `double`. - /// - /// The JSON representation for `DoubleValue` is JSON number. - /// </summary> - public sealed partial class DoubleValue : pb::IMessage<DoubleValue> { - private static readonly pb::MessageParser<DoubleValue> _parser = new pb::MessageParser<DoubleValue>(() => new DoubleValue()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<DoubleValue> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DoubleValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DoubleValue(DoubleValue other) : this() { - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DoubleValue Clone() { - return new DoubleValue(this); - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 1; - private double value_; - /// <summary> - /// The double value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DoubleValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DoubleValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value != 0D) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value != 0D) { - output.WriteRawTag(9); - output.WriteDouble(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value != 0D) { - size += 1 + 8; - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DoubleValue other) { - if (other == null) { - return; - } - if (other.Value != 0D) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 9: { - Value = input.ReadDouble(); - break; - } - } - } - } - - } - - /// <summary> - /// Wrapper message for `float`. - /// - /// The JSON representation for `FloatValue` is JSON number. - /// </summary> - public sealed partial class FloatValue : pb::IMessage<FloatValue> { - private static readonly pb::MessageParser<FloatValue> _parser = new pb::MessageParser<FloatValue>(() => new FloatValue()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<FloatValue> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FloatValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FloatValue(FloatValue other) : this() { - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FloatValue Clone() { - return new FloatValue(this); - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 1; - private float value_; - /// <summary> - /// The float value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public float Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FloatValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FloatValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value != 0F) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value != 0F) { - output.WriteRawTag(13); - output.WriteFloat(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value != 0F) { - size += 1 + 4; - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FloatValue other) { - if (other == null) { - return; - } - if (other.Value != 0F) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 13: { - Value = input.ReadFloat(); - break; - } - } - } - } - - } - - /// <summary> - /// Wrapper message for `int64`. - /// - /// The JSON representation for `Int64Value` is JSON string. - /// </summary> - public sealed partial class Int64Value : pb::IMessage<Int64Value> { - private static readonly pb::MessageParser<Int64Value> _parser = new pb::MessageParser<Int64Value>(() => new Int64Value()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Int64Value> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int64Value() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int64Value(Int64Value other) : this() { - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int64Value Clone() { - return new Int64Value(this); - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 1; - private long value_; - /// <summary> - /// The int64 value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Int64Value); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Int64Value other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value != 0L) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Value); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Int64Value other) { - if (other == null) { - return; - } - if (other.Value != 0L) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - Value = input.ReadInt64(); - break; - } - } - } - } - - } - - /// <summary> - /// Wrapper message for `uint64`. - /// - /// The JSON representation for `UInt64Value` is JSON string. - /// </summary> - public sealed partial class UInt64Value : pb::IMessage<UInt64Value> { - private static readonly pb::MessageParser<UInt64Value> _parser = new pb::MessageParser<UInt64Value>(() => new UInt64Value()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<UInt64Value> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt64Value() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt64Value(UInt64Value other) : this() { - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt64Value Clone() { - return new UInt64Value(this); - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 1; - private ulong value_; - /// <summary> - /// The uint64 value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UInt64Value); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UInt64Value other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value != 0UL) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value != 0UL) { - output.WriteRawTag(8); - output.WriteUInt64(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value != 0UL) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Value); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UInt64Value other) { - if (other == null) { - return; - } - if (other.Value != 0UL) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - Value = input.ReadUInt64(); - break; - } - } - } - } - - } - - /// <summary> - /// Wrapper message for `int32`. - /// - /// The JSON representation for `Int32Value` is JSON number. - /// </summary> - public sealed partial class Int32Value : pb::IMessage<Int32Value> { - private static readonly pb::MessageParser<Int32Value> _parser = new pb::MessageParser<Int32Value>(() => new Int32Value()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<Int32Value> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int32Value() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int32Value(Int32Value other) : this() { - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int32Value Clone() { - return new Int32Value(this); - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 1; - private int value_; - /// <summary> - /// The int32 value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Int32Value); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Int32Value other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value != 0) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value != 0) { - output.WriteRawTag(8); - output.WriteInt32(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Value); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Int32Value other) { - if (other == null) { - return; - } - if (other.Value != 0) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - Value = input.ReadInt32(); - break; - } - } - } - } - - } - - /// <summary> - /// Wrapper message for `uint32`. - /// - /// The JSON representation for `UInt32Value` is JSON number. - /// </summary> - public sealed partial class UInt32Value : pb::IMessage<UInt32Value> { - private static readonly pb::MessageParser<UInt32Value> _parser = new pb::MessageParser<UInt32Value>(() => new UInt32Value()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<UInt32Value> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt32Value() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt32Value(UInt32Value other) : this() { - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UInt32Value Clone() { - return new UInt32Value(this); - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 1; - private uint value_; - /// <summary> - /// The uint32 value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UInt32Value); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UInt32Value other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value != 0) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value != 0) { - output.WriteRawTag(8); - output.WriteUInt32(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Value); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UInt32Value other) { - if (other == null) { - return; - } - if (other.Value != 0) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - Value = input.ReadUInt32(); - break; - } - } - } - } - - } - - /// <summary> - /// Wrapper message for `bool`. - /// - /// The JSON representation for `BoolValue` is JSON `true` and `false`. - /// </summary> - public sealed partial class BoolValue : pb::IMessage<BoolValue> { - private static readonly pb::MessageParser<BoolValue> _parser = new pb::MessageParser<BoolValue>(() => new BoolValue()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<BoolValue> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BoolValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BoolValue(BoolValue other) : this() { - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BoolValue Clone() { - return new BoolValue(this); - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 1; - private bool value_; - /// <summary> - /// The bool value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as BoolValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(BoolValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(BoolValue other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - - } - - /// <summary> - /// Wrapper message for `string`. - /// - /// The JSON representation for `StringValue` is JSON string. - /// </summary> - public sealed partial class StringValue : pb::IMessage<StringValue> { - private static readonly pb::MessageParser<StringValue> _parser = new pb::MessageParser<StringValue>(() => new StringValue()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<StringValue> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringValue(StringValue other) : this() { - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringValue Clone() { - return new StringValue(this); - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 1; - private string value_ = ""; - /// <summary> - /// The string value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Value { - get { return value_; } - set { - value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as StringValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StringValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value.Length != 0) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Value); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StringValue other) { - if (other == null) { - return; - } - if (other.Value.Length != 0) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Value = input.ReadString(); - break; - } - } - } - } - - } - - /// <summary> - /// Wrapper message for `bytes`. - /// - /// The JSON representation for `BytesValue` is JSON string. - /// </summary> - public sealed partial class BytesValue : pb::IMessage<BytesValue> { - private static readonly pb::MessageParser<BytesValue> _parser = new pb::MessageParser<BytesValue>(() => new BytesValue()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<BytesValue> Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BytesValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BytesValue(BytesValue other) : this() { - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public BytesValue Clone() { - return new BytesValue(this); - } - - /// <summary>Field number for the "value" field.</summary> - public const int ValueFieldNumber = 1; - private pb::ByteString value_ = pb::ByteString.Empty; - /// <summary> - /// The bytes value. - /// </summary> - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Value { - get { return value_; } - set { - value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as BytesValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(BytesValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value.Length != 0) hash ^= Value.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(BytesValue other) { - if (other == null) { - return; - } - if (other.Value.Length != 0) { - Value = other.Value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Value = input.ReadBytes(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs deleted file mode 100644 index 9f620eb4..00000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs +++ /dev/null @@ -1,42 +0,0 @@ -#region Copyright notice and license -// 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. -#endregion - -namespace Google.Protobuf.WellKnownTypes -{ - public static partial class WrappersReflection - { - /// <summary> - /// Field number for the single "value" field in all wrapper types. - /// </summary> - internal const int WrapperValueFieldNumber = Int32Value.ValueFieldNumber; - } -} |