#include "html_builder_bind.h" #include "core/print_string.h" #include "core/ustring.h" //#include "web/http/request.h" _HTMLTag *_HTMLTag::str(const String &str) { result += " " + str; return this; } _HTMLTag *_HTMLTag::style(const String &val) { attrib("style", val); return this; } _HTMLTag *_HTMLTag::href(const String &val) { attrib("href", val); return this; } _HTMLTag *_HTMLTag::cls(const String &val) { attrib("class", val); return this; } _HTMLTag *_HTMLTag::clsse(const String &val) { if (val == "") { return this; } attrib("class", val); return this; } _HTMLTag *_HTMLTag::id(const String &val) { attrib("id", val); return this; } _HTMLTag *_HTMLTag::name(const String &val) { attrib("name", val); return this; } _HTMLTag *_HTMLTag::content(const String &val) { attrib("content", val); return this; } _HTMLTag *_HTMLTag::value(const String &val) { attrib("value", val); return this; } _HTMLTag *_HTMLTag::accept(const String &val) { attrib("accept", val); return this; } _HTMLTag *_HTMLTag::src(const String &val) { attrib("src", val); return this; } _HTMLTag *_HTMLTag::alt(const String &val) { attrib("alt", val); return this; } _HTMLTag *_HTMLTag::autocomplete(const String &val) { attrib("autocomplete", val); return this; } _HTMLTag *_HTMLTag::autocomplete_off() { attrib("autocomplete", "off"); return this; } _HTMLTag *_HTMLTag::autocomplete_on() { attrib("autocomplete", "on"); return this; } _HTMLTag *_HTMLTag::autocomplete_name() { attrib("autocomplete", "name"); return this; } _HTMLTag *_HTMLTag::autocomplete_name_honorific_prefix() { attrib("autocomplete", "honorific-prefix"); return this; } _HTMLTag *_HTMLTag::autocomplete_name_given_name() { attrib("autocomplete", "given-name"); return this; } _HTMLTag *_HTMLTag::autocomplete_name_additional_name() { attrib("autocomplete", "additional-name"); return this; } _HTMLTag *_HTMLTag::autocomplete_name_family_name() { attrib("autocomplete", "family-name"); return this; } _HTMLTag *_HTMLTag::autocomplete_name_honorific_suffix() { attrib("autocomplete", "honorific-suffix"); return this; } _HTMLTag *_HTMLTag::autocomplete_name_nickname() { attrib("autocomplete", "nickname"); return this; } _HTMLTag *_HTMLTag::autocomplete_email() { attrib("autocomplete", "email"); return this; } _HTMLTag *_HTMLTag::autocomplete_username() { attrib("autocomplete", "username"); return this; } _HTMLTag *_HTMLTag::autocomplete_new_password() { attrib("autocomplete", "new-password"); return this; } _HTMLTag *_HTMLTag::autocomplete_current_password() { attrib("autocomplete", "current-password"); return this; } _HTMLTag *_HTMLTag::autocomplete_one_time_code() { attrib("autocomplete", "one-time-code"); return this; } _HTMLTag *_HTMLTag::autocomplete_organization_title() { attrib("autocomplete", "organization-title"); return this; } _HTMLTag *_HTMLTag::autocomplete_organization() { attrib("autocomplete", "organization"); return this; } _HTMLTag *_HTMLTag::autocomplete_street_address() { attrib("autocomplete", "street-address"); return this; } _HTMLTag *_HTMLTag::autocomplete_address_line1() { attrib("autocomplete", "address-line1"); return this; } _HTMLTag *_HTMLTag::autocomplete_address_line2() { attrib("autocomplete", "address-line2"); return this; } _HTMLTag *_HTMLTag::autocomplete_address_line3() { attrib("autocomplete", "address-line3"); return this; } _HTMLTag *_HTMLTag::autocomplete_address_level_1() { attrib("autocomplete", "address-level1"); return this; } _HTMLTag *_HTMLTag::autocomplete_address_level_2() { attrib("autocomplete", "address-level2"); return this; } _HTMLTag *_HTMLTag::autocomplete_address_level_3() { attrib("autocomplete", "address-level3"); return this; } _HTMLTag *_HTMLTag::autocomplete_address_level_4() { attrib("autocomplete", "address-level4"); return this; } _HTMLTag *_HTMLTag::autocomplete_country() { attrib("autocomplete", "country"); return this; } _HTMLTag *_HTMLTag::autocomplete_country_name() { attrib("autocomplete", "country-name"); return this; } _HTMLTag *_HTMLTag::autocomplete_postal_code() { attrib("autocomplete", "postal-code"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_name() { attrib("autocomplete", "cc-name"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_given_name() { attrib("autocomplete", "cc-given-name"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_additional_name() { attrib("autocomplete", "cc-additional-name"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_family_name() { attrib("autocomplete", "cc-family-name"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_number() { attrib("autocomplete", "cc-number"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_exp() { attrib("autocomplete", "cc-exp"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_exp_month() { attrib("autocomplete", "cc-exp-month"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_exp_year() { attrib("autocomplete", "cc-exp-year"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_csc() { attrib("autocomplete", "cc-csc"); return this; } _HTMLTag *_HTMLTag::autocomplete_cc_type() { attrib("autocomplete", "cc-type"); return this; } _HTMLTag *_HTMLTag::autocomplete_transaction_currency() { attrib("autocomplete", "transaction-currency"); return this; } _HTMLTag *_HTMLTag::autocomplete_transaction_amount() { attrib("autocomplete", "transaction-amount"); return this; } _HTMLTag *_HTMLTag::autocomplete_language() { attrib("autocomplete", "language"); return this; } _HTMLTag *_HTMLTag::autocomplete_bday() { attrib("autocomplete", "bday"); return this; } _HTMLTag *_HTMLTag::autocomplete_bday_day() { attrib("autocomplete", "bday-day"); return this; } _HTMLTag *_HTMLTag::autocomplete_bday_month() { attrib("autocomplete", "bday-month"); return this; } _HTMLTag *_HTMLTag::autocomplete_bday_year() { attrib("autocomplete", "bday-year"); return this; } _HTMLTag *_HTMLTag::autocomplete_sex() { attrib("autocomplete", "sex"); return this; } _HTMLTag *_HTMLTag::autocomplete_tel() { attrib("autocomplete", "tel"); return this; } _HTMLTag *_HTMLTag::autocomplete_tel_country_code() { attrib("autocomplete", "tel-country-code"); return this; } _HTMLTag *_HTMLTag::autocomplete_tel_national() { attrib("autocomplete", "tel-national"); return this; } _HTMLTag *_HTMLTag::autocomplete_tel_area_code() { attrib("autocomplete", "tel-area-code"); return this; } _HTMLTag *_HTMLTag::autocomplete_tel_local() { attrib("autocomplete", "tel-local"); return this; } _HTMLTag *_HTMLTag::autocomplete_tel_extension() { attrib("autocomplete", "tel-extension"); return this; } _HTMLTag *_HTMLTag::autocomplete_impp() { attrib("autocomplete", "impp"); return this; } _HTMLTag *_HTMLTag::autocomplete_url() { attrib("autocomplete", "url"); return this; } _HTMLTag *_HTMLTag::autocomplete_photo() { attrib("autocomplete", "photo"); return this; } _HTMLTag *_HTMLTag::onclick(const String &val) { attrib("onclick", val); return this; } _HTMLTag *_HTMLTag::inputmode(const String &val) { attrib("inputmode", val); return this; } _HTMLTag *_HTMLTag::list(const String &val) { attrib("list", val); return this; } _HTMLTag *_HTMLTag::checked(const bool val) { if (val) { result += " checked"; } return this; } _HTMLTag *_HTMLTag::selected(const bool val) { if (val) { result += " selected"; } return this; } _HTMLTag *_HTMLTag::autofocus(const bool val) { if (val) { result += " autofocus"; } return this; } _HTMLTag *_HTMLTag::disabled(const bool val) { if (val) { result += " disabled"; } return this; } _HTMLTag *_HTMLTag::multiple(const bool val) { if (val) { result += " multiple"; } return this; } _HTMLTag *_HTMLTag::required(const bool val) { if (val) { result += " required"; } return this; } _HTMLTag *_HTMLTag::spellcheck(const bool val) { if (val) { attrib("spellcheck", "true"); } else { attrib("spellcheck", "false"); } return this; } _HTMLTag *_HTMLTag::max(const String &val) { attrib("max", val); return this; } _HTMLTag *_HTMLTag::min(const String &val) { attrib("min", val); return this; } _HTMLTag *_HTMLTag::step(const String &val) { attrib("step", val); return this; } _HTMLTag *_HTMLTag::step_any() { attrib("step", "any"); return this; } _HTMLTag *_HTMLTag::minlength(const int val) { attrib("minlength", String::num(val)); return this; } _HTMLTag *_HTMLTag::minlength(const String &val) { attrib("minlength", val); return this; } _HTMLTag *_HTMLTag::maxlength(const int val) { attrib("maxlength", String::num(val)); return this; } _HTMLTag *_HTMLTag::maxlength(const String &val) { attrib("maxlength", val); return this; } _HTMLTag *_HTMLTag::size(const int val) { attrib("size", String::num(val)); return this; } _HTMLTag *_HTMLTag::size(const String &val) { attrib("size", val); return this; } _HTMLTag *_HTMLTag::width(const int val) { attrib("width", String::num(val)); return this; } _HTMLTag *_HTMLTag::width(const String &val) { attrib("width", val); return this; } _HTMLTag *_HTMLTag::height(const int val) { attrib("height", String::num(val)); return this; } _HTMLTag *_HTMLTag::height(const String &val) { attrib("height", val); return this; } _HTMLTag *_HTMLTag::pattern(const String &val) { attrib("pattern", val); return this; } _HTMLTag *_HTMLTag::method(const String &val) { attrib("method", val); return this; } _HTMLTag *_HTMLTag::method_get() { attrib("method", "get"); return this; } _HTMLTag *_HTMLTag::method_post() { attrib("method", "post"); return this; } _HTMLTag *_HTMLTag::action(const String &val) { attrib("action", val); return this; } _HTMLTag *_HTMLTag::type(const String &val) { attrib("type", val); return this; } _HTMLTag *_HTMLTag::placeholder(const String &val) { attrib("placeholder", val); return this; } _HTMLTag *_HTMLTag::fora(const String &val) { attrib("for", val); return this; } _HTMLTag *_HTMLTag::rel(const String &val) { attrib("rel", val); return this; } _HTMLTag *_HTMLTag::rel_stylesheet() { attrib("rel", "stylesheet"); return this; } _HTMLTag *_HTMLTag::rel_alternate() { attrib("rel", "alternate"); return this; } _HTMLTag *_HTMLTag::rel_author() { attrib("rel", "author"); return this; } _HTMLTag *_HTMLTag::rel_bookmark() { attrib("rel", "bookmark"); return this; } _HTMLTag *_HTMLTag::rel_external() { attrib("rel", "external"); return this; } _HTMLTag *_HTMLTag::rel_help() { attrib("rel", "help"); return this; } _HTMLTag *_HTMLTag::rel_next() { attrib("rel", "next"); return this; } _HTMLTag *_HTMLTag::rel_nofollow() { attrib("rel", "nofollow"); return this; } _HTMLTag *_HTMLTag::rel_noopener() { attrib("rel", "noopener"); return this; } _HTMLTag *_HTMLTag::rel_noreferrer() { attrib("rel", "noreferrer"); return this; } _HTMLTag *_HTMLTag::rel_prev() { attrib("rel", "prev"); return this; } _HTMLTag *_HTMLTag::rel_search() { attrib("rel", "search"); return this; } _HTMLTag *_HTMLTag::rel_tag() { attrib("rel", "tag"); return this; } _HTMLTag *_HTMLTag::charset(const String &val) { attrib("charset", val); return this; } _HTMLTag *_HTMLTag::charset_utf_8() { attrib("charset", "utf-8"); return this; } _HTMLTag *_HTMLTag::itbutton() { attrib("type", "button"); return this; } _HTMLTag *_HTMLTag::itcheckbox() { attrib("type", "checkbox"); return this; } _HTMLTag *_HTMLTag::itcolor() { attrib("type", "color"); return this; } _HTMLTag *_HTMLTag::itdate() { attrib("type", "date"); return this; } _HTMLTag *_HTMLTag::itdatetime_local() { attrib("type", "datetime_local"); return this; } _HTMLTag *_HTMLTag::itemail() { attrib("type", "email"); return this; } _HTMLTag *_HTMLTag::itfile() { attrib("type", "file"); return this; } _HTMLTag *_HTMLTag::ithidden() { attrib("type", "hidden"); return this; } _HTMLTag *_HTMLTag::itimage() { attrib("type", "image"); return this; } _HTMLTag *_HTMLTag::itmonth() { attrib("type", "month"); return this; } _HTMLTag *_HTMLTag::itnumber() { attrib("type", "number"); return this; } _HTMLTag *_HTMLTag::itpassword() { attrib("type", "password"); return this; } _HTMLTag *_HTMLTag::itradio() { attrib("type", "radio"); return this; } _HTMLTag *_HTMLTag::itrange() { attrib("type", "range"); return this; } _HTMLTag *_HTMLTag::itreset() { attrib("type", "reset"); return this; } _HTMLTag *_HTMLTag::itsearch() { attrib("type", "search"); return this; } _HTMLTag *_HTMLTag::itsubmit() { attrib("type", "submit"); return this; } _HTMLTag *_HTMLTag::ittel() { attrib("type", "tel"); return this; } _HTMLTag *_HTMLTag::ittext() { attrib("type", "text"); return this; } _HTMLTag *_HTMLTag::ittime() { attrib("type", "time"); return this; } _HTMLTag *_HTMLTag::iturl() { attrib("type", "url"); return this; } _HTMLTag *_HTMLTag::itweek() { attrib("type", "week"); return this; } _HTMLTag *_HTMLTag::inputmode_none() { attrib("inputmode", "none"); return this; } _HTMLTag *_HTMLTag::inputmode_text() { attrib("inputmode", "text"); return this; } _HTMLTag *_HTMLTag::inputmode_decimal() { attrib("inputmode", "decimal"); return this; } _HTMLTag *_HTMLTag::inputmode_numeric() { attrib("inputmode", "numeric"); return this; } _HTMLTag *_HTMLTag::inputmode_tel() { attrib("inputmode", "tel"); return this; } _HTMLTag *_HTMLTag::inputmode_search() { attrib("inputmode", "search"); return this; } _HTMLTag *_HTMLTag::inputmode_email() { attrib("inputmode", "email"); return this; } _HTMLTag *_HTMLTag::inputmode_url() { attrib("inputmode", "url"); return this; } _HTMLTag *_HTMLTag::attrib(const String &attr, const String &val) { result += " " + attr + "=\"" + val + "\""; return this; } _HTMLTag *_HTMLTag::start(const 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; } _HTMLBuilder *_HTMLTag::f() { return owner; } bool _HTMLTag::has_data() { return result.size() > 0; } _HTMLTag::_HTMLTag() { simple = true; owner = nullptr; } void _HTMLTag::_bind_methods() { ClassDB::bind_method(D_METHOD("style", "val"), &_HTMLTag::style); } _HTMLBuilder *_HTMLBuilder::comment(const String &val) { write_tag(); result += ""; return this; } _HTMLTag *_HTMLBuilder::doctype() { write_tag(); return tag.start("!DOCTYPE"); } _HTMLBuilder *_HTMLBuilder::doctype(const String &val) { write_tag(); result += ""; return this; } _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 or instead. Defines an embedded applet write_tag(); return tag.start("applet"); } _HTMLTag *_HTMLBuilder::area() { write_tag(); return tag.start("area"); } _HTMLTag *_HTMLBuilder::article() { write_tag(); return tag.start("article"); } _HTMLTag *_HTMLBuilder::aside() { write_tag(); return tag.start("aside"); } _HTMLTag *_HTMLBuilder::audio() { write_tag(); return tag.start("audio"); } _HTMLTag *_HTMLBuilder::b() { write_tag(); return tag.start("b"); } _HTMLTag *_HTMLBuilder::basefont() { // Not supported in HTML5. Use CSS instead. Specifies a default color, size, and font for all text in a document write_tag(); return tag.start("basefont"); } _HTMLTag *_HTMLBuilder::bdi() { write_tag(); return tag.start("bdi"); } _HTMLTag *_HTMLBuilder::bdo() { write_tag(); return tag.start("bdo"); } _HTMLTag *_HTMLBuilder::big() { // Not supported in HTML5. Use CSS instead. Defines big text write_tag(); return tag.start("big"); } _HTMLTag *_HTMLBuilder::blockquote() { write_tag(); return tag.start("blockquote"); } _HTMLTag *_HTMLBuilder::body() { write_tag(); return tag.start("body"); } _HTMLTag *_HTMLBuilder::br() { write_tag(); return tag.start("br", true); } _HTMLTag *_HTMLBuilder::button() { write_tag(); return tag.start("button"); } _HTMLTag *_HTMLBuilder::canvas() { write_tag(); return tag.start("canvas"); } _HTMLTag *_HTMLBuilder::caption() { write_tag(); return tag.start("caption"); } _HTMLTag *_HTMLBuilder::center() { // Not supported in HTML5. Use CSS instead. Defines centered text write_tag(); return tag.start("center"); } _HTMLTag *_HTMLBuilder::cite() { write_tag(); return tag.start("cite"); } _HTMLTag *_HTMLBuilder::code() { write_tag(); return tag.start("code"); } _HTMLTag *_HTMLBuilder::col() { write_tag(); return tag.start("col"); } _HTMLTag *_HTMLBuilder::colgroup() { write_tag(); return tag.start("colgroup"); } _HTMLTag *_HTMLBuilder::data() { write_tag(); return tag.start("cite"); } _HTMLTag *_HTMLBuilder::datalist() { write_tag(); return tag.start("datalist"); } _HTMLTag *_HTMLBuilder::dd() { write_tag(); return tag.start("dd"); } _HTMLTag *_HTMLBuilder::del() { write_tag(); return tag.start("del"); } _HTMLTag *_HTMLBuilder::details() { write_tag(); return tag.start("details"); } _HTMLTag *_HTMLBuilder::dfn() { write_tag(); return tag.start("dfn"); } _HTMLTag *_HTMLBuilder::dialog() { write_tag(); return tag.start("dialog"); } _HTMLTag *_HTMLBuilder::dir() { // Not supported in HTML5. Use "; return this; } _HTMLBuilder *_HTMLBuilder::c_ol() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::coptgroup() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::coption() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::coutput() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cp() { write_tag(); result += "

"; return this; } _HTMLBuilder *_HTMLBuilder::cparam() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cpicture() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cpre() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cprogress() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cq() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::crp() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::crt() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cruby() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cs() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::csamp() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cscript() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::csection() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cselect() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::csmall() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::csource() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cspan() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cstrike() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cstrong() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cstyle() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::csub() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::csummary() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::csup() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::csvg() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctable() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctbody() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctd() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctemplateh() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctextarea() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctfoot() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cth() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cthead() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctime() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctitle() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctr() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctrack() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::ctt() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cu() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cul() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cvar() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cvideo() { write_tag(); result += ""; return this; } _HTMLBuilder *_HTMLBuilder::cwbr() { write_tag(); result += ""; return this; } _HTMLTag *_HTMLBuilder::form_get() { write_tag(); return tag.start("form")->method_get(); } _HTMLTag *_HTMLBuilder::form_post() { write_tag(); return tag.start("form")->method_post(); } _HTMLBuilder *_HTMLBuilder::form_get(const String &action, const String &cls, const String &id) { _HTMLTag *t = form_get(); t->fora(action); if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::form_post(const String &action, const String &cls, const String &id) { _HTMLTag *t = form_post(); t->action(action); if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } /* _HTMLBuilder *_HTMLBuilder::form_post(const String &action, Request *request, const String &cls, const String &id) { form_post(action, cls, id); csrf_token(request); return this; } */ _HTMLTag *_HTMLBuilder::input_button() { write_tag(); return tag.start("input")->itbutton(); } _HTMLTag *_HTMLBuilder::input_checkbox() { write_tag(); return tag.start("input")->itcheckbox(); } _HTMLTag *_HTMLBuilder::input_color() { write_tag(); return tag.start("input")->itcolor(); } _HTMLTag *_HTMLBuilder::input_date() { write_tag(); return tag.start("input")->itdate(); } _HTMLTag *_HTMLBuilder::input_datetime_local() { write_tag(); return tag.start("input")->itdatetime_local(); } _HTMLTag *_HTMLBuilder::input_email() { write_tag(); return tag.start("input")->itemail(); } _HTMLTag *_HTMLBuilder::input_file() { write_tag(); return tag.start("input")->itfile(); } _HTMLTag *_HTMLBuilder::input_hidden() { write_tag(); return tag.start("input")->ithidden(); } _HTMLTag *_HTMLBuilder::input_image() { write_tag(); return tag.start("input")->itimage(); } _HTMLTag *_HTMLBuilder::input_month() { write_tag(); return tag.start("input")->itmonth(); } _HTMLTag *_HTMLBuilder::input_number() { write_tag(); return tag.start("input")->itnumber(); } _HTMLTag *_HTMLBuilder::input_password() { write_tag(); return tag.start("input")->itpassword(); } _HTMLTag *_HTMLBuilder::input_radio() { write_tag(); return tag.start("input")->itradio(); } _HTMLTag *_HTMLBuilder::input_range() { write_tag(); return tag.start("input")->itrange(); } _HTMLTag *_HTMLBuilder::input_reset() { write_tag(); return tag.start("input")->itreset(); } _HTMLTag *_HTMLBuilder::input_search() { write_tag(); return tag.start("input")->itsearch(); } _HTMLTag *_HTMLBuilder::input_submit() { write_tag(); return tag.start("input")->itsubmit(); } _HTMLTag *_HTMLBuilder::input_tel() { write_tag(); return tag.start("input")->ittel(); } _HTMLTag *_HTMLBuilder::input_text() { write_tag(); return tag.start("input")->ittext(); } _HTMLTag *_HTMLBuilder::input_time() { write_tag(); return tag.start("input")->ittime(); } _HTMLTag *_HTMLBuilder::input_url() { write_tag(); return tag.start("input")->iturl(); } _HTMLTag *_HTMLBuilder::input_week() { write_tag(); return tag.start("input")->itweek(); } _HTMLBuilder *_HTMLBuilder::label(const String &pfor, const String &plabel, const String &cls, const String &id) { _HTMLTag *t = label(); t->fora(pfor); if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } w(plabel); clabel(); return this; } _HTMLBuilder *_HTMLBuilder::input_button(const String &name, const String &value, const String &cls, const String &id) { _HTMLTag *t = input_button(); t->name(name); if (value != "") { t->value(value); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::input_checkbox(const String &name, const String &value, const bool checked, const String &cls, const String &id) { _HTMLTag *t = input_checkbox(); t->name(name); if (value != "") { t->value(value); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } t->checked(checked); return this; } _HTMLBuilder *_HTMLBuilder::input_color(const String &name, const String &value, const String &cls, const String &id) { _HTMLTag *t = input_color(); t->name(name); if (value != "") { t->value(value); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::input_date(const String &name, const String &value, const String &cls, const String &id, const String &date_min, const String &date_max, const String &date_step) { _HTMLTag *t = input_date(); t->name(name); if (value != "") { t->value(value); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (date_min != "") { t->min(date_min); } if (date_max != "") { t->max(date_max); } if (date_step != "") { t->step(date_step); } return this; } _HTMLBuilder *_HTMLBuilder::input_datetime_local(const String &name, const String &value, const String &cls, const String &id, const String &date_min, const String &date_max, const String &date_step) { _HTMLTag *t = input_datetime_local(); t->name(name); if (value != "") { t->value(value); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (date_min != "") { t->min(date_min); } if (date_max != "") { t->max(date_max); } if (date_step != "") { t->step(date_step); } return this; } _HTMLBuilder *_HTMLBuilder::input_email(const String &name, const String &value, const String &placeholder, const String &cls, const String &id) { _HTMLTag *t = input_email(); t->name(name); if (value != "") { t->value(value); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (placeholder != "") { t->placeholder(placeholder); } return this; } _HTMLBuilder *_HTMLBuilder::input_file(const String &name, const String &accept, const String &cls, const String &id) { _HTMLTag *t = input_file(); t->name(name); if (accept != "") { t->accept(accept); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::input_image(const String &name, const String &src, const String &alt, const String &cls, const String &id, const int width, const int height) { _HTMLTag *t = input_image(); t->name(name); if (src != "") { t->src(src); } if (alt != "") { t->alt(alt); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (width != 0) { t->width(width); } if (height != 0) { t->height(height); } return this; } _HTMLBuilder *_HTMLBuilder::input_month(const String &name, const String &cls, const String &id) { _HTMLTag *t = input_month(); t->name(name); if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::input_number(const String &name, const String &vmin, const String &vmax, const String &cls, const String &id) { _HTMLTag *t = input_number(); t->name(name); if (vmin != "") { t->min(vmin); } if (vmax != "") { t->max(vmax); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::input_password(const String &name, const String &value, const String &placeholder, const String &cls, const String &id, const String &minlength, const String &maxlength, const String &size) { _HTMLTag *t = input_password(); t->name(name); if (value != "") { t->value(value); } if (placeholder != "") { t->placeholder(placeholder); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (minlength != "") { t->minlength(minlength); } if (maxlength != "") { t->maxlength(maxlength); } if (size != "") { t->size(size); } return this; } _HTMLBuilder *_HTMLBuilder::input_radio(const String &name, const String &value, const String &cls, const String &id) { _HTMLTag *t = input_password(); t->name(name); if (value != "") { t->value(value); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::input_range(const String &name, const String &value, const String &vmin, const String &vmax, const String &vstep, const String &cls, const String &id) { _HTMLTag *t = input_range(); t->name(name); if (value != "") { t->value(value); } if (vmin != "") { t->min(vmin); } if (vmax != "") { t->max(vmax); } if (vstep != "") { t->step(vstep); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::input_reset(const String &name, const String &value, const String &cls, const String &id) { _HTMLTag *t = input_reset(); t->name(name); if (value != "") { t->value(value); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::input_search(const String &name, const String &value, const String &placeholder, const String &cls, const String &id, const String &minlength, const String &maxlength, const String &size, const String &pattern) { _HTMLTag *t = input_search(); t->name(name); if (value != "") { t->value(value); } if (placeholder != "") { t->placeholder(placeholder); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (minlength != "") { t->minlength(minlength); } if (maxlength != "") { t->maxlength(maxlength); } if (size != "") { t->size(size); } if (pattern != "") { t->pattern(pattern); } return this; } _HTMLBuilder *_HTMLBuilder::input_submit(const String &value, const String &cls, const String &id) { _HTMLTag *t = input_submit(); t->value(value); if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } return this; } _HTMLBuilder *_HTMLBuilder::input_tel(const String &name, const String &value, const String &placeholder, const String &cls, const String &id, const String &minlength, const String &maxlength, const String &size, const String &pattern) { _HTMLTag *t = input_tel(); t->name(name); if (value != "") { t->value(value); } if (placeholder != "") { t->placeholder(placeholder); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (minlength != "") { t->minlength(minlength); } if (maxlength != "") { t->maxlength(maxlength); } if (size != "") { t->size(size); } if (pattern != "") { t->pattern(pattern); } return this; } _HTMLBuilder *_HTMLBuilder::input_text(const String &name, const String &value, const String &placeholder, const String &cls, const String &id, const String &minlength, const String &maxlength, const String &size) { _HTMLTag *t = input_text(); t->name(name); if (value != "") { t->value(value); } if (placeholder != "") { t->placeholder(placeholder); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (minlength != "") { t->minlength(minlength); } if (maxlength != "") { t->maxlength(maxlength); } if (size != "") { t->size(size); } return this; } _HTMLBuilder *_HTMLBuilder::input_time(const String &name, const String &cls, const String &id, const String &vmin, const String &vmax, const String &vstep) { _HTMLTag *t = input_time(); t->name(name); if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (vmin != "") { t->min(vmin); } if (vmax != "") { t->max(vmax); } if (vstep != "") { t->step(vstep); } return this; } _HTMLBuilder *_HTMLBuilder::input_url(const String &name, const String &value, const String &placeholder, const String &cls, const String &id, const String &minlength, const String &maxlength, const String &size) { _HTMLTag *t = input_url(); t->name(name); if (value != "") { t->value(value); } if (placeholder != "") { t->placeholder(placeholder); } if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (minlength != "") { t->minlength(minlength); } if (maxlength != "") { t->maxlength(maxlength); } if (size != "") { t->size(size); } return this; } _HTMLBuilder *_HTMLBuilder::input_week(const String &name, const String &cls, const String &id, const String &vmin, const String &vmax) { _HTMLTag *t = input_week(); t->name(name); if (cls != "") { t->cls(cls); } if (id != "") { t->id(id); } if (vmin != "") { t->min(vmin); } if (vmax != "") { t->max(vmax); } return this; } _HTMLBuilder *_HTMLBuilder::input_hidden(const String &name, const String &value) { _HTMLTag *t = input_hidden(); t->name(name); if (value != "") { t->value(value); } return this; } _HTMLBuilder *_HTMLBuilder::csrf_token(const String &token) { if (token == "") { // don't waste html characters if it's an empty string anyway return this; } input_hidden("csrf_token", token); return this; } /* _HTMLBuilder *_HTMLBuilder::csrf_token(Request *request) { return csrf_token(request->get_csrf_token()); } */ void _HTMLBuilder::f() { write_tag(); } _HTMLBuilder *_HTMLBuilder::w(const String &val) { write_tag(); result += val; return this; } _HTMLBuilder *_HTMLBuilder::wn(const double val, int p_decimals) { write_tag(); result += String::num(val, p_decimals); return this; } _HTMLBuilder *_HTMLBuilder::wns(const double val) { write_tag(); result += String::num_scientific(val); return this; } _HTMLBuilder *_HTMLBuilder::wr(const double val, const bool p_trailing) { write_tag(); //TODO //result += String::num_real(val, p_trailing); return this; } _HTMLBuilder *_HTMLBuilder::wi(const int64_t val, const int base, const bool capitalize_hex) { write_tag(); result += String::num_int64(val, base, capitalize_hex); return this; } _HTMLBuilder *_HTMLBuilder::wui(const uint64_t val, const int base, const bool capitalize_hex) { write_tag(); result += String::num_uint64(val, base, capitalize_hex); return this; } _HTMLBuilder *_HTMLBuilder::wbn(const bool val) { write_tag(); //TODO //result += String::bool_num(val); return this; } _HTMLBuilder *_HTMLBuilder::wbs(const bool val) { write_tag(); //TODO //result += String::bool_str(val); return this; } // TODO! _HTMLBuilder *_HTMLBuilder::we(const String &val) { //print_error("_HTMLBuilder::write_excaped NYI!"); write_tag(); result += val; return this; } _HTMLBuilder *_HTMLBuilder::write_tag() { if (tag.has_data()) { tag.close(); result += tag.result; tag.reset(); } return this; } _HTMLBuilder::_HTMLBuilder() { tag.owner = this; } _HTMLBuilder::~_HTMLBuilder() { } void _HTMLBuilder::_bind_methods() { ClassDB::bind_method(D_METHOD("a"), &_HTMLBuilder::a); //_HTMLTag *a(); }