// HTML_Option.cpp: implementation of the HTML_Option class. // ////////////////////////////////////////////////////////////////////// #include "HTML_all.h" #include "HTML_Option.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// HTML_Option::HTML_Option(char* v, char* str) { setValue(v); setText(str); setSelected(false); } HTML_Option::~HTML_Option() { } HTML_Option* HTML_Option::setValue(char* x) { value = x; return(this); } const char* HTML_Option::getValue() { return(value.c_str()); } string& HTML_Option::printString() { //print opening tag with options and new line buffer = ""); //print text buffer.append(getText()); //print closing tag and new line buffer.append("\n"); return(buffer); } HTML_Element* HTML_Option::printOptions() { if(value.size() != 0) buffer.append(" value=\"" + value + "\""); if(selected) buffer.append(" selected"); return(this); } HTML_Option* HTML_Option::setSelected(bool x) { selected = x; return(this); } bool HTML_Option::getSelected() { return(selected); } HTML_Option* HTML_Option::select() { setSelected(true); return(this); }