Upgrade linux protobuf
This commit is contained in:
1 parent
79f2f356d5
commit
0f3130fb47
689 files changed
+141922
-132057
No files matched your search
@@ -40,6 +40,8 @@
|
||||
#include <string>
|
||||
#include <google/protobuf/compiler/code_generator.h>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
namespace compiler {
|
||||
@@ -49,24 +51,56 @@ namespace cpp {
|
||||
// header. If you create your own protocol compiler binary and you want
|
||||
// it to support C++ output, you can do so by registering an instance of this
|
||||
// CodeGenerator with the CommandLineInterface in your main() function.
|
||||
class LIBPROTOC_EXPORT CppGenerator : public CodeGenerator {
|
||||
class PROTOC_EXPORT CppGenerator : public CodeGenerator {
|
||||
public:
|
||||
CppGenerator();
|
||||
~CppGenerator();
|
||||
|
||||
enum class Runtime {
|
||||
kGoogle3, // Use the internal google3 runtime.
|
||||
kOpensource, // Use the open-source runtime.
|
||||
|
||||
// Use the open-source runtime with google3 #include paths. We make these
|
||||
// absolute to avoid ambiguity, so the runtime will be #included like:
|
||||
// #include "third_party/protobuf/.../google/protobuf/message.h"
|
||||
kOpensourceGoogle3
|
||||
};
|
||||
|
||||
void set_opensource_runtime(bool opensource) {
|
||||
opensource_runtime_ = opensource;
|
||||
}
|
||||
|
||||
// If set to a non-empty string, generated code will do:
|
||||
// #include "<BASE>/google/protobuf/message.h"
|
||||
// instead of:
|
||||
// #include <google/protobuf/message.h>
|
||||
// This has no effect if opensource_runtime = false.
|
||||
void set_runtime_include_base(const std::string& base) {
|
||||
runtime_include_base_ = base;
|
||||
}
|
||||
|
||||
// implements CodeGenerator ----------------------------------------
|
||||
bool Generate(const FileDescriptor* file,
|
||||
const string& parameter,
|
||||
bool Generate(const FileDescriptor* file, const std::string& parameter,
|
||||
GeneratorContext* generator_context,
|
||||
string* error) const;
|
||||
std::string* error) const override;
|
||||
|
||||
uint64_t GetSupportedFeatures() const override {
|
||||
// We don't fully support this yet, but this is needed to unblock the tests,
|
||||
// and we will have full support before the experimental flag is removed.
|
||||
return FEATURE_PROTO3_OPTIONAL;
|
||||
}
|
||||
|
||||
private:
|
||||
bool opensource_runtime_ = true;
|
||||
std::string runtime_include_base_;
|
||||
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CppGenerator);
|
||||
};
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace compiler
|
||||
} // namespace protobuf
|
||||
|
||||
} // namespace google
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
|
||||
#endif // GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__
|
||||
Reference in new issue
Block a user