Commit 00987f41 authored by Josh Haberman's avatar Josh Haberman

Some changes to the ObjC code generator to support importing into Google.

- removed use of GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
  in favor of deleting them C++11 style.
- removed forward declarations of protobuf core types.
- ensured that namespaces "google" and "protobuf" are
  always opened/closed together.
parent 29747f4c
...@@ -35,14 +35,9 @@ ...@@ -35,14 +35,9 @@
#include <set> #include <set>
#include <vector> #include <vector>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include <google/protobuf/io/printer.h>
namespace google { namespace google {
namespace protobuf {
namespace io {
class Printer; // printer.h
}
}
namespace protobuf { namespace protobuf {
namespace compiler { namespace compiler {
namespace objectivec { namespace objectivec {
...@@ -52,6 +47,9 @@ class EnumGenerator { ...@@ -52,6 +47,9 @@ class EnumGenerator {
explicit EnumGenerator(const EnumDescriptor* descriptor); explicit EnumGenerator(const EnumDescriptor* descriptor);
~EnumGenerator(); ~EnumGenerator();
EnumGenerator(const EnumGenerator&) = delete;
EnumGenerator& operator=(const EnumGenerator&) = delete;
void GenerateHeader(io::Printer* printer); void GenerateHeader(io::Printer* printer);
void GenerateSource(io::Printer* printer); void GenerateSource(io::Printer* printer);
...@@ -62,12 +60,11 @@ class EnumGenerator { ...@@ -62,12 +60,11 @@ class EnumGenerator {
std::vector<const EnumValueDescriptor*> base_values_; std::vector<const EnumValueDescriptor*> base_values_;
std::vector<const EnumValueDescriptor*> all_values_; std::vector<const EnumValueDescriptor*> all_values_;
const string name_; const string name_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
}; };
} // namespace objectivec } // namespace objectivec
} // namespace compiler } // namespace compiler
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__ #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__
...@@ -32,11 +32,9 @@ ...@@ -32,11 +32,9 @@
#include <string> #include <string>
#include <google/protobuf/compiler/objectivec/objectivec_enum_field.h> #include <google/protobuf/compiler/objectivec/objectivec_enum_field.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/io/printer.h> #include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h> #include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
......
...@@ -44,6 +44,9 @@ class EnumFieldGenerator : public SingleFieldGenerator { ...@@ -44,6 +44,9 @@ class EnumFieldGenerator : public SingleFieldGenerator {
friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field,
const Options& options); const Options& options);
EnumFieldGenerator(const EnumFieldGenerator&) = delete;
EnumFieldGenerator& operator=(const EnumFieldGenerator&) = delete;
public: public:
virtual void GenerateCFunctionDeclarations(io::Printer* printer) const; virtual void GenerateCFunctionDeclarations(io::Printer* printer) const;
virtual void GenerateCFunctionImplementations(io::Printer* printer) const; virtual void GenerateCFunctionImplementations(io::Printer* printer) const;
...@@ -52,9 +55,6 @@ class EnumFieldGenerator : public SingleFieldGenerator { ...@@ -52,9 +55,6 @@ class EnumFieldGenerator : public SingleFieldGenerator {
protected: protected:
EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options); EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options);
virtual ~EnumFieldGenerator(); virtual ~EnumFieldGenerator();
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
}; };
class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator { class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator {
...@@ -68,9 +68,6 @@ class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator { ...@@ -68,9 +68,6 @@ class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator {
RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor,
const Options& options); const Options& options);
virtual ~RepeatedEnumFieldGenerator(); virtual ~RepeatedEnumFieldGenerator();
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);
}; };
} // namespace objectivec } // namespace objectivec
......
...@@ -31,16 +31,10 @@ ...@@ -31,16 +31,10 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_EXTENSION_H__ #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_EXTENSION_H__
#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_EXTENSION_H__ #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_EXTENSION_H__
#include <google/protobuf/stubs/common.h> #include <google/protobuf/descriptor.h>
#include <google/protobuf/io/printer.h>
namespace google { namespace google {
namespace protobuf {
class FieldDescriptor; // descriptor.h
namespace io {
class Printer; // printer.h
}
}
namespace protobuf { namespace protobuf {
namespace compiler { namespace compiler {
namespace objectivec { namespace objectivec {
...@@ -51,6 +45,9 @@ class ExtensionGenerator { ...@@ -51,6 +45,9 @@ class ExtensionGenerator {
const FieldDescriptor* descriptor); const FieldDescriptor* descriptor);
~ExtensionGenerator(); ~ExtensionGenerator();
ExtensionGenerator(const ExtensionGenerator&) = delete;
ExtensionGenerator& operator=(const ExtensionGenerator&) = delete;
void GenerateMembersHeader(io::Printer* printer); void GenerateMembersHeader(io::Printer* printer);
void GenerateStaticVariablesInitialization(io::Printer* printer); void GenerateStaticVariablesInitialization(io::Printer* printer);
void GenerateRegistrationSource(io::Printer* printer); void GenerateRegistrationSource(io::Printer* printer);
...@@ -59,11 +56,11 @@ class ExtensionGenerator { ...@@ -59,11 +56,11 @@ class ExtensionGenerator {
string method_name_; string method_name_;
string root_class_and_method_name_; string root_class_and_method_name_;
const FieldDescriptor* descriptor_; const FieldDescriptor* descriptor_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
}; };
} // namespace objectivec } // namespace objectivec
} // namespace compiler } // namespace compiler
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__ #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include <google/protobuf/compiler/objectivec/objectivec_primitive_field.h> #include <google/protobuf/compiler/objectivec/objectivec_primitive_field.h>
#include <google/protobuf/io/printer.h> #include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h> #include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/strutil.h> #include <google/protobuf/stubs/strutil.h>
namespace google { namespace google {
......
...@@ -34,16 +34,11 @@ ...@@ -34,16 +34,11 @@
#include <map> #include <map>
#include <string> #include <string>
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include <google/protobuf/io/printer.h>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
namespace io {
class Printer; // printer.h
} // namespace io
namespace compiler { namespace compiler {
namespace objectivec { namespace objectivec {
...@@ -54,6 +49,9 @@ class FieldGenerator { ...@@ -54,6 +49,9 @@ class FieldGenerator {
virtual ~FieldGenerator(); virtual ~FieldGenerator();
FieldGenerator(const FieldGenerator&) = delete;
FieldGenerator& operator=(const FieldGenerator&) = delete;
// Exposed for subclasses to fill in. // Exposed for subclasses to fill in.
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const = 0; virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const = 0;
virtual void GeneratePropertyDeclaration(io::Printer* printer) const = 0; virtual void GeneratePropertyDeclaration(io::Printer* printer) const = 0;
...@@ -101,15 +99,15 @@ class FieldGenerator { ...@@ -101,15 +99,15 @@ class FieldGenerator {
const FieldDescriptor* descriptor_; const FieldDescriptor* descriptor_;
std::map<string, string> variables_; std::map<string, string> variables_;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
}; };
class SingleFieldGenerator : public FieldGenerator { class SingleFieldGenerator : public FieldGenerator {
public: public:
virtual ~SingleFieldGenerator(); virtual ~SingleFieldGenerator();
SingleFieldGenerator(const SingleFieldGenerator&) = delete;
SingleFieldGenerator& operator=(const SingleFieldGenerator&) = delete;
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const;
virtual void GeneratePropertyDeclaration(io::Printer* printer) const; virtual void GeneratePropertyDeclaration(io::Printer* printer) const;
...@@ -121,9 +119,6 @@ class SingleFieldGenerator : public FieldGenerator { ...@@ -121,9 +119,6 @@ class SingleFieldGenerator : public FieldGenerator {
SingleFieldGenerator(const FieldDescriptor* descriptor, SingleFieldGenerator(const FieldDescriptor* descriptor,
const Options& options); const Options& options);
virtual bool WantsHasProperty(void) const; virtual bool WantsHasProperty(void) const;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SingleFieldGenerator);
}; };
// Subclass with common support for when the field ends up as an ObjC Object. // Subclass with common support for when the field ends up as an ObjC Object.
...@@ -131,21 +126,24 @@ class ObjCObjFieldGenerator : public SingleFieldGenerator { ...@@ -131,21 +126,24 @@ class ObjCObjFieldGenerator : public SingleFieldGenerator {
public: public:
virtual ~ObjCObjFieldGenerator(); virtual ~ObjCObjFieldGenerator();
ObjCObjFieldGenerator(const ObjCObjFieldGenerator&) = delete;
ObjCObjFieldGenerator& operator=(const ObjCObjFieldGenerator&) = delete;
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const;
virtual void GeneratePropertyDeclaration(io::Printer* printer) const; virtual void GeneratePropertyDeclaration(io::Printer* printer) const;
protected: protected:
ObjCObjFieldGenerator(const FieldDescriptor* descriptor, ObjCObjFieldGenerator(const FieldDescriptor* descriptor,
const Options& options); const Options& options);
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjCObjFieldGenerator);
}; };
class RepeatedFieldGenerator : public ObjCObjFieldGenerator { class RepeatedFieldGenerator : public ObjCObjFieldGenerator {
public: public:
virtual ~RepeatedFieldGenerator(); virtual ~RepeatedFieldGenerator();
RepeatedFieldGenerator(const RepeatedFieldGenerator&) = delete;
RepeatedFieldGenerator& operator=(const RepeatedFieldGenerator&) = delete;
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const;
virtual void GeneratePropertyDeclaration(io::Printer* printer) const; virtual void GeneratePropertyDeclaration(io::Printer* printer) const;
...@@ -158,9 +156,6 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator { ...@@ -158,9 +156,6 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator {
const Options& options); const Options& options);
virtual void FinishInitialization(void); virtual void FinishInitialization(void);
virtual bool WantsHasProperty(void) const; virtual bool WantsHasProperty(void) const;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedFieldGenerator);
}; };
// Convenience class which constructs FieldGenerators for a Descriptor. // Convenience class which constructs FieldGenerators for a Descriptor.
...@@ -169,6 +164,9 @@ class FieldGeneratorMap { ...@@ -169,6 +164,9 @@ class FieldGeneratorMap {
FieldGeneratorMap(const Descriptor* descriptor, const Options& options); FieldGeneratorMap(const Descriptor* descriptor, const Options& options);
~FieldGeneratorMap(); ~FieldGeneratorMap();
FieldGeneratorMap(const FieldGeneratorMap&) = delete;
FieldGeneratorMap& operator=(const FieldGeneratorMap&) = delete;
const FieldGenerator& get(const FieldDescriptor* field) const; const FieldGenerator& get(const FieldDescriptor* field) const;
const FieldGenerator& get_extension(int index) const; const FieldGenerator& get_extension(int index) const;
...@@ -184,11 +182,11 @@ class FieldGeneratorMap { ...@@ -184,11 +182,11 @@ class FieldGeneratorMap {
const Descriptor* descriptor_; const Descriptor* descriptor_;
std::vector<std::unique_ptr<FieldGenerator>> field_generators_; std::vector<std::unique_ptr<FieldGenerator>> field_generators_;
std::vector<std::unique_ptr<FieldGenerator>> extension_generators_; std::vector<std::unique_ptr<FieldGenerator>> extension_generators_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
}; };
} // namespace objectivec } // namespace objectivec
} // namespace compiler } // namespace compiler
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FIELD_H__ #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FIELD_H__
...@@ -35,16 +35,10 @@ ...@@ -35,16 +35,10 @@
#include <set> #include <set>
#include <vector> #include <vector>
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/stubs/common.h> #include <google/protobuf/descriptor.h>
#include <google/protobuf/io/printer.h>
namespace google { namespace google {
namespace protobuf {
class FileDescriptor; // descriptor.h
namespace io {
class Printer; // printer.h
}
}
namespace protobuf { namespace protobuf {
namespace compiler { namespace compiler {
namespace objectivec { namespace objectivec {
...@@ -58,6 +52,9 @@ class FileGenerator { ...@@ -58,6 +52,9 @@ class FileGenerator {
FileGenerator(const FileDescriptor* file, const Options& options); FileGenerator(const FileDescriptor* file, const Options& options);
~FileGenerator(); ~FileGenerator();
FileGenerator(const FileGenerator&) = delete;
FileGenerator& operator=(const FileGenerator&) = delete;
void GenerateSource(io::Printer* printer); void GenerateSource(io::Printer* printer);
void GenerateHeader(io::Printer* printer); void GenerateHeader(io::Printer* printer);
...@@ -76,8 +73,6 @@ class FileGenerator { ...@@ -76,8 +73,6 @@ class FileGenerator {
void PrintFileRuntimePreamble( void PrintFileRuntimePreamble(
io::Printer* printer, const std::set<string>& headers_to_import) const; io::Printer* printer, const std::set<string>& headers_to_import) const;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
}; };
} // namespace objectivec } // namespace objectivec
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <string> #include <string>
#include <google/protobuf/compiler/code_generator.h> #include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
...@@ -52,6 +53,9 @@ class PROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator { ...@@ -52,6 +53,9 @@ class PROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator {
ObjectiveCGenerator(); ObjectiveCGenerator();
~ObjectiveCGenerator(); ~ObjectiveCGenerator();
ObjectiveCGenerator(const ObjectiveCGenerator&) = delete;
ObjectiveCGenerator& operator=(const ObjectiveCGenerator&) = delete;
// implements CodeGenerator ---------------------------------------- // implements CodeGenerator ----------------------------------------
bool HasGenerateAll() const; bool HasGenerateAll() const;
bool Generate(const FileDescriptor* file, bool Generate(const FileDescriptor* file,
...@@ -62,9 +66,6 @@ class PROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator { ...@@ -62,9 +66,6 @@ class PROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator {
const string& parameter, const string& parameter,
GeneratorContext* context, GeneratorContext* context,
string* error) const; string* error) const;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjectiveCGenerator);
}; };
} // namespace objectivec } // namespace objectivec
......
...@@ -41,14 +41,12 @@ ...@@ -41,14 +41,12 @@
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
#include <google/protobuf/stubs/hash.h>
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h> #include <google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h>
#include <google/protobuf/descriptor.pb.h> #include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/printer.h> #include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h> #include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/io_win32.h>
#include <google/protobuf/stubs/strutil.h> #include <google/protobuf/stubs/strutil.h>
......
...@@ -230,6 +230,9 @@ class PROTOC_EXPORT TextFormatDecodeData { ...@@ -230,6 +230,9 @@ class PROTOC_EXPORT TextFormatDecodeData {
TextFormatDecodeData(); TextFormatDecodeData();
~TextFormatDecodeData(); ~TextFormatDecodeData();
TextFormatDecodeData(const TextFormatDecodeData&) = delete;
TextFormatDecodeData& operator=(const TextFormatDecodeData&) = delete;
void AddString(int32 key, const string& input_for_decode, void AddString(int32 key, const string& input_for_decode,
const string& desired_output); const string& desired_output);
size_t num_entries() const { return entries_.size(); } size_t num_entries() const { return entries_.size(); }
...@@ -239,8 +242,6 @@ class PROTOC_EXPORT TextFormatDecodeData { ...@@ -239,8 +242,6 @@ class PROTOC_EXPORT TextFormatDecodeData {
const string& desired_output); const string& desired_output);
private: private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TextFormatDecodeData);
typedef std::pair<int32, string> DataEntry; typedef std::pair<int32, string> DataEntry;
std::vector<DataEntry> entries_; std::vector<DataEntry> entries_;
}; };
......
...@@ -32,11 +32,8 @@ ...@@ -32,11 +32,8 @@
#include <string> #include <string>
#include <google/protobuf/compiler/objectivec/objectivec_map_field.h> #include <google/protobuf/compiler/objectivec/objectivec_map_field.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/io/printer.h> #include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
......
...@@ -47,6 +47,9 @@ class MapFieldGenerator : public RepeatedFieldGenerator { ...@@ -47,6 +47,9 @@ class MapFieldGenerator : public RepeatedFieldGenerator {
public: public:
virtual void FinishInitialization(void); virtual void FinishInitialization(void);
MapFieldGenerator(const MapFieldGenerator&) = delete;
MapFieldGenerator& operator=(const MapFieldGenerator&) = delete;
protected: protected:
MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options); MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options);
virtual ~MapFieldGenerator(); virtual ~MapFieldGenerator();
...@@ -55,8 +58,6 @@ class MapFieldGenerator : public RepeatedFieldGenerator { ...@@ -55,8 +58,6 @@ class MapFieldGenerator : public RepeatedFieldGenerator {
private: private:
std::unique_ptr<FieldGenerator> value_field_generator_; std::unique_ptr<FieldGenerator> value_field_generator_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator);
}; };
} // namespace objectivec } // namespace objectivec
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <google/protobuf/stubs/hash.h>
#include <google/protobuf/compiler/objectivec/objectivec_message.h> #include <google/protobuf/compiler/objectivec/objectivec_message.h>
#include <google/protobuf/compiler/objectivec/objectivec_enum.h> #include <google/protobuf/compiler/objectivec/objectivec_enum.h>
#include <google/protobuf/compiler/objectivec/objectivec_extension.h> #include <google/protobuf/compiler/objectivec/objectivec_extension.h>
......
...@@ -37,15 +37,11 @@ ...@@ -37,15 +37,11 @@
#include <google/protobuf/compiler/objectivec/objectivec_field.h> #include <google/protobuf/compiler/objectivec/objectivec_field.h>
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/compiler/objectivec/objectivec_oneof.h> #include <google/protobuf/compiler/objectivec/objectivec_oneof.h>
#include <google/protobuf/stubs/common.h> #include <google/protobuf/descriptor.h>
#include <google/protobuf/io/printer.h>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
namespace io {
class Printer; // printer.h
} // namespace io
namespace compiler { namespace compiler {
namespace objectivec { namespace objectivec {
...@@ -59,6 +55,9 @@ class MessageGenerator { ...@@ -59,6 +55,9 @@ class MessageGenerator {
const Options& options); const Options& options);
~MessageGenerator(); ~MessageGenerator();
MessageGenerator(const MessageGenerator&) = delete;
MessageGenerator& operator=(const MessageGenerator&) = delete;
void GenerateStaticVariablesInitialization(io::Printer* printer); void GenerateStaticVariablesInitialization(io::Printer* printer);
void GenerateEnumHeader(io::Printer* printer); void GenerateEnumHeader(io::Printer* printer);
void GenerateMessageHeader(io::Printer* printer); void GenerateMessageHeader(io::Printer* printer);
...@@ -90,11 +89,11 @@ class MessageGenerator { ...@@ -90,11 +89,11 @@ class MessageGenerator {
std::vector<EnumGenerator*> enum_generators_; std::vector<EnumGenerator*> enum_generators_;
std::vector<MessageGenerator*> nested_message_generators_; std::vector<MessageGenerator*> nested_message_generators_;
std::vector<OneofGenerator*> oneof_generators_; std::vector<OneofGenerator*> oneof_generators_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
}; };
} // namespace objectivec } // namespace objectivec
} // namespace compiler } // namespace compiler
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__ #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/io/printer.h> #include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h> #include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
......
...@@ -47,14 +47,15 @@ class MessageFieldGenerator : public ObjCObjFieldGenerator { ...@@ -47,14 +47,15 @@ class MessageFieldGenerator : public ObjCObjFieldGenerator {
protected: protected:
MessageFieldGenerator(const FieldDescriptor* descriptor, MessageFieldGenerator(const FieldDescriptor* descriptor,
const Options& options); const Options& options);
MessageFieldGenerator(const MessageFieldGenerator&) = delete;
MessageFieldGenerator& operator=(const MessageFieldGenerator&) = delete;
virtual ~MessageFieldGenerator(); virtual ~MessageFieldGenerator();
virtual bool WantsHasProperty(void) const; virtual bool WantsHasProperty(void) const;
public: public:
virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const; virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
}; };
class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator {
...@@ -66,11 +67,11 @@ class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { ...@@ -66,11 +67,11 @@ class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator {
const Options& options); const Options& options);
virtual ~RepeatedMessageFieldGenerator(); virtual ~RepeatedMessageFieldGenerator();
RepeatedMessageFieldGenerator(const RepeatedMessageFieldGenerator&) = delete;
RepeatedMessageFieldGenerator operator=(const RepeatedMessageFieldGenerator&) = delete;
public: public:
virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const; virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
}; };
} // namespace objectivec } // namespace objectivec
......
...@@ -35,14 +35,9 @@ ...@@ -35,14 +35,9 @@
#include <set> #include <set>
#include <vector> #include <vector>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include <google/protobuf/io/printer.h>
namespace google { namespace google {
namespace protobuf {
namespace io {
class Printer; // printer.h
}
}
namespace protobuf { namespace protobuf {
namespace compiler { namespace compiler {
namespace objectivec { namespace objectivec {
...@@ -52,6 +47,9 @@ class OneofGenerator { ...@@ -52,6 +47,9 @@ class OneofGenerator {
explicit OneofGenerator(const OneofDescriptor* descriptor); explicit OneofGenerator(const OneofDescriptor* descriptor);
~OneofGenerator(); ~OneofGenerator();
OneofGenerator(const OneofGenerator&) = delete;
OneofGenerator& operator=(const OneofGenerator&) = delete;
void SetOneofIndexBase(int index_base); void SetOneofIndexBase(int index_base);
void GenerateCaseEnum(io::Printer* printer); void GenerateCaseEnum(io::Printer* printer);
...@@ -68,12 +66,11 @@ class OneofGenerator { ...@@ -68,12 +66,11 @@ class OneofGenerator {
private: private:
const OneofDescriptor* descriptor_; const OneofDescriptor* descriptor_;
std::map<string, string> variables_; std::map<string, string> variables_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OneofGenerator);
}; };
} // namespace objectivec } // namespace objectivec
} // namespace compiler } // namespace compiler
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ONEOF_H__ #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ONEOF_H__
...@@ -31,14 +31,12 @@ ...@@ -31,14 +31,12 @@
#include <map> #include <map>
#include <string> #include <string>
#include <google/protobuf/compiler/objectivec/objectivec_primitive_field.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/compiler/objectivec/objectivec_primitive_field.h>
#include <google/protobuf/io/printer.h> #include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/wire_format.h> #include <google/protobuf/wire_format.h>
#include <google/protobuf/wire_format_lite_inl.h> #include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
......
...@@ -49,13 +49,13 @@ class PrimitiveFieldGenerator : public SingleFieldGenerator { ...@@ -49,13 +49,13 @@ class PrimitiveFieldGenerator : public SingleFieldGenerator {
const Options& options); const Options& options);
virtual ~PrimitiveFieldGenerator(); virtual ~PrimitiveFieldGenerator();
PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete;
PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete;
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const;
virtual int ExtraRuntimeHasBitsNeeded(void) const; virtual int ExtraRuntimeHasBitsNeeded(void) const;
virtual void SetExtraRuntimeHasBitsBase(int index_base); virtual void SetExtraRuntimeHasBitsBase(int index_base);
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
}; };
class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator { class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator {
...@@ -67,8 +67,9 @@ class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator { ...@@ -67,8 +67,9 @@ class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator {
const Options& options); const Options& options);
virtual ~PrimitiveObjFieldGenerator(); virtual ~PrimitiveObjFieldGenerator();
private: PrimitiveObjFieldGenerator(const PrimitiveObjFieldGenerator&) = delete;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveObjFieldGenerator); PrimitiveObjFieldGenerator& operator=(const PrimitiveObjFieldGenerator&) =
delete;
}; };
class RepeatedPrimitiveFieldGenerator : public RepeatedFieldGenerator { class RepeatedPrimitiveFieldGenerator : public RepeatedFieldGenerator {
...@@ -80,8 +81,10 @@ class RepeatedPrimitiveFieldGenerator : public RepeatedFieldGenerator { ...@@ -80,8 +81,10 @@ class RepeatedPrimitiveFieldGenerator : public RepeatedFieldGenerator {
const Options& options); const Options& options);
virtual ~RepeatedPrimitiveFieldGenerator(); virtual ~RepeatedPrimitiveFieldGenerator();
private: RepeatedPrimitiveFieldGenerator(const RepeatedPrimitiveFieldGenerator&) =
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); delete;
RepeatedPrimitiveFieldGenerator& operator=(
const RepeatedPrimitiveFieldGenerator&) = delete;
}; };
} // namespace objectivec } // namespace objectivec
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment