#include <cgicc/FormEntry.h>
Public Member Functions | |
Overloaded Operators | |
bool | operator== (const FormEntry &entry) const |
Compare two FormEntrys for equality. | |
bool | operator!= (const FormEntry &entry) const |
Compare two FormEntrys for inequality. | |
FormEntry & | operator= (const FormEntry &entry) |
Assign one FormEntry to another. | |
Accessor Methods | |
Information on the form element | |
std::string | getName () const |
Get the name of the form element. | |
std::string | getValue () const |
Get the value of the form element as a string. | |
std::string | operator * () const |
Get the value of the form element as a string. | |
std::string | getValue (std::string::size_type maxChars) const |
Get the value of the form element as a string. | |
std::string | getStrippedValue () const |
Get the value of the form element as a string. | |
std::string | getStrippedValue (std::string::size_type maxChars) const |
Get the value of the form element as a string. | |
long | getIntegerValue (long min=LONG_MIN, long max=LONG_MAX) const |
Get the value of the form element as an integer. | |
long | getIntegerValue (long min, long max, bool &bounded) const |
Get the value of the form element as an integer. | |
double | getDoubleValue (double min=-DBL_MAX, double max=DBL_MAX) const |
Get the value of the form element as a double. | |
double | getDoubleValue (double min, double max, bool &bounded) const |
Get the value of the form element as a double. | |
std::string::size_type | length () const |
Get the number of characters in the value of the form element. | |
bool | isEmpty () const |
Determine if this form element is empty. |
FormEntry is an immutable class representing a single user entry in an HTML form element such as a text field, radio button, or a checkbox. A FormEntry is essentially a name/value pair, where the name is the name of the form element as specified in the HTML form itself, and the value is the user-entered or user-selected value.
If a QUERY_STRING
contained the fragment cgicc=yes
the corresponding FormEntry would have a name of cgicc
and a value of yes
Definition at line 70 of file FormEntry.h.
cgicc::FormEntry::FormEntry | ( | ) | [inline] |
cgicc::FormEntry::FormEntry | ( | const std::string & | name, | |
const std::string & | value | |||
) | [inline] |
Create a new FormEntry.
This is usually not called directly, but by Cgicc.
name | The name of the form element | |
value | The value of the form element |
Definition at line 96 of file FormEntry.h.
cgicc::FormEntry::FormEntry | ( | const FormEntry & | entry | ) | [inline] |
Copy constructor.
Sets the name and value of this FormEntry to those of entry
.
entry | The FormEntry to copy. |
Definition at line 108 of file FormEntry.h.
cgicc::FormEntry::~FormEntry | ( | ) | [inline] |
cgicc::FormEntry::FormEntry | ( | ) | [inline] |
cgicc::FormEntry::FormEntry | ( | const std::string & | name, | |
const std::string & | value | |||
) | [inline] |
Create a new FormEntry.
This is usually not called directly, but by Cgicc.
name | The name of the form element | |
value | The value of the form element |
Definition at line 96 of file FormEntry.h.
cgicc::FormEntry::FormEntry | ( | const FormEntry & | entry | ) | [inline] |
Copy constructor.
Sets the name and value of this FormEntry to those of entry
.
entry | The FormEntry to copy. |
Definition at line 108 of file FormEntry.h.
cgicc::FormEntry::~FormEntry | ( | ) | [inline] |
bool cgicc::FormEntry::operator== | ( | const FormEntry & | entry | ) | const [inline] |
Compare two FormEntrys for equality.
FormEntrys are equal if they have the same name and value.
entry | The FormEntry to compare to this one. |
true
if the two FormEntrys are equal, false
otherwise. Definition at line 134 of file FormEntry.h.
References fName, and cgicc::stringsAreEqual().
bool cgicc::FormEntry::operator!= | ( | const FormEntry & | entry | ) | const [inline] |
Compare two FormEntrys for inequality.
FormEntrys are equal if they have the same name and value.
entry | The FormEntry to compare to this one. |
false
if the two FormEntrys are equal, true
otherwise. Definition at line 145 of file FormEntry.h.
std::string cgicc::FormEntry::getName | ( | ) | const [inline] |
Get the name of the form element.
The name of the form element is specified in the HTML form that called the CGI application.
Definition at line 181 of file FormEntry.h.
std::string cgicc::FormEntry::getValue | ( | ) | const [inline] |
Get the value of the form element as a string.
The value returned may contain line breaks.
Definition at line 191 of file FormEntry.h.
std::string cgicc::FormEntry::operator * | ( | ) | const [inline] |
Get the value of the form element as a string.
The value returned may contain line breaks.
Definition at line 201 of file FormEntry.h.
References CardGameTools::getValue().
std::string cgicc::FormEntry::getValue | ( | std::string::size_type | maxChars | ) | const [inline] |
Get the value of the form element as a string.
The value returned will be truncated to a specific length. The value may contain line breaks.
maxChars | The maximum number of characters to return. |
Definition at line 213 of file FormEntry.h.
std::string cgicc::FormEntry::getStrippedValue | ( | ) | const [inline] |
Get the value of the form element as a string.
The value returned will be stripped of all line breaks.
Definition at line 223 of file FormEntry.h.
std::string cgicc::FormEntry::getStrippedValue | ( | std::string::size_type | maxChars | ) | const [inline] |
Get the value of the form element as a string.
The value returned will be stripped of all line breaks and truncated to a specific length.
maxChars | The maximum number of characters to return. |
Definition at line 236 of file FormEntry.h.
long cgicc::FormEntry::getIntegerValue | ( | long | min = LONG_MIN , |
|
long | max = LONG_MAX | |||
) | const |
Get the value of the form element as an integer.
No syntax checking is performed on the string value.
min | The minimum value to return (optional). | |
max | The maximum value to return (optional). |
long cgicc::FormEntry::getIntegerValue | ( | long | min, | |
long | max, | |||
bool & | bounded | |||
) | const |
Get the value of the form element as an integer.
No syntax checking is performed on the string value.
min | The minimum value to return. | |
max | The maximum value to return. | |
bounded | Set to true if the value was originally outside the limits, false otherwise |
double cgicc::FormEntry::getDoubleValue | ( | double | min = -DBL_MAX , |
|
double | max = DBL_MAX | |||
) | const |
Get the value of the form element as a double.
No syntax checking is performed on the string value.
min | The minimum value to return (optional). | |
max | The maximum value to return (optional). |
double cgicc::FormEntry::getDoubleValue | ( | double | min, | |
double | max, | |||
bool & | bounded | |||
) | const |
Get the value of the form element as a double.
No syntax checking is performed on the string value.
min | The minimum value to return. | |
max | The maximum value to return. | |
bounded | Set to true if the value was originally outside the limits, false otherwise |
std::string::size_type cgicc::FormEntry::length | ( | ) | const [inline] |
Get the number of characters in the value of the form element.
Note that a character may or may not equal one byte.
Definition at line 301 of file FormEntry.h.
bool cgicc::FormEntry::isEmpty | ( | ) | const [inline] |
Determine if this form element is empty.
In an empty form element, length() == 0.
true
if this form element is empty, false
otherwise. Definition at line 311 of file FormEntry.h.