You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1005 B
60 lines
1005 B
#include "XmlTextNode.h" |
|
|
|
#include <StringUtils.h> |
|
|
|
XmlTextNode::XmlTextNode(const char* tag, const char* text) : XmlAudioNode(tag) |
|
{ |
|
XOJ_INIT_TYPE(XmlTextNode); |
|
|
|
this->text = g_strdup(text); |
|
} |
|
|
|
XmlTextNode::XmlTextNode(const char* tag) : XmlAudioNode(tag) |
|
{ |
|
XOJ_INIT_TYPE(XmlTextNode); |
|
|
|
this->text = NULL; |
|
|
|
XOJ_RELEASE_TYPE(XmlTextNode); |
|
} |
|
|
|
XmlTextNode::~XmlTextNode() |
|
{ |
|
XOJ_CHECK_TYPE(XmlTextNode); |
|
|
|
g_free(this->text); |
|
this->text = NULL; |
|
|
|
XOJ_RELEASE_TYPE(XmlTextNode); |
|
} |
|
|
|
void XmlTextNode::setText(const char* text) |
|
{ |
|
XOJ_CHECK_TYPE(XmlTextNode); |
|
|
|
g_free(this->text); |
|
this->text = g_strdup(text); |
|
} |
|
|
|
void XmlTextNode::writeOut(OutputStream* out) |
|
{ |
|
XOJ_CHECK_TYPE(XmlTextNode); |
|
|
|
out->write("<"); |
|
out->write(tag); |
|
writeAttributes(out); |
|
|
|
out->write(">"); |
|
|
|
string tmp(this->text); |
|
StringUtils::replaceAllChars(tmp,{ |
|
replace_pair('&', "&"), |
|
replace_pair('<', "<"), |
|
replace_pair('>', ">") |
|
}); |
|
out->write(tmp); |
|
|
|
out->write("</"); |
|
out->write(tag); |
|
out->write(">\n"); |
|
}
|
|
|