![JAR search and dependency download from the Maven repository](/logo.png)
protoc.defaults1.proto Maven / Gradle / Ivy
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://code.google.com/p/protobuf/
//
// 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.
// An excerpt from unittest.proto to test default values.
package default.value.tests;
message TestExtremeDefaultValues {
optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF];
optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
optional int32 small_int32 = 4 [default = -0x7FFFFFFF];
optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF];
optional int32 really_small_int32 = 6 [default = -0x80000000];
optional int64 really_small_int64 = 7 [default = -0x8000000000000000];
// The default value here is UTF-8 for "\u1234". (We could also just type
// the UTF-8 text directly into this text file rather than escape it, but
// lots of people use editors that would be confused by this.)
optional string utf8_string = 8 [default = "\341\210\264"];
// Tests for single-precision floating-point values.
optional float zero_float = 9 [default = 0];
optional float one_float = 10 [default = 1];
optional float small_float = 11 [default = 1.5];
optional float negative_one_float = 12 [default = -1];
optional float negative_float = 13 [default = -1.5];
// Using exponents
optional float large_float = 14 [default = 2E8];
optional float small_negative_float = 15 [default = -8e-28];
// Text for nonfinite floating-point values.
optional double inf_double = 16 [default = inf];
optional double neg_inf_double = 17 [default = -inf];
optional double nan_double = 18 [default = nan];
optional float inf_float = 19 [default = inf];
optional float neg_inf_float = 20 [default = -inf];
optional float nan_float = 21 [default = nan];
// Tests for C++ trigraphs.
// Trigraphs should be escaped in C++ generated files, but they should not be
// escaped for other languages.
// Note that in .proto file, "\?" is a valid way to escape ? in string
// literals.
optional string cpp_trigraph = 22 [default = "? \? ?? \?? \??? ??/ ?\?-"];
// String defaults containing the character '\000'
optional string string_with_zero = 23 [default = "hel\000lo"];
optional bytes bytes_with_zero = 24 [default = "wor\000ld"];
optional string string_piece_with_zero = 25 [ctype=STRING_PIECE,
default="ab\000c"];
optional string cord_with_zero = 26 [ctype=CORD,
default="12\0003"];
optional string replacement_string = 27 [default="${unknown}"];
// Singular with defaults
optional int32 default_int32_extension = 61 [default = 41 ];
optional int64 default_int64_extension = 62 [default = 42 ];
optional uint32 default_uint32_extension = 63 [default = 43 ];
optional uint64 default_uint64_extension = 64 [default = 44 ];
optional sint32 default_sint32_extension = 65 [default = -45 ];
optional sint64 default_sint64_extension = 66 [default = 46 ];
optional fixed32 default_fixed32_extension = 67 [default = 47 ];
optional fixed64 default_fixed64_extension = 68 [default = 48 ];
optional sfixed32 default_sfixed32_extension = 69 [default = 49 ];
optional sfixed64 default_sfixed64_extension = 70 [default = -50 ];
optional float default_float_extension = 71 [default = 51.5 ];
optional double default_double_extension = 72 [default = 52e3 ];
optional bool default_bool_extension = 73 [default = true ];
optional string default_string_extension = 74 [default = "hello"];
optional bytes default_bytes_extension = 75 [default = "world"];
}
message ProtocShouldNotConvert {
optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF];
optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
optional int32 small_int32 = 4 [default = -0x7FFFFFFF];
optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF];
optional int32 really_small_int32 = 6 [default = -0x80000000];
optional int64 really_small_int64 = 7 [default = -0x8000000000000000];
// Using exponents
optional float large_float = 14 [default = 2E8];
optional float small_negative_float = 15 [default = -8e-28];
optional double default_double_extension = 72 [default = 52e3 ];
}
message SameAsProtoc {
optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
// The default value here is UTF-8 for "\u1234". (We could also just type
// the UTF-8 text directly into this text file rather than escape it, but
// lots of people use editors that would be confused by this.)
optional string utf8_string = 8 [default = "\341\210\264"];
// Tests for single-precision floating-point values.
optional float zero_float = 9 [default = 0];
optional float one_float = 10 [default = 1];
optional float small_float = 11 [default = 1.5];
optional float negative_one_float = 12 [default = -1];
optional float negative_float = 13 [default = -1.5];
// Text for nonfinite floating-point values.
optional double inf_double = 16 [default = inf];
optional double neg_inf_double = 17 [default = -inf];
optional double nan_double = 18 [default = nan];
optional float inf_float = 19 [default = inf];
optional float neg_inf_float = 20 [default = -inf];
optional float nan_float = 21 [default = nan];
// Tests for C++ trigraphs.
// Trigraphs should be escaped in C++ generated files, but they should not be
// escaped for other languages.
// Note that in .proto file, "\?" is a valid way to escape ? in string
// literals.
optional string cpp_trigraph = 22 [default = "? \? ?? \?? \??? ??/ ?\?-"];
// String defaults containing the character '\000'
optional string string_with_zero = 23 [default = "hel\000lo"];
optional bytes bytes_with_zero = 24 [default = "wor\000ld"];
optional string string_piece_with_zero = 25 [ctype=STRING_PIECE,
default="ab\000c"];
optional string cord_with_zero = 26 [ctype=CORD,
default="12\0003"];
optional string replacement_string = 27 [default="${unknown}"];
// Singular with defaults
optional int32 default_int32_extension = 61 [default = 41 ];
optional int64 default_int64_extension = 62 [default = 42 ];
optional uint32 default_uint32_extension = 63 [default = 43 ];
optional uint64 default_uint64_extension = 64 [default = 44 ];
optional sint32 default_sint32_extension = 65 [default = -45 ];
optional sint64 default_sint64_extension = 66 [default = 46 ];
optional fixed32 default_fixed32_extension = 67 [default = 47 ];
optional fixed64 default_fixed64_extension = 68 [default = 48 ];
optional sfixed32 default_sfixed32_extension = 69 [default = 49 ];
optional sfixed64 default_sfixed64_extension = 70 [default = -50 ];
optional float default_float_extension = 71 [default = 51.5 ];
optional bool default_bool_extension = 73 [default = true ];
optional string default_string_extension = 74 [default = "hello"];
optional bytes default_bytes_extension = 75 [default = "world"];
}
// needs to be at the very end of this proto to be scanned by tests!!!
message SameAsProto {
optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF];
optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
optional int32 small_int32 = 4 [default = -0x7FFFFFFF];
optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF];
optional int32 really_small_int32 = 6 [default = -0x80000000];
optional int64 really_small_int64 = 7 [default = -0x8000000000000000];
// The default value here is UTF-8 for "\u1234". (We could also just type
// the UTF-8 text directly into this text file rather than escape it, but
// lots of people use editors that would be confused by this.)
optional string utf8_string = 8 [default = "\341\210\264"];
// Tests for single-precision floating-point values.
optional float zero_float = 9 [default = 0];
optional float one_float = 10 [default = 1];
optional float small_float = 11 [default = 1.5];
optional float negative_one_float = 12 [default = -1];
optional float negative_float = 13 [default = -1.5];
// Using exponents
optional float large_float = 14 [default = 2E8];
optional float small_negative_float = 15 [default = -8e-28];
// Text for nonfinite floating-point values.
optional double inf_double = 16 [default = inf];
optional double neg_inf_double = 17 [default = -inf];
optional double nan_double = 18 [default = nan];
optional float inf_float = 19 [default = inf];
optional float neg_inf_float = 20 [default = -inf];
optional float nan_float = 21 [default = nan];
// String defaults containing the character '\000'
optional string string_with_zero = 23 [default = "hel\000lo"];
optional string string_piece_with_zero = 25 [ctype=STRING_PIECE, default="ab\000c"];
optional string cord_with_zero = 26 [ctype=CORD, default="12\0003"];
optional string replacement_string = 27 [default="${unknown}"];
// Singular with defaults
optional int32 default_int32_extension = 61 [default = 41 ];
optional int64 default_int64_extension = 62 [default = 42 ];
optional uint32 default_uint32_extension = 63 [default = 43 ];
optional uint64 default_uint64_extension = 64 [default = 44 ];
optional sint32 default_sint32_extension = 65 [default = -45 ];
optional sint64 default_sint64_extension = 66 [default = 46 ];
optional fixed32 default_fixed32_extension = 67 [default = 47 ];
optional fixed64 default_fixed64_extension = 68 [default = 48 ];
optional sfixed32 default_sfixed32_extension = 69 [default = 49 ];
optional sfixed64 default_sfixed64_extension = 70 [default = -50 ];
optional float default_float_extension = 71 [default = 51.5 ];
optional double default_double_extension = 72 [default = 52e3 ];
optional bool default_bool_extension = 73 [default = true ];
optional string default_string_extension = 74 [default = "hello"];
optional bytes default_bytes_extension = 75 [default = "world"];
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy