xref: /aosp_15_r20/external/protobuf/src/google/protobuf/util/internal/constants.h (revision 1b3f573f81763fcece89efc2b6a5209149e44ab8)
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.  All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 //     * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //     * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 //     * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #ifndef GOOGLE_PROTOBUF_UTIL_INTERNAL_CONSTANTS_H__
32 #define GOOGLE_PROTOBUF_UTIL_INTERNAL_CONSTANTS_H__
33 
34 #include <cstdint>
35 
36 #include <google/protobuf/stubs/common.h>
37 
38 // This file contains constants used by //net/proto2/util/converter.
39 
40 namespace google {
41 namespace protobuf {
42 namespace util {
43 namespace converter {
44 // Prefix for type URLs.
45 const char kTypeServiceBaseUrl[] = "type.googleapis.com";
46 
47 // Format string for RFC3339 timestamp formatting.
48 const char kRfc3339TimeFormat[] = "%E4Y-%m-%dT%H:%M:%S";
49 
50 // Same as above, but the year value is not zero-padded i.e. this accepts
51 // timestamps like "1-01-0001T23:59:59Z" instead of "0001-01-0001T23:59:59Z".
52 const char kRfc3339TimeFormatNoPadding[] = "%Y-%m-%dT%H:%M:%S";
53 
54 // Minimum seconds allowed in a google.protobuf.Timestamp value.
55 const int64_t kTimestampMinSeconds = -62135596800LL;
56 
57 // Maximum seconds allowed in a google.protobuf.Timestamp value.
58 const int64_t kTimestampMaxSeconds = 253402300799LL;
59 
60 // Minimum seconds allowed in a google.protobuf.Duration value.
61 const int64_t kDurationMinSeconds = -315576000000LL;
62 
63 // Maximum seconds allowed in a google.protobuf.Duration value.
64 const int64_t kDurationMaxSeconds = 315576000000LL;
65 
66 // Nano seconds in a second.
67 const int32_t kNanosPerSecond = 1000000000;
68 
69 // Type url representing NULL values in google.protobuf.Struct type.
70 const char kStructNullValueTypeUrl[] =
71     "type.googleapis.com/google.protobuf.NullValue";
72 
73 // Type string for google.protobuf.Struct
74 const char kStructType[] = "google.protobuf.Struct";
75 
76 // Type string for struct.proto's google.protobuf.Value value type.
77 const char kStructValueType[] = "google.protobuf.Value";
78 
79 // Type string for struct.proto's google.protobuf.ListValue value type.
80 const char kStructListValueType[] = "google.protobuf.ListValue";
81 
82 // Type string for google.protobuf.Timestamp
83 const char kTimestampType[] = "google.protobuf.Timestamp";
84 
85 // Type string for google.protobuf.Duration
86 const char kDurationType[] = "google.protobuf.Duration";
87 
88 // Type URL for struct value type google.protobuf.Value
89 const char kStructValueTypeUrl[] = "type.googleapis.com/google.protobuf.Value";
90 
91 // Type string for google.protobuf.Any
92 const char kAnyType[] = "google.protobuf.Any";
93 
94 // The protobuf option name of jspb.message_id;
95 const char kOptionJspbMessageId[] = "jspb.message_id";
96 
97 }  // namespace converter
98 }  // namespace util
99 }  // namespace protobuf
100 }  // namespace google
101 #endif  // GOOGLE_PROTOBUF_UTIL_INTERNAL_CONSTANTS_H__
102