}
}
+void t_generator::generate_docstring_comment(ofstream& out,
+ const string& comment_start,
+ const string& line_prefix,
+ const string& contents,
+ const string& comment_end) {
+ if (comment_start != "") indent(out) << comment_start;
+ stringstream docs(contents, ios_base::in);
+ while (!docs.eof()) {
+ char line[1024];
+ docs.getline(line, 1024);
+ if (strlen(line) > 0 || !docs.eof()) { // skip the empty last line
+ indent(out) << line_prefix << line << std::endl;
+ }
+ }
+ if (comment_end != "") indent(out) << comment_end;
+}
+
void t_generator_registry::register_generator(t_generator_factory* factory) {
gen_map_t& the_map = get_generator_map();
#include <string>
#include <iostream>
+#include <fstream>
#include <sstream>
#include "parse/t_program.h"
#include "globals.h"
const t_program* get_program() const { return program_; }
+ void generate_docstring_comment(std::ofstream& out,
+ const std::string& comment_start,
+ const std::string& line_prefix,
+ const std::string& contents,
+ const std::string& comment_end);
protected:
/**
#ifndef T_OOP_GENERATOR_H
#define T_OOP_GENERATOR_H
-#include <sstream>
#include <string>
-#include <fstream>
#include <iostream>
#include "globals.h"
return original;
}
- void generate_docstring_comment(std::ofstream& out,
- std::string comment_start,
- std::string line_prefix,
- std::string contents,
- std::string comment_end) {
- if (comment_start != "") indent(out) << comment_start;
- std::stringstream docs(contents, std::ios_base::in);
- while (!docs.eof()) {
- char line[1024];
- docs.getline(line, 1024);
- if (strlen(line) > 0 || !docs.eof()) { // skip the empty last line
- indent(out) << line_prefix << line << std::endl;
- }
- }
- if (comment_end != "") indent(out) << comment_end;
- }
-
/**
* Generates a comment about this code being autogenerated, using C++ style
* comments, which are also fair game in Java / PHP, yay!