/* Web Polygraph http://www.web-polygraph.org/
* (C) 2003-2006 The Measurement Factory
* Licensed under the Apache License, Version 2.0 */
#include "base/polygraph.h"
#include "xstd/gadgets.h"
#include "xml/XmlRenderer.h"
#include "xml/XmlText.h"
XmlText::XmlText() {
configureStream(theBuf, 2);
}
XmlText::XmlText(const String &t) {
configureStream(theBuf, 2);
text(t);
}
String XmlText::text() const {
String s;
s.append(theBuf.str().data(), theBuf.str().size());
streamFreeze(theBuf, false);
return s;
}
XmlNode *XmlText::clone() const {
XmlText *txt = new XmlText;
txt->buf().write(theBuf.str().data(), theBuf.str().size());
streamFreeze(theBuf, false);
return txt;
}
const String &XmlText::name() const {
static const String myName("<text>"); // no tag can have a name with "<"
return myName;
}
ostream &XmlText::print(ostream &os, const String &pfx) const {
(os << pfx).write(theBuf.str().data(), theBuf.str().size());
streamFreeze(theBuf, false);
return os;
}
void XmlText::render(XmlRenderer &r) const {
const char *str = theBuf.str().data();
streamFreeze(theBuf, false);
r.renderText(str, theBuf.str().size());
}
syntax highlighted by Code2HTML, v. 0.9.1