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 #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_PRIMITIVE_FIELD_H__ 9 #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_PRIMITIVE_FIELD_H__ 10 11 #include "google/protobuf/compiler/objectivec/field.h" 12 #include "google/protobuf/compiler/objectivec/options.h" 13 #include "google/protobuf/descriptor.h" 14 15 namespace google { 16 namespace protobuf { 17 namespace compiler { 18 namespace objectivec { 19 20 class PrimitiveFieldGenerator : public SingleFieldGenerator { 21 friend FieldGenerator* FieldGenerator::Make( 22 const FieldDescriptor* field, 23 const GenerationOptions& generation_options); 24 25 protected: 26 PrimitiveFieldGenerator(const FieldDescriptor* descriptor, 27 const GenerationOptions& generation_options); 28 ~PrimitiveFieldGenerator() override = default; 29 30 PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete; 31 PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete; 32 33 void GenerateFieldStorageDeclaration(io::Printer* printer) const override; 34 35 int ExtraRuntimeHasBitsNeeded() const override; 36 void SetExtraRuntimeHasBitsBase(int index_base) override; 37 }; 38 39 class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator { 40 friend FieldGenerator* FieldGenerator::Make( 41 const FieldDescriptor* field, 42 const GenerationOptions& generation_options); 43 44 protected: 45 PrimitiveObjFieldGenerator(const FieldDescriptor* descriptor, 46 const GenerationOptions& generation_options); 47 ~PrimitiveObjFieldGenerator() override = default; 48 49 PrimitiveObjFieldGenerator(const PrimitiveObjFieldGenerator&) = delete; 50 PrimitiveObjFieldGenerator& operator=(const PrimitiveObjFieldGenerator&) = 51 delete; 52 }; 53 54 class RepeatedPrimitiveFieldGenerator : public RepeatedFieldGenerator { 55 friend FieldGenerator* FieldGenerator::Make( 56 const FieldDescriptor* field, 57 const GenerationOptions& generation_options); 58 59 protected: 60 RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, 61 const GenerationOptions& generation_options); 62 ~RepeatedPrimitiveFieldGenerator() override = default; 63 64 RepeatedPrimitiveFieldGenerator(const RepeatedPrimitiveFieldGenerator&) = 65 delete; 66 RepeatedPrimitiveFieldGenerator& operator=( 67 const RepeatedPrimitiveFieldGenerator&) = delete; 68 }; 69 70 } // namespace objectivec 71 } // namespace compiler 72 } // namespace protobuf 73 } // namespace google 74 75 #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_PRIMITIVE_FIELD_H__ 76