#include "html_builder.h"
HTMLTag *HTMLTag::str(const std::string &str) {
result += " " + str;
return this;
}
HTMLTag *HTMLTag::style(const std::string &val) {
attrib("style", val);
return this;
}
HTMLTag *HTMLTag::href(const std::string &val) {
attrib("href", val);
return this;
}
HTMLTag *HTMLTag::cls(const std::string &val) {
attrib("class", val);
return this;
}
HTMLTag *HTMLTag::id(const std::string &val) {
attrib("id", val);
return this;
}
HTMLTag *HTMLTag::name(const std::string &val) {
attrib("name", val);
return this;
}
HTMLTag *HTMLTag::value(const std::string &val) {
attrib("value", val);
return this;
}
HTMLTag *HTMLTag::method(const std::string &val) {
attrib("method", val);
return this;
}
HTMLTag *HTMLTag::type(const std::string &val) {
attrib("type", val);
return this;
}
HTMLTag *HTMLTag::rel(const std::string &val) {
attrib("rel", val);
return this;
}
HTMLTag *HTMLTag::rel_stylesheet() {
attrib("rel", "stylesheet");
return this;
}
HTMLTag *HTMLTag::charset(const std::string &val) {
attrib("charset", val);
return this;
}
HTMLTag *HTMLTag::charset_utf_8() {
attrib("charset", "utf-8");
return this;
}
HTMLTag *HTMLTag::attrib(const std::string &attr, const std::string &val) {
result += " " + attr + "=\"" + val + "\"";
return this;
}
HTMLTag *HTMLTag::start(const std::string &p_tag, const bool p_simple) {
simple = p_simple;
result = "<" + p_tag;
return this;
}
HTMLTag *HTMLTag::reset() {
result.clear();
return this;
}
HTMLTag *HTMLTag::close() {
if (simple)
result += "/>";
else
result += ">";
return this;
}
bool HTMLTag::has_data() {
return result.size() > 0;
}
HTMLTag::HTMLTag() {
simple = true;
}
void HTMLBuilder::comment(const std::string &val) {
write_tag();
result += "";
}
HTMLTag *HTMLBuilder::doctype() {
write_tag();
return tag.start("!DOCTYPE");
}
void HTMLBuilder::doctype(const std::string &val) {
write_tag();
result += "";
}
HTMLTag *HTMLBuilder::a() {
write_tag();
return tag.start("a");
}
HTMLTag *HTMLBuilder::abbr() {
write_tag();
return tag.start("abbr");
}
HTMLTag *HTMLBuilder::acronym() { //Not supported in HTML5. Use instead. Defines an acronym
write_tag();
return tag.start("acronym");
}
HTMLTag *HTMLBuilder::address() {
write_tag();
return tag.start("address");
}
HTMLTag *HTMLBuilder::applet() { //Not supported in HTML5. Use ";
}
void HTMLBuilder::cacronym() {
write_tag();
result += "";
}
void HTMLBuilder::caddress() {
write_tag();
result += "";
}
void HTMLBuilder::capplet() {
write_tag();
result += "";
}
void HTMLBuilder::carea() {
write_tag();
result += "";
}
void HTMLBuilder::carticle() {
write_tag();
result += "";
}
void HTMLBuilder::caside() {
write_tag();
result += "";
}
void HTMLBuilder::caudio() {
write_tag();
result += "";
}
void HTMLBuilder::cb() {
write_tag();
result += "";
}
void HTMLBuilder::cbasefont() {
write_tag();
result += "";
}
void HTMLBuilder::cbdi() {
write_tag();
result += "";
}
void HTMLBuilder::cbdo() {
write_tag();
result += "";
}
void HTMLBuilder::cbig() {
write_tag();
result += "";
}
void HTMLBuilder::cblockquote() {
write_tag();
result += "";
}
void HTMLBuilder::cbody() {
write_tag();
result += "