| Index: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc
|
| index 1813510b648df176106aa865a46525840801b5f1..781526b505cb938a28f3576015e5faa5db72c315 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc
|
| @@ -1,6 +1,6 @@
|
| // Protocol Buffers - Google's data interchange format
|
| // Copyright 2008 Google Inc. All rights reserved.
|
| -// http://code.google.com/p/protobuf/
|
| +// https://developers.google.com/protocol-buffers/
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -35,6 +35,10 @@
|
| #include <google/protobuf/compiler/cpp/cpp_generator.h>
|
|
|
| #include <vector>
|
| +#include <memory>
|
| +#ifndef _SHARED_PTR_H
|
| +#include <google/protobuf/stubs/shared_ptr.h>
|
| +#endif
|
| #include <utility>
|
|
|
| #include <google/protobuf/compiler/cpp/cpp_file.h>
|
| @@ -78,6 +82,7 @@ bool CppGenerator::Generate(const FileDescriptor* file,
|
| // }
|
| // FOO_EXPORT is a macro which should expand to __declspec(dllexport) or
|
| // __declspec(dllimport) depending on what is being compiled.
|
| + //
|
| Options file_options;
|
|
|
| for (int i = 0; i < options.size(); i++) {
|
| @@ -95,22 +100,29 @@ bool CppGenerator::Generate(const FileDescriptor* file,
|
|
|
|
|
| string basename = StripProto(file->name());
|
| - basename.append(".pb");
|
|
|
| FileGenerator file_generator(file, file_options);
|
|
|
| - // Generate header.
|
| + // Generate header(s).
|
| + if (file_options.proto_h) {
|
| + google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
|
| + generator_context->Open(basename + ".proto.h"));
|
| + io::Printer printer(output.get(), '$');
|
| + file_generator.GenerateProtoHeader(&printer);
|
| + }
|
| +
|
| + basename.append(".pb");
|
| {
|
| - scoped_ptr<io::ZeroCopyOutputStream> output(
|
| - generator_context->Open(basename + ".h"));
|
| + google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
|
| + generator_context->Open(basename + ".h"));
|
| io::Printer printer(output.get(), '$');
|
| - file_generator.GenerateHeader(&printer);
|
| + file_generator.GeneratePBHeader(&printer);
|
| }
|
|
|
| // Generate cc file.
|
| {
|
| - scoped_ptr<io::ZeroCopyOutputStream> output(
|
| - generator_context->Open(basename + ".cc"));
|
| + google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
|
| + generator_context->Open(basename + ".cc"));
|
| io::Printer printer(output.get(), '$');
|
| file_generator.GenerateSource(&printer);
|
| }
|
|
|