~verterok/ubuntu/lucid/protobuf/2.4.0a-backport

« back to all changes in this revision

Viewing changes to src/google/protobuf/compiler/code_generator.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-05-31 14:41:47 UTC
  • mfrom: (2.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110531144147-s41g5fozgvyo462l
Tags: 2.4.0a-2ubuntu1
* Merge with Debian; remaining changes:
  - Fix linking with -lpthread.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
// Defined in this file.
55
55
class CodeGenerator;
56
 
class OutputDirectory;
 
56
class GeneratorContext;
57
57
 
58
58
// The abstract interface to a class which generates code implementing a
59
59
// particular proto file in a particular language.  A number of these may
76
76
  // the problem (e.g. "invalid parameter") and returns false.
77
77
  virtual bool Generate(const FileDescriptor* file,
78
78
                        const string& parameter,
79
 
                        OutputDirectory* output_directory,
 
79
                        GeneratorContext* generator_context,
80
80
                        string* error) const = 0;
81
81
 
82
82
 private:
85
85
 
86
86
// CodeGenerators generate one or more files in a given directory.  This
87
87
// abstract interface represents the directory to which the CodeGenerator is
88
 
// to write.
89
 
class LIBPROTOC_EXPORT OutputDirectory {
 
88
// to write and other information about the context in which the Generator
 
89
// runs.
 
90
class LIBPROTOC_EXPORT GeneratorContext {
90
91
 public:
91
 
  inline OutputDirectory() {}
92
 
  virtual ~OutputDirectory();
 
92
  inline GeneratorContext() {}
 
93
  virtual ~GeneratorContext();
93
94
 
94
95
  // Opens the given file, truncating it if it exists, and returns a
95
96
  // ZeroCopyOutputStream that writes to the file.  The caller takes ownership
112
113
  virtual io::ZeroCopyOutputStream* OpenForInsert(
113
114
      const string& filename, const string& insertion_point);
114
115
 
 
116
  // Returns a vector of FileDescriptors for all the files being compiled
 
117
  // in this run.  Useful for languages, such as Go, that treat files
 
118
  // differently when compiled as a set rather than individually.
 
119
  virtual void ListParsedFiles(vector<const FileDescriptor*>* output);
 
120
 
115
121
 private:
116
 
  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OutputDirectory);
 
122
  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GeneratorContext);
117
123
};
118
124
 
 
125
// The type GeneratorContext was once called OutputDirectory. This typedef
 
126
// provides backward compatibility.
 
127
typedef GeneratorContext OutputDirectory;
 
128
 
119
129
// Several code generators treat the parameter argument as holding a
120
130
// list of options separated by commas.  This helper function parses
121
131
// a set of comma-delimited name/value pairs: e.g.,