From 5f12164f54a12500d2d8276937b7ed4fec408b99 Mon Sep 17 00:00:00 2001 From: "kenton@google.com" Date: Wed, 23 Dec 2009 07:03:06 +0000 Subject: Refactor the way output is handled in CommandLineInterface -- now it will be stored in-memory until all code generators have completed, then dumped to disk all at once. While this means that protoc uses more memory, the code is much simpler, and handles insertions much faster. Also, this made it easier to implement a useful feature: insertions will be indented to match the insertion point line. Therefore, when inserting into Python code, you don't have to figure out how much to indent your inserted code. The refactoring should also make it easier to implement output-to-jar at some point. --- src/google/protobuf/compiler/command_line_interface.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/google/protobuf/compiler/command_line_interface.h') diff --git a/src/google/protobuf/compiler/command_line_interface.h b/src/google/protobuf/compiler/command_line_interface.h index 1070a83b..1a75ec85 100644 --- a/src/google/protobuf/compiler/command_line_interface.h +++ b/src/google/protobuf/compiler/command_line_interface.h @@ -174,9 +174,9 @@ class LIBPROTOC_EXPORT CommandLineInterface { // ----------------------------------------------------------------- class ErrorPrinter; - class DiskOutputDirectory; - class ErrorReportingFileOutput; - class InsertionOutputStream; + class MemoryOutputDirectory; + class SubOutputDirectory; + class MemoryOutputStream; // Clear state from previous Run(). void Clear(); @@ -212,7 +212,8 @@ class LIBPROTOC_EXPORT CommandLineInterface { // Generate the given output file from the given input. struct OutputDirective; // see below bool GenerateOutput(const vector& parsed_files, - const OutputDirective& output_directive); + const OutputDirective& output_directive, + OutputDirectory* parent_output_directory); bool GeneratePluginOutput(const vector& parsed_files, const string& plugin_name, const string& parameter, -- cgit v1.2.3