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)));
95 XMLWriter(std::ostream& os,
const Config& config = Config());
99 void pushStyle(
unsigned int flags);
105 void processingInstruction(
const std::string& name,
const std::string& data);
111 void startElement(
const std::string& name,
112 const Attributes& attributes = Attributes(),
113 EmptyElementTag emptyElementTag = NotEmptyElement);
121 void characters(
const std::string& text,
bool autoEscape =
true);
134 boost::shared_ptr<Impl>
impl_;
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_
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
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
OutputObserver * outputObserver
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
void add(const std::string &name, const T &value)
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)
EmptyElementTag
tag for indicating an empty element
PWIZ_API_DECL Position position(CVID cvid=CVID_Unknown)
returns a Position corresponding to one of the following CVIDs: CVID_Unknown: Position::Anywhere MS_m...
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,...
unsigned int indentationStep
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