CppCMS
Public Member Functions
cppcms::widgets::base_text Class Reference

This widget is used as base for text input fields. More...

#include <cppcms/form.h>

Inheritance diagram for cppcms::widgets::base_text:
cppcms::widgets::base_widget cppcms::base_form booster::noncopyable cppcms::form_flags cppcms::widgets::text cppcms::widgets::textarea cppcms::widgets::hidden cppcms::widgets::password cppcms::widgets::regex_field cppcms::widgets::email

List of all members.

Public Member Functions

std::string value ()
void value (std::string v)
void non_empty ()
void limits (int min, int max)
std::pair< int, int > limits ()
void validate_charset (bool)
bool validate_charset ()
virtual bool validate ()
virtual void load (http::context &)

Detailed Description

This widget is used as base for text input fields.

This widget is used as the base class for other widgets that are used for text input like: text, textarea, etc.

This widget does much more than reading simple text data from the POST or GET form. It also performs charset validation.


Member Function Documentation

void cppcms::widgets::base_text::limits ( int  min,
int  max 
)

Set the minimum and maximum limits of the text size. Note: max == -1 indicates that there is no maximum limit; min==0 indicates that there is no minimum limit.

Note: these numbers represent the length in Unicode code points (even if the encoding is not Unicode). If the character set validation is disabled, then these numbers represent the number of octets in the string.

std::pair<int,int> cppcms::widgets::base_text::limits ( )

Get the minimum and maximum size limits,

virtual void cppcms::widgets::base_text::load ( http::context ) [virtual]

Load the widget for http::context. It uses the locale given in the context to validate the text.

Implements cppcms::base_form.

Inform the validator that this text widget should contain some text. It is similar to limits(1,-1).

virtual bool cppcms::widgets::base_text::validate ( ) [virtual]

Validate the widget content according to the rules and to the charset encoding.

Notes:

  • The charset validation is very efficient for variable length UTF-8 encoding as well as for most popular fixed length encodings like ISO-8859-*, windows-125* and koi8*. For other encodings, character set conversion is used for the actual validation.
  • Special characters (that are not allowed in HTML) are assumed to be forbidden, even if they are valid code points (like NUL = 0 or DEL=127).

Reimplemented from cppcms::widgets::base_widget.

Reimplemented in cppcms::widgets::regex_field, and cppcms::widgets::password.

Inform the validator whether it should check the validity of the charset. The default is enabled (true).

Generally you should not use this option to disable the charset validation unless you want to load some raw data as form input, or the character set is different from the one defined in the locale.

Return true if the charset validation is enabled.

Get the string that contains the input value of the widget.

void cppcms::widgets::base_text::value ( std::string  v)

Set the widget content to the value v before rendering.


The documentation for this class was generated from the following file: