Index: third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h |
similarity index 50% |
copy from third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h |
copy to third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h |
index 50ad035ba8ff80ac5fd0f1d18b4d97b48116aee2..308051871c1027631c3d91511016a6a78f1421b4 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h |
+++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h |
@@ -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 |
@@ -31,56 +31,73 @@ |
// Author: kenton@google.com (Kenton Varda) |
// Based on original Protocol Buffers design by |
// Sanjay Ghemawat, Jeff Dean, and others. |
+// |
+// Provides a mechanism for mapping a descriptor to the |
+// fully-qualified name of the corresponding C# class. |
-#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__ |
-#define GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__ |
+#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__ |
+#define GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__ |
#include <string> |
-#include <google/protobuf/stubs/common.h> |
-#include <google/protobuf/compiler/cpp/cpp_options.h> |
namespace google { |
namespace protobuf { |
- class FieldDescriptor; // descriptor.h |
- namespace io { |
- class Printer; // printer.h |
- } |
-} |
- |
-namespace protobuf { |
-namespace compiler { |
-namespace cpp { |
-// Generates code for an extension, which may be within the scope of some |
-// message or may be at file scope. This is much simpler than FieldGenerator |
-// since extensions are just simple identifiers with interesting types. |
-class ExtensionGenerator { |
- public: |
- // See generator.cc for the meaning of dllexport_decl. |
- explicit ExtensionGenerator(const FieldDescriptor* desycriptor, |
- const Options& options); |
- ~ExtensionGenerator(); |
+class Descriptor; |
+class EnumDescriptor; |
+class FileDescriptor; |
+class ServiceDescriptor; |
- // Header stuff. |
- void GenerateDeclaration(io::Printer* printer); |
+namespace compiler { |
+namespace csharp { |
- // Source file stuff. |
- void GenerateDefinition(io::Printer* printer); |
+// Requires: |
+// descriptor != NULL |
+// |
+// Returns: |
+// The namespace to use for given file descriptor. |
+string GetFileNamespace(const FileDescriptor* descriptor); |
- // Generate code to register the extension. |
- void GenerateRegistration(io::Printer* printer); |
+// Requires: |
+// descriptor != NULL |
+// |
+// Returns: |
+// The fully-qualified C# class name. |
+string GetClassName(const Descriptor* descriptor); |
- private: |
- const FieldDescriptor* descriptor_; |
- string type_traits_; |
- Options options_; |
+// Requires: |
+// descriptor != NULL |
+// |
+// Returns: |
+// The fully-qualified name of the C# class that provides |
+// access to the file descriptor. Proto compiler generates |
+// such class for each .proto file processed. |
+string GetReflectionClassName(const FileDescriptor* descriptor); |
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator); |
-}; |
+// Generates output file name for given file descriptor. If generate_directories |
+// is true, the output file will be put under directory corresponding to file's |
+// namespace. base_namespace can be used to strip some of the top level |
+// directories. E.g. for file with namespace "Bar.Foo" and base_namespace="Bar", |
+// the resulting file will be put under directory "Foo" (and not "Bar/Foo"). |
+// |
+// Requires: |
+// descriptor != NULL |
+// error != NULL |
+// |
+// Returns: |
+// The file name to use as output file for given file descriptor. In case |
+// of failure, this function will return empty string and error parameter |
+// will contain the error message. |
+string GetOutputFile( |
+ const google::protobuf::FileDescriptor* descriptor, |
+ const string file_extension, |
+ const bool generate_directories, |
+ const string base_namespace, |
+ string* error); |
-} // namespace cpp |
+} // namespace csharp |
} // namespace compiler |
} // namespace protobuf |
- |
} // namespace google |
-#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ |
+ |
+#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__ |