/usr/include/Wt/WTimeValidator is in libwt-dev 3.3.6+dfsg-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | #ifndef WTIME_VALIDATOR_H_
#define WTIME_VALIDATOR_H_
#include "Wt/WRegExpValidator"
namespace Wt {
/*! \class WTimeValidator Wt/WTimeValidator Wt/WTimeValidator
* \brief A time validator
*
* \sa WTimeEdit
* \sa WTime
* \sa WTimePicker
*
*/
class WT_API WTimeValidator : public WRegExpValidator
{
public:
/*! \brief Creates a new WTimeValidator
*/
WTimeValidator(WObject *parent = 0);
/*! \brief Creates a new WTimeValidator
*/
WTimeValidator(const WT_USTRING &format, WObject *parent = 0);
/*! \brief Creates a new WTimeValidator
*
* The validator will accept only times within the indicated range
* <i>bottom</i> to <i>top</i>, in the time formate \p format
*/
WTimeValidator(const WT_USTRING &format, const WTime &bottom,
const WTime &top, WObject *parent = 0);
/*! \brief Sets the validator format
* \sa WTime::toString()
*/
void setFormat(const WT_USTRING &format);
/*! \brief Returns the validator current format
*/
virtual WT_USTRING format() const { return formats_[0]; }
/*! \brief Sets the time formats used to parse time strings
*/
void setFormats(const std::vector<WT_USTRING> &formats);
/*! \brief Returns the time formats used to parse time strings
*/
const std::vector<WT_USTRING>& formats() const { return formats_;}
/*! \brief Sets the lower limit of the valid time range
*
* The default is a null time constructed using WTime()
*/
void setBottom(const WTime &bottom);
/*! \brief Returns the lower limit of the valid time range
*/
const WTime& bottom() const { return bottom_;}
/*! \brief Sets the upper limit of the valid time range
*
* The default is a null time constructed using WTime()
*/
void setTop(const WTime &top);
/*! \brief Returns the upper limit of the valid time range
*/
const WTime& top() const { return top_;}
/*! \brief Sets the message to display when the input is not a time
*/
void setInvalidNotATimeText(const WString &text);
/*! \brief Returns the message displayed when the input is not a time
*/
WString invalidNotATimeText() const;
/*! \brief Sets the message to display when the time is earlier than bottom
*/
void setInvalidTooEarlyText(const WString &text);
/*! \brief Returns the message displayed when time is too early
*/
WString invalidTooEarlyText() const;
/*! \brief Sets the message to display when the time is later than top
*/
void setInvalidTooLateText(const WString &text);
/*! \brief Returns the message displayed when time is too late
*/
WString invalidTooLateText() const;
/*! \brief Validates the given input
*
* The input is considered valid only when it is blank for a
* non-mandatory field, or represents a time in the given format,
* and within the valid range.
*/
virtual Result validate(const WT_USTRING &input) const;
virtual std::string javaScriptValidate() const;
private:
std::vector<WT_USTRING> formats_;
WTime bottom_, top_;
WString tooEarlyText_;
WString tooLateText_;
WString notATimeText_;
static void loadJavaScript(WApplication *app);
};
}
#endif // WTIME_VALIDATOR_H_
|