CppCMS
Public Member Functions
cppcms::widgets::numeric< T > Class Template Reference

Widget for number input. It is a template class that assumes that T is a number. More...

#include <cppcms/form.h>

Inheritance diagram for cppcms::widgets::numeric< T >:
cppcms::widgets::base_html_input cppcms::widgets::base_widget cppcms::base_form booster::noncopyable cppcms::form_flags

List of all members.

Public Member Functions

void non_empty ()
value ()
void value (T v)
void low (T a)
void high (T b)
void range (T a, T b)
virtual void render_value (form_context &context)
virtual void clear ()
virtual void load (http::context &context)
virtual bool validate ()

Detailed Description

template<typename T>
class cppcms::widgets::numeric< T >

Widget for number input. It is a template class that assumes that T is a number.

This class parses the input and checks if it is input text is a valid numeric value. If it is valid, the set() would return true be true.

If the value was not defined, access to value() will throw an exception.


Member Function Documentation

template<typename T >
virtual void cppcms::widgets::numeric< T >::clear ( ) [inline, virtual]

Clear the form. It also calls set(false).

Reimplemented from cppcms::widgets::base_widget.

template<typename T >
void cppcms::widgets::numeric< T >::high ( b) [inline]

Set the maximum valid value.

References cppcms::widgets::numeric< T >::non_empty().

Referenced by cppcms::widgets::numeric< T >::range().

template<typename T >
virtual void cppcms::widgets::numeric< T >::load ( http::context context) [inline, virtual]
template<typename T >
void cppcms::widgets::numeric< T >::low ( a) [inline]

Set the minimum valid value.

References cppcms::widgets::numeric< T >::non_empty().

Referenced by cppcms::widgets::numeric< T >::range().

template<typename T >
void cppcms::widgets::numeric< T >::non_empty ( ) [inline]

Inform the validator that this widget should contain some value.

Referenced by cppcms::widgets::numeric< T >::high(), and cppcms::widgets::numeric< T >::low().

template<typename T >
void cppcms::widgets::numeric< T >::range ( a,
b 
) [inline]
template<typename T >
virtual void cppcms::widgets::numeric< T >::render_value ( form_context context) [inline, virtual]

Render the first part of the widget.

Implements cppcms::widgets::base_html_input.

References cppcms::util::escape(), and cppcms::form_context::out().

template<typename T >
virtual bool cppcms::widgets::numeric< T >::validate ( ) [inline, virtual]

Validate the widget.

Reimplemented from cppcms::widgets::base_widget.

References cppcms::widgets::base_widget::valid().

template<typename T >
T cppcms::widgets::numeric< T >::value ( ) [inline]

Get numeric value that was loaded from the POST or GET data.

Note:
if the value was not set (empty field for example) then this function will throw. So it is good idea to check if set() returns true before using this function.
template<typename T >
void cppcms::widgets::numeric< T >::value ( v) [inline]

Set the value of the widget.


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