summaryrefslogtreecommitdiff
path: root/odb/emitter.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/emitter.cxx')
-rw-r--r--odb/emitter.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/odb/emitter.cxx b/odb/emitter.cxx
index 6cfe64a..2989ffb 100644
--- a/odb/emitter.cxx
+++ b/odb/emitter.cxx
@@ -3,6 +3,7 @@
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license : GNU GPL v3; see accompanying LICENSE file
+#include <odb/context.hxx>
#include <odb/emitter.hxx>
using namespace std;
@@ -30,7 +31,22 @@ sync ()
s.resize (n - 1);
}
+ // Temporary restore output diversion.
+ //
+ bool r (false);
+ context& ctx (context::current ());
+
+ if (ctx.os.rdbuf () == this)
+ {
+ ctx.restore ();
+ r = true;
+ }
+
e_.line (s);
+
+ if (r)
+ ctx.diverge (this);
+
str (string ());
return 0;
}