diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-06-17 10:31:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-17 10:31:05 -0400 |
commit | 8c20e55c57c90a1a84ac7cf4de96e65911c8212b (patch) | |
tree | 0682f0331cefbe005f0d4e215e487d3179494516 /src/google/protobuf/compiler/objectivec/objectivec_helpers.h | |
parent | 98bd6d753a2b15774c56ecd49763ceb2820d7075 (diff) |
Add new generation option for using proto sources from other frameworks.
- Better docs in the generator for the different options that can be passed
during an invoke of protoc.
- Add named_framework_to_proto_path_mappings_path to pass the path to a file
containing mappings of frameworks for different proto files.
- Update the generation to use the mapping to change the #import directives
it creates.
Note: the changes in helpers is mostly moving code within the fine, and then
a small change to expose the parsing so a passed on class can consume the line.
Fixes https://github.com/google/protobuf/issues/1457
Diffstat (limited to 'src/google/protobuf/compiler/objectivec/objectivec_helpers.h')
-rw-r--r-- | src/google/protobuf/compiler/objectivec/objectivec_helpers.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h index 60536c8c..be20beee 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -47,6 +47,7 @@ struct Options { Options(); string expected_prefixes_path; string generate_for_named_framework; + string named_framework_to_proto_path_mappings_path; }; // Escape C++ trigraphs by escaping question marks to "\?". @@ -55,6 +56,9 @@ string EscapeTrigraphs(const string& to_escape); // Strips ".proto" or ".protodevel" from the end of a filename. string StripProto(const string& filename); +// Remove white space from either end of a StringPiece. +void StringPieceTrimWhitespace(StringPiece* input); + // Returns true if the name requires a ns_returns_not_retained attribute applied // to it. bool IsRetainedName(const string& name); @@ -190,7 +194,8 @@ bool ValidateObjCClassPrefix(const FileDescriptor* file, // the input into the expected output. class LIBPROTOC_EXPORT TextFormatDecodeData { public: - TextFormatDecodeData() {} + TextFormatDecodeData(); + ~TextFormatDecodeData(); void AddString(int32 key, const string& input_for_decode, const string& desired_output); @@ -207,6 +212,17 @@ class LIBPROTOC_EXPORT TextFormatDecodeData { vector<DataEntry> entries_; }; +// Helper for parsing simple files. +class LIBPROTOC_EXPORT LineConsumer { + public: + LineConsumer(); + virtual ~LineConsumer(); + virtual bool ConsumeLine(const StringPiece& line, string* out_error) = 0; +}; + +bool ParseSimpleFile( + const string& path, LineConsumer* line_consumer, string* out_error); + } // namespace objectivec } // namespace compiler } // namespace protobuf |