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_;
156 CPPCMS_UNUSED_MEMBER uint32_t reserved_1;
157 CPPCMS_UNUSED_MEMBER uint32_t reserved_2;
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_;
436 typedef std::pair<base_form *,bool> widget_type;
437 std::vector<widget_type> elements_;
514 bool has_error_message();
552 std::string attributes_string();
572 void id(std::string);
579 void name(std::string);
602 void error_message(std::string);
614 void help(std::string);
631 void attributes_string(std::string v);
649 virtual void clear();
654 virtual bool validate();
671 virtual form *parent();
698 uint32_t is_valid_ : 1;
699 uint32_t is_set_ : 1;
700 uint32_t is_disabled_ : 1;
701 uint32_t is_readonly_ : 1;
702 uint32_t is_generation_done_ : 1;
703 uint32_t has_message_ : 1;
704 uint32_t has_error_ : 1;
705 uint32_t has_help_ : 1;
706 CPPCMS_UNUSED_MEMBER uint32_t reserverd_ : 24;
735 void value(std::string v);
751 void limits(
int min,
int max);
756 std::pair<int,int> limits();
766 void validate_charset(
bool );
771 bool validate_charset();
784 virtual bool validate();
796 bool validate_charset_;
856 text(std::string
const &type);
1035 context.
out()<<
"value=\""<<value_<<
"\" ";
1042 base_html_input::clear();
1043 loaded_string_.clear();
1053 loaded_string_.clear();
1058 http::request::form_type::const_iterator p;
1060 p=request.find(name());
1061 if(p==request.end()) {
1065 loaded_string_=p->second;
1066 if(loaded_string_.empty())
1069 std::istringstream ss(loaded_string_);
1070 ss.imbue(context.
locale());
1072 if(ss.fail() || !ss.eof())
1093 if(check_low_ && value_ <min_) {
1097 if(check_high_ && value_ > max_) {
1111 std::string loaded_string_;
1129 virtual bool validate();
1162 virtual bool validate();
1210 void value(
bool is_set);
1215 std::string identification();
1221 void identification(std::string
const &);
1229 std::string identification_;
1245 void add(std::string
const &msg,
bool selected=
false);
1251 void add(std::string
const &msg,std::string
const &
id,
bool selected=
false);
1263 void add(
locale::message const &msg,std::string
const &
id,
bool selected=
false);
1268 std::vector<bool> selected_map();
1274 std::set<std::string> selected_ids();
1279 unsigned at_least();
1284 void at_least(
unsigned v);
1294 void at_most(
unsigned v);
1309 void rows(
unsigned n);
1312 virtual bool validate();
1314 virtual void clear();
1323 element(std::string
const &v,std::string
const &msg,
bool sel);
1324 uint32_t selected : 1;
1325 uint32_t need_translation : 1;
1326 uint32_t original_select : 1;
1327 CPPCMS_UNUSED_MEMBER uint32_t reserved : 29;
1329 std::string str_option;
1331 friend std::ostream &operator<<(std::ostream &out,element
const &el);
1334 std::vector<element> elements_;
1354 void add(std::string
const &
string);
1359 void add(std::string
const &
string,std::string
const &
id);
1381 std::string selected_id();
1386 void selected(
int no);
1391 void selected_id(std::string
id);
1399 virtual bool validate();
1401 virtual void clear();
1408 element(std::string
const &v,std::string
const &msg);
1409 element(element
const &);
1410 element
const &operator=(element
const &);
1413 uint32_t need_translation : 1;
1414 CPPCMS_UNUSED_MEMBER uint32_t reserved : 31;
1416 std::string str_option;
1425 std::vector<element> elements_;
1432 int default_selected_;
1434 uint32_t non_empty_ : 1;
1435 CPPCMS_UNUSED_MEMBER uint32_t reserverd : 32;
1473 void vertical(
bool);
1476 uint32_t vertical_ : 1;
1477 CPPCMS_UNUSED_MEMBER uint32_t reserved_ : 31;
1501 void limits(
int min,
int max);
1506 std::pair<int,int> limits();
1526 void validate_filename_charset(
bool);
1531 bool validate_filename_charset();
1542 void mime(std::string
const &);
1554 void add_valid_magic(std::string
const &);
1558 virtual bool validate();
1568 std::vector<std::string> magics_;
1570 std::string mime_string_;
1574 uint32_t check_charset_ : 1;
1575 uint32_t check_non_empty_ : 1;
1576 CPPCMS_UNUSED_MEMBER uint32_t reserved_ : 30;
1601 void value(std::string val);
1626 #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:721
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:844
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
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:47
http::request & request()
This text widget behaves similarly to the text widget but uses the textarea HTML tag rather than the ...
Definition: form.h:911
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
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:238