aboutsummaryrefslogtreecommitdiff
path: root/xml/serializer
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-08-10 18:30:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-08-10 18:30:25 +0200
commit5d1ba0388af2f66d1d83db755361d3b2eb5f68ad (patch)
treef265cbe1ae81a84631e4a2d63dfd471a30404633 /xml/serializer
parent60366c5e3e326eb0d5b828ba8bbd81f317cd24e3 (diff)
Add streaming API to serializer
Show what can be done with it in the xhtml example.
Diffstat (limited to 'xml/serializer')
-rw-r--r--xml/serializer16
1 files changed, 16 insertions, 0 deletions
diff --git a/xml/serializer b/xml/serializer
index 316a501..eb592df 100644
--- a/xml/serializer
+++ b/xml/serializer
@@ -185,6 +185,8 @@ namespace xml
// namespace is declared. If both prefix and namespace are empty,
// then the default namespace declaration is cleared (xmlns="").
//
+ // This function should be called after start_element().
+ //
void
namespace_decl (const std::string& ns, const std::string& prefix);
@@ -251,6 +253,20 @@ namespace xml
genxSender sender_;
std::size_t depth_;
};
+
+ // Stream-like interface for serializer. If the passed argument
+ // is a function with the void f(serializer&) signature or is a
+ // function object with the void operator() (serializer&) const
+ // operator, then this function (object) is called with the passed
+ // serializer. Otherwise, the argument is passed to the serializer's
+ // characters() function.
+ //
+ serializer&
+ operator<< (serializer&, void (*func) (serializer&));
+
+ template <typename T>
+ serializer&
+ operator<< (serializer&, const T& value);
}
#include <xml/serializer.ixx>