20 std::ostream & get_stream() {
24 std::string get_buffer() {
25 return default_.str();
28 void to_file(
const std::string & filename) {
29 to_file(filename.c_str());
32 void to_file(
const char * filename) {
33 std::ofstream f(filename);
36 std::cerr <<
"Failed to open " << filename << std::endl;
40 f << default_.rdbuf();
43 bool equal_blessed(
const char * filename) {
44 std::string testdir_filename(filename);
47 std::stringstream backup;
48 backup << default_.rdbuf();
49 backup >> default_.rdbuf();
52 size_t lastindex = testdir_filename.find_last_of(
".");
53 std::string save_output =
54 testdir_filename.substr(0, lastindex) +
".current";
57 std::ifstream f(testdir_filename);
60 std::cerr <<
"Failed to open " << filename << std::endl;
67 if(backup.str().compare(ss.str()) == 0) {
76 : stream_(
new std::ostream(default_.rdbuf())) {}
78 std::stringstream default_;
79 std::shared_ptr<std::ostream> stream_;
Definition: control.hh:31