1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2008 Google Inc. All rights reserved. 3 // 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file or at 6 // https://developers.google.com/open-source/licenses/bsd 7 // 8 // This file contains definitions for the descriptors, so they can be used 9 // without importing descriptor.h 10 11 #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_LITE_H__ 12 #define GOOGLE_PROTOBUF_DESCRIPTOR_LITE_H__ 13 14 namespace google { 15 namespace protobuf { 16 namespace internal { 17 18 class FieldDescriptorLite { 19 public: 20 // Identifies a field type. 0 is reserved for errors. 21 // The order is weird for historical reasons. 22 // Types 12 and up are new in proto2. 23 enum Type { 24 TYPE_DOUBLE = 1, // double, exactly eight bytes on the wire. 25 TYPE_FLOAT = 2, // float, exactly four bytes on the wire. 26 TYPE_INT64 = 3, // int64, varint on the wire. Negative numbers 27 // take 10 bytes. Use TYPE_SINT64 if negative 28 // values are likely. 29 TYPE_UINT64 = 4, // uint64, varint on the wire. 30 TYPE_INT32 = 5, // int32, varint on the wire. Negative numbers 31 // take 10 bytes. Use TYPE_SINT32 if negative 32 // values are likely. 33 TYPE_FIXED64 = 6, // uint64, exactly eight bytes on the wire. 34 TYPE_FIXED32 = 7, // uint32, exactly four bytes on the wire. 35 TYPE_BOOL = 8, // bool, varint on the wire. 36 TYPE_STRING = 9, // UTF-8 text. 37 TYPE_GROUP = 10, // Tag-delimited message. Deprecated. 38 TYPE_MESSAGE = 11, // Length-delimited message. 39 40 TYPE_BYTES = 12, // Arbitrary byte array. 41 TYPE_UINT32 = 13, // uint32, varint on the wire 42 TYPE_ENUM = 14, // Enum, varint on the wire 43 TYPE_SFIXED32 = 15, // int32, exactly four bytes on the wire 44 TYPE_SFIXED64 = 16, // int64, exactly eight bytes on the wire 45 TYPE_SINT32 = 17, // int32, ZigZag-encoded varint on the wire 46 TYPE_SINT64 = 18, // int64, ZigZag-encoded varint on the wire 47 48 MAX_TYPE = 18, // Constant useful for defining lookup tables 49 // indexed by Type. 50 }; 51 52 // Specifies the C++ data type used to represent the field. There is a 53 // fixed mapping from Type to CppType where each Type maps to exactly one 54 // CppType. 0 is reserved for errors. 55 enum CppType { 56 CPPTYPE_INT32 = 1, // TYPE_INT32, TYPE_SINT32, TYPE_SFIXED32 57 CPPTYPE_INT64 = 2, // TYPE_INT64, TYPE_SINT64, TYPE_SFIXED64 58 CPPTYPE_UINT32 = 3, // TYPE_UINT32, TYPE_FIXED32 59 CPPTYPE_UINT64 = 4, // TYPE_UINT64, TYPE_FIXED64 60 CPPTYPE_DOUBLE = 5, // TYPE_DOUBLE 61 CPPTYPE_FLOAT = 6, // TYPE_FLOAT 62 CPPTYPE_BOOL = 7, // TYPE_BOOL 63 CPPTYPE_ENUM = 8, // TYPE_ENUM 64 CPPTYPE_STRING = 9, // TYPE_STRING, TYPE_BYTES 65 CPPTYPE_MESSAGE = 10, // TYPE_MESSAGE, TYPE_GROUP 66 67 MAX_CPPTYPE = 10, // Constant useful for defining lookup tables 68 // indexed by CppType. 69 }; 70 71 // Identifies whether the field is optional, required, or repeated. 0 is 72 // reserved for errors. 73 enum Label { 74 LABEL_OPTIONAL = 1, // optional 75 LABEL_REQUIRED = 2, // required 76 LABEL_REPEATED = 3, // repeated 77 78 MAX_LABEL = 3, // Constant useful for defining lookup tables 79 // indexed by Label. 80 }; 81 82 // Identifies the storage type of a C++ string field. This corresponds to 83 // pb.CppFeatures.StringType, but is compatible with ctype prior to Edition 84 // 2024. 0 is reserved for errors. 85 #ifndef SWIG 86 enum class CppStringType { 87 kView = 1, 88 kCord = 2, 89 kString = 3, 90 }; 91 #endif 92 }; 93 94 } // namespace internal 95 } // namespace protobuf 96 } // namespace google 97 98 #endif // GOOGLE_PROTOBUF_DESCRIPTOR_LITE_H__ 99