| Index: third_party/protobuf/src/google/protobuf/util/internal/field_mask_utility.h
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h b/third_party/protobuf/src/google/protobuf/util/internal/field_mask_utility.h
|
| similarity index 53%
|
| copy from third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h
|
| copy to third_party/protobuf/src/google/protobuf/util/internal/field_mask_utility.h
|
| index 50ad035ba8ff80ac5fd0f1d18b4d97b48116aee2..59f36f756fcbdad6f9ddb44d18faadc0cf11a752 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h
|
| +++ b/third_party/protobuf/src/google/protobuf/util/internal/field_mask_utility.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
|
| @@ -28,59 +28,45 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Author: kenton@google.com (Kenton Varda)
|
| -// Based on original Protocol Buffers design by
|
| -// Sanjay Ghemawat, Jeff Dean, and others.
|
| +// FieldMask related utility methods.
|
|
|
| -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__
|
| -#define GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__
|
| +#ifndef GOOGLE_PROTOBUF_UTIL_CONVERTER_FIELD_MASK_UTILITY_H__
|
| +#define GOOGLE_PROTOBUF_UTIL_CONVERTER_FIELD_MASK_UTILITY_H__
|
| +
|
| +#include <functional>
|
| +#include <stack>
|
|
|
| -#include <string>
|
| #include <google/protobuf/stubs/common.h>
|
| -#include <google/protobuf/compiler/cpp/cpp_options.h>
|
| +#include <google/protobuf/stubs/stringpiece.h>
|
| +#include <google/protobuf/stubs/status.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();
|
| -
|
| - // Header stuff.
|
| - void GenerateDeclaration(io::Printer* printer);
|
| -
|
| - // Source file stuff.
|
| - void GenerateDefinition(io::Printer* printer);
|
| +namespace util {
|
| +namespace converter {
|
|
|
| - // Generate code to register the extension.
|
| - void GenerateRegistration(io::Printer* printer);
|
| +typedef string (*ConverterCallback)(StringPiece);
|
| +typedef ResultCallback1<util::Status, StringPiece>* PathSinkCallback;
|
|
|
| - private:
|
| - const FieldDescriptor* descriptor_;
|
| - string type_traits_;
|
| - Options options_;
|
| +// Applies a 'converter' to each segment of a FieldMask path and returns the
|
| +// result. Quoted strings in the 'path' are copied to the output as-is without
|
| +// converting their content. Escaping is supported within quoted strings.
|
| +// For example, "ab\"_c" will be returned as "ab\"_c" without any changes.
|
| +string ConvertFieldMaskPath(const StringPiece path,
|
| + ConverterCallback converter);
|
|
|
| - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
|
| -};
|
| +// Decodes a compact list of FieldMasks. For example, "a.b,a.c.d,a.c.e" will be
|
| +// decoded into a list of field paths - "a.b", "a.c.d", "a.c.e". And the results
|
| +// will be sent to 'path_sink', i.e. 'path_sink' will be called once per
|
| +// resulting path.
|
| +// Note that we also support Apiary style FieldMask form. The above example in
|
| +// the Apiary style will look like "a.b,a.c(d,e)".
|
| +util::Status DecodeCompactFieldMaskPaths(StringPiece paths,
|
| + PathSinkCallback path_sink);
|
|
|
| -} // namespace cpp
|
| -} // namespace compiler
|
| +} // namespace converter
|
| +} // namespace util
|
| } // namespace protobuf
|
|
|
| } // namespace google
|
| -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__
|
| +#endif // GOOGLE_PROTOBUF_UTIL_CONVERTER_FIELD_MASK_UTILITY_H__
|
|
|