| Index: third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h
|
| index 130a52dd76f5a4696f46fb9d7c8337445b8ce39c..a3a4b1b6e208c778b2af6c1a60d80d099f2f44df 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h
|
| @@ -49,24 +49,37 @@ namespace objectivec {
|
|
|
| class FieldGenerator {
|
| public:
|
| - static FieldGenerator* Make(const FieldDescriptor* field);
|
| + static FieldGenerator* Make(const FieldDescriptor* field,
|
| + const Options& options);
|
|
|
| virtual ~FieldGenerator();
|
|
|
| + // Exposed for subclasses to fill in.
|
| virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const = 0;
|
| virtual void GeneratePropertyDeclaration(io::Printer* printer) const = 0;
|
| -
|
| virtual void GeneratePropertyImplementation(io::Printer* printer) const = 0;
|
|
|
| - virtual void GenerateFieldDescription(io::Printer* printer) const;
|
| - virtual void GenerateFieldDescriptionTypeSpecific(io::Printer* printer) const;
|
| - virtual void GenerateFieldNumberConstant(io::Printer* printer) const;
|
| + // Called by GenerateFieldDescription, exposed for classes that need custom
|
| + // generation.
|
|
|
| + // Exposed for subclasses to extend, base does nothing.
|
| virtual void GenerateCFunctionDeclarations(io::Printer* printer) const;
|
| virtual void GenerateCFunctionImplementations(io::Printer* printer) const;
|
|
|
| + // Exposed for subclasses, should always call it on the parent class also.
|
| virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const;
|
|
|
| + // Used during generation, not intended to be extended by subclasses.
|
| + void GenerateFieldDescription(
|
| + io::Printer* printer, bool include_default) const;
|
| + void GenerateFieldNumberConstant(io::Printer* printer) const;
|
| +
|
| + // Exposed to get and set the has bits information.
|
| + virtual bool RuntimeUsesHasBit(void) const = 0;
|
| + void SetRuntimeHasBit(int has_index);
|
| + void SetNoHasBit(void);
|
| + virtual int ExtraRuntimeHasBitsNeeded(void) const;
|
| + virtual void SetExtraRuntimeHasBitsBase(int index_base);
|
| void SetOneofIndexBase(int index_base);
|
|
|
| string variable(const char* key) const {
|
| @@ -81,7 +94,7 @@ class FieldGenerator {
|
| string raw_field_name() const { return variable("raw_field_name"); }
|
|
|
| protected:
|
| - explicit FieldGenerator(const FieldDescriptor* descriptor);
|
| + FieldGenerator(const FieldDescriptor* descriptor, const Options& options);
|
|
|
| virtual void FinishInitialization(void);
|
| virtual bool WantsHasProperty(void) const = 0;
|
| @@ -102,8 +115,11 @@ class SingleFieldGenerator : public FieldGenerator {
|
|
|
| virtual void GeneratePropertyImplementation(io::Printer* printer) const;
|
|
|
| + virtual bool RuntimeUsesHasBit(void) const;
|
| +
|
| protected:
|
| - explicit SingleFieldGenerator(const FieldDescriptor* descriptor);
|
| + SingleFieldGenerator(const FieldDescriptor* descriptor,
|
| + const Options& options);
|
| virtual bool WantsHasProperty(void) const;
|
|
|
| private:
|
| @@ -119,7 +135,8 @@ class ObjCObjFieldGenerator : public SingleFieldGenerator {
|
| virtual void GeneratePropertyDeclaration(io::Printer* printer) const;
|
|
|
| protected:
|
| - explicit ObjCObjFieldGenerator(const FieldDescriptor* descriptor);
|
| + ObjCObjFieldGenerator(const FieldDescriptor* descriptor,
|
| + const Options& options);
|
|
|
| private:
|
| GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjCObjFieldGenerator);
|
| @@ -134,8 +151,11 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator {
|
|
|
| virtual void GeneratePropertyImplementation(io::Printer* printer) const;
|
|
|
| + virtual bool RuntimeUsesHasBit(void) const;
|
| +
|
| protected:
|
| - explicit RepeatedFieldGenerator(const FieldDescriptor* descriptor);
|
| + RepeatedFieldGenerator(const FieldDescriptor* descriptor,
|
| + const Options& options);
|
| virtual void FinishInitialization(void);
|
| virtual bool WantsHasProperty(void) const;
|
|
|
| @@ -146,14 +166,20 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator {
|
| // Convenience class which constructs FieldGenerators for a Descriptor.
|
| class FieldGeneratorMap {
|
| public:
|
| - explicit FieldGeneratorMap(const Descriptor* descriptor);
|
| + FieldGeneratorMap(const Descriptor* descriptor, const Options& options);
|
| ~FieldGeneratorMap();
|
|
|
| const FieldGenerator& get(const FieldDescriptor* field) const;
|
| const FieldGenerator& get_extension(int index) const;
|
|
|
| + // Assigns the has bits and returns the number of bits needed.
|
| + int CalculateHasBits(void);
|
| +
|
| void SetOneofIndexBase(int index_base);
|
|
|
| + // Check if any field of this message has a non zero default.
|
| + bool DoesAnyFieldHaveNonZeroDefault(void) const;
|
| +
|
| private:
|
| const Descriptor* descriptor_;
|
| scoped_array<scoped_ptr<FieldGenerator> > field_generators_;
|
|
|