Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pull whole protobuf Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.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_enum.h
copy to third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h
index 2e85a0bd3c3aab73255e672c774cb11a2efd4031..308051871c1027631c3d91511016a6a78f1421b4 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.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,71 +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_ENUM_H__
-#define GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_H__
+#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__
+#define GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__
#include <string>
-#include <google/protobuf/compiler/cpp/cpp_options.h>
-#include <google/protobuf/descriptor.h>
-
namespace google {
namespace protobuf {
- namespace io {
- class Printer; // printer.h
- }
-}
-
-namespace protobuf {
-namespace compiler {
-namespace cpp {
-
-class EnumGenerator {
- public:
- // See generator.cc for the meaning of dllexport_decl.
- explicit EnumGenerator(const EnumDescriptor* descriptor,
- const Options& options);
- ~EnumGenerator();
-
- // Header stuff.
-
- // Generate header code defining the enum. This code should be placed
- // within the enum's package namespace, but NOT within any class, even for
- // nested enums.
- void GenerateDefinition(io::Printer* printer);
-
- // Generate specialization of GetEnumDescriptor<MyEnum>().
- // Precondition: in ::google::protobuf namespace.
- void GenerateGetEnumDescriptorSpecializations(io::Printer* printer);
-
- // For enums nested within a message, generate code to import all the enum's
- // symbols (e.g. the enum type name, all its values, etc.) into the class's
- // namespace. This should be placed inside the class definition in the
- // header.
- void GenerateSymbolImports(io::Printer* printer);
- // Source file stuff.
+class Descriptor;
+class EnumDescriptor;
+class FileDescriptor;
+class ServiceDescriptor;
- // Generate code that initializes the global variable storing the enum's
- // descriptor.
- void GenerateDescriptorInitializer(io::Printer* printer, int index);
-
- // Generate non-inline methods related to the enum, such as IsValidValue().
- // Goes in the .cc file.
- void GenerateMethods(io::Printer* printer);
+namespace compiler {
+namespace csharp {
- private:
- const EnumDescriptor* descriptor_;
- string classname_;
- Options options_;
+// Requires:
+// descriptor != NULL
+//
+// Returns:
+// The namespace to use for given file descriptor.
+string GetFileNamespace(const FileDescriptor* descriptor);
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
-};
+// Requires:
+// descriptor != NULL
+//
+// Returns:
+// The fully-qualified C# class name.
+string GetClassName(const Descriptor* descriptor);
-} // namespace cpp
+// 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);
+
+// 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 csharp
} // namespace compiler
} // namespace protobuf
-
} // namespace google
-#endif // GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_H__
+
+#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__

Powered by Google App Engine
This is Rietveld 408576698