Go to the documentation of this file.
24 #ifndef _XMLWRITER_HPP_
25 #define _XMLWRITER_HPP_
30 #include "boost/shared_ptr.hpp"
31 #include "boost/iostreams/positioning.hpp"
32 #include "boost/iostreams/filter/counter.hpp"
57 StyleFlag_AttributesOnMultipleLines = 0x04
64 virtual void update(
const std::string& output) = 0;
76 : initialStyle(0), indentationStep(2), outputObserver(0)
84 void add(
const std::string& name,
const double&
value);
85 void add(
const std::string& name,
const int&
value);
88 inline void add(
const std::string& name,
const T&
value)
90 push_back(make_pair(name, boost::lexical_cast<std::string>(
value)));
121 void characters(
const std::string& text,
bool autoEscape =
true);
161 template<
typename Ch>
166 : boost::iostreams::dual_use,
167 boost::iostreams::filter_tag,
168 boost::iostreams::multichar_tag,
169 boost::iostreams::optimally_buffered_tag
177 template<
typename Source>
187 template<
typename Sink>
207 #endif // _XMLWRITER_HPP_
void processingInstruction(const std::string &name, const std::string &data)
writes a processing instruction
The XMLWriter class provides simple, tag-level XML syntax writing.
std::streamsize read(Source &src, char_type *s, std::streamsize n)
boost::iostreams::stream_offset chars_
vector of name/value pairs to be written as XML attributes
virtual ~OutputObserver()
boost::iostreams::stream_offset characters() const
stream_offset position() const
returns current stream position
PWIZ_API_DECL std::string value(const std::string &id, const std::string &name)
convenience function to extract a named value from an id string
initial configuration of the XMLWriter
void add(const std::string &name, const double &value)
void characters(const std::string &text, bool autoEscape=true)
writes character data; autoEscape writes reserved XML characters in the input text in their escaped f...
OutputObserver * outputObserver
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
void add(const std::string &name, const T &value)
stream_offset positionNext() const
returns stream position of next element start tag
virtual void update(const std::string &output)=0
PWIZ_API_DECL std::string encode_xml_id_copy(const std::string &str)
Encodes any characters not suitable in an xml:ID or xml:IDREF with their hexadecimal value,...
boost::shared_ptr< Impl > impl_
unsigned int initialStyle
std::streamsize write(Sink &snk, const char_type *s, std::streamsize n)
XMLWriter(const XMLWriter &)
EmptyElementTag
tag for indicating an empty element
void popStyle()
pops the style stack
basic_charcounter(int first_char=0)
PWIZ_API_DECL std::string & encode_xml_id(std::string &str)
Encodes any characters not suitable in an xml:ID or xml:IDREF with their hexadecimal value,...
void endElement()
writes element end tag
void startElement(const std::string &name, const Attributes &attributes=Attributes(), EmptyElementTag emptyElementTag=NotEmptyElement)
writes element start tag
void pushStyle(unsigned int flags)
pushes style flags onto the internal style stack
unsigned int indentationStep
XMLWriter & operator=(const XMLWriter &)
boost::iostreams::stream_offset stream_offset
interface to allow outside observation of data sent to output stream
PWIZ_API_DECL void read(std::istream &is, CV &cv)
std::streamsize optimal_buffer_size() const
XMLWriter(std::ostream &os, const Config &config=Config())
constructor
void add(const std::string &name, const int &value)