11 #include <cppcms/defs.h>
12 #include <booster/noncopyable.h>
22 #include <cppcms/http_context.h>
23 #include <cppcms/http_request.h>
24 #include <cppcms/http_response.h>
25 #include <booster/copy_ptr.h>
26 #include <booster/perl_regex.h>
27 #include <booster/shared_ptr.h>
28 #include <cppcms/cppcms_error.h>
29 #include <cppcms/util.h>
30 #include <cppcms/localization.h>
129 void out(std::ostream &out);
149 std::ostream &out()
const;
153 uint32_t html_list_type_;
154 uint32_t widget_part_type_;
155 std::ostream *output_;
189 virtual bool validate() = 0;
194 virtual void clear() = 0;
199 virtual void parent(
base_form *subform) = 0;
238 virtual bool validate();
243 virtual void clear();
249 void add(
form &subform);
256 void attach(
form *subform);
303 virtual form *parent();
320 class CPPCMS_API
iterator :
public std::iterator<std::input_iterator_tag,widgets::base_widget>
377 return !equal(other);
407 bool equal(
iterator const &other)
const;
412 std::stack<unsigned> return_positions_;
432 friend class iterator;
436 typedef std::pair<base_form *,bool> widget_type;
437 std::vector<widget_type> elements_;
514 bool has_error_message();
539 std::string attributes_string();
559 void id(std::string);
566 void name(std::string);
589 void error_message(std::string);
601 void help(std::string);
618 void attributes_string(std::string v);
636 virtual void clear();
641 virtual bool validate();
658 virtual form *parent();
685 uint32_t is_valid_ : 1;
686 uint32_t is_set_ : 1;
687 uint32_t is_disabled_ : 1;
688 uint32_t is_generation_done_ : 1;
689 uint32_t has_message_ : 1;
690 uint32_t has_error_ : 1;
691 uint32_t has_help_ : 1;
692 uint32_t reserverd_ : 25;
721 void value(std::string v);
737 void limits(
int min,
int max);
742 std::pair<int,int> limits();
752 void validate_charset(
bool );
757 bool validate_charset();
770 virtual bool validate();
782 bool validate_charset_;
842 text(std::string
const &type);
1021 context.
out()<<
"value=\""<<value_<<
"\" ";
1029 loaded_string_.clear();
1039 loaded_string_.clear();
1044 http::request::form_type::const_iterator p;
1046 p=request.find(
name());
1047 if(p==request.end()) {
1051 loaded_string_=p->second;
1052 if(loaded_string_.empty())
1055 std::istringstream ss(loaded_string_);
1056 ss.imbue(context.
locale());
1058 if(ss.fail() || !ss.eof())
1079 if(check_low_ && value_ <min_) {
1083 if(check_high_ && value_ > max_) {
1097 std::string loaded_string_;
1115 virtual bool validate();
1148 virtual bool validate();
1196 void value(
bool is_set);
1201 std::string identification();
1207 void identification(std::string
const &);
1215 std::string identification_;
1231 void add(std::string
const &msg,
bool selected=
false);
1237 void add(std::string
const &msg,std::string
const &
id,
bool selected=
false);
1249 void add(
locale::message const &msg,std::string
const &
id,
bool selected=
false);
1254 std::vector<bool> selected_map();
1260 std::set<std::string> selected_ids();
1265 unsigned at_least();
1270 void at_least(
unsigned v);
1280 void at_most(
unsigned v);
1295 void rows(
unsigned n);
1298 virtual bool validate();
1300 virtual void clear();
1309 element(std::string
const &v,std::string
const &msg,
bool sel);
1310 uint32_t selected : 1;
1311 uint32_t need_translation : 1;
1312 uint32_t original_select : 1;
1313 uint32_t reserved : 29;
1315 std::string str_option;
1317 friend std::ostream &
operator<<(std::ostream &out,element
const &el);
1320 std::vector<element> elements_;
1340 void add(std::string
const &
string);
1345 void add(std::string
const &
string,std::string
const &
id);
1367 std::string selected_id();
1372 void selected(
int no);
1377 void selected_id(std::string
id);
1385 virtual bool validate();
1387 virtual void clear();
1394 element(std::string
const &v,std::string
const &msg);
1395 element(element
const &);
1396 element
const &operator=(element
const &);
1399 uint32_t need_translation : 1;
1400 uint32_t reserved : 31;
1402 std::string str_option;
1411 std::vector<element> elements_;
1418 int default_selected_;
1420 uint32_t non_empty_ : 1;
1421 uint32_t reserverd : 32;
1459 void vertical(
bool);
1462 uint32_t vertical_ : 1;
1463 uint32_t reserved_ : 31;
1487 void limits(
int min,
int max);
1492 std::pair<int,int> limits();
1512 void validate_filename_charset(
bool);
1517 bool validate_filename_charset();
1528 void mime(std::string
const &);
1540 void add_valid_magic(std::string
const &);
1544 virtual bool validate();
1554 std::vector<std::string> magics_;
1556 std::string mime_string_;
1560 uint32_t check_charset_ : 1;
1561 uint32_t check_non_empty_ : 1;
1562 uint32_t reserved_ : 30;
1587 void value(std::string val);
1612 #endif // CPPCMS_FORM_H
void out(std::ostream &out)
This is a simple wrapper of PCRE library.
Definition: perl_regex.h:35
This widget is used as base for text input fields.
Definition: form.h:707
This class represents the context required to generate the widgets' HTML.
Definition: form.h:77
std::string CPPCMS_API escape(std::string const &s)
Exception thrown by CppCMS framework.
Definition: cppcms_error.h:22
This class represents an HTML form input element of type text.
Definition: form.h:830
form_type const & post_or_get()
context is a central class that holds all specific connection related information. It encapsulates CGI request and response, cache, session and locale information
Definition: http_context.h:45
http::request & request()
This text widget behaves similarly to the text widget but uses the textarea HTML tag rather than the ...
Definition: form.h:897
basic_message< char > message
Definition: message.h:494
This class represents a message that can be converted to a specific locale message.
Definition: message.h:171
date_time_period_set operator+(date_time_period_set const &a, date_time_period_set const &b)
Definition: date_time.h:446
archive & operator<<(archive &a, Archivable const &object)
Definition: serialization_classes.h:176
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15
std::multimap< std::string, std::string > form_type
Definition: http_request.h:235