diff options
Diffstat (limited to 'cutl/xml/serializer.hxx')
-rw-r--r-- | cutl/xml/serializer.hxx | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/cutl/xml/serializer.hxx b/cutl/xml/serializer.hxx index e3fef54..591a20a 100644 --- a/cutl/xml/serializer.hxx +++ b/cutl/xml/serializer.hxx @@ -50,17 +50,20 @@ namespace cutl typedef xml::qname qname_type; - // Serialize to std::ostream. Name is used in diagnostics to identify - // the document being serialized. std::ios_base::failure exception is - // used to report io errors (badbit and failbit). The indentation - // argument specifies the number of indentation spaces that should - // be used for pretty-printing. If 0 is passed, no pretty-printing - // is performed. + // Serialize to std::ostream. Output name is used in diagnostics to + // identify the document being serialized. std::ios_base::failure + // exception is used to report io errors (badbit and failbit). The + // indentation argument specifies the number of indentation spaces + // that should be used for pretty-printing. If 0 is passed, no + // pretty-printing is performed. // serializer (std::ostream&, - const std::string& name, + const std::string& output_name, unsigned short indentation = 2); + const std::string& + output_name () const {return oname_;} + // Serialization functions. // public: @@ -96,19 +99,37 @@ namespace cutl void attribute (const qname_type& qname, const std::string& value); + template <typename T> + void + attribute (const qname_type& qname, const T& value); + void attribute (const std::string& name, const std::string& value); + template <typename T> + void + attribute (const std::string& name, const T& value); + void attribute (const std::string& ns, const std::string& name, const std::string& value); + template <typename T> + void + attribute (const std::string& ns, + const std::string& name, + const T& value); + // Characters. // void characters (const std::string& value); + template <typename T> + void + characters (const T& value); + // Namespaces declaration. If prefix is empty, then the default // namespace is declared. If both prefix and namespace are empty, // then the default namespace declaration is cleared (xmlns=""). @@ -140,7 +161,7 @@ namespace cutl private: std::ostream& os_; std::ostream::iostate os_state_; // Original exception state. - const std::string name_; + const std::string oname_; genxWriter s_; genxSender sender_; |