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)));
99 void pushStyle(
unsigned int flags);
105 void processingInstruction(
const std::string& name,
const std::string& data);
111 void startElement(
const std::string& name,
121 void characters(
const std::string& text,
bool autoEscape =
true);
129 stream_offset positionNext()
const;
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
174 boost::iostreams::stream_offset
characters()
const {
return chars_; }
177 template<
typename Source>
178 std::streamsize
read(Source& src, char_type* s, std::streamsize n)
187 template<
typename Sink>
188 std::streamsize
write(Sink& snk,
const char_type* s, std::streamsize n)
207 #endif // _XMLWRITER_HPP_
std::streamsize read(Source &src, char_type *s, std::streamsize n)
boost::shared_ptr< Impl > impl_
void add(const std::string &name, const T &value)
boost::iostreams::stream_offset characters() const
The XMLWriter class provides simple, tag-level XML syntax writing.
EmptyElementTag
tag for indicating an empty element
virtual ~OutputObserver()
unsigned int indentationStep
boost::iostreams::stream_offset chars_
initial configuration of the XMLWriter
interface to allow outside observation of data sent to output stream
std::streamsize write(Sink &snk, const char_type *s, std::streamsize n)
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
unsigned int initialStyle
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...
vector of name/value pairs to be written as XML attributes
PWIZ_API_DECL void read(std::istream &is, CV &cv)
basic_charcounter(int first_char=0)
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...
boost::iostreams::stream_offset stream_offset
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
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...
OutputObserver * outputObserver
std::streamsize optimal_buffer_size() const