summaryrefslogtreecommitdiff
path: root/odb/odb/emitter.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-01-22 15:58:08 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-01-24 17:02:47 +0300
commit823026b58211a4166de06ac243d978dcb9930271 (patch)
tree97b43039cb769f8bee410e8536f9f945f2825153 /odb/odb/emitter.cxx
parentb56b9c6796d8853758f0f5967488260d61b788e2 (diff)
Turn odb repository into muti-package repository
Also remove the autoconf/make-based build system.
Diffstat (limited to 'odb/odb/emitter.cxx')
-rw-r--r--odb/odb/emitter.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/odb/odb/emitter.cxx b/odb/odb/emitter.cxx
new file mode 100644
index 0000000..d6d8eac
--- /dev/null
+++ b/odb/odb/emitter.cxx
@@ -0,0 +1,50 @@
+// file : odb/emitter.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/context.hxx>
+#include <odb/emitter.hxx>
+
+using namespace std;
+
+void emitter::
+pre ()
+{
+}
+
+void emitter::
+post ()
+{
+}
+
+int emitter_ostream::streambuf::
+sync ()
+{
+ string s (str ());
+
+ // Get rid of the trailing newline if any.
+ //
+ if (string::size_type n = s.size ())
+ {
+ if (s[n - 1] == '\n')
+ 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;
+}