2 * \file input_validators.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "input_validators.h"
15 #include "support/lstrings.h"
17 #include "lyx_forms.h"
19 namespace support = lyx::support;
22 #if defined(__cplusplus)
27 int fl_int_filter(FL_OBJECT * ob,
28 char const *, char const *, int c)
30 if (c == 0 /* final test before handing contents to app */
31 || strchr("0123456789+-", c)) {
32 if (support::isStrInt(fl_get_input(ob)))
35 return FL_INVALID|FL_RINGBELL;
39 int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
40 char const *, char const *, int c)
42 if (c == 0 /* final test before handing contents to app */
43 || strchr("0123456789", c)) {
44 /* since we only accept numerals then it must be valid */
47 return FL_INVALID|FL_RINGBELL;
51 int fl_float_filter(FL_OBJECT * ob,
52 char const *, char const *, int c)
54 if (c == 0 /* final test before handing contents to app */
55 || strchr("0123456789.+-", c)) {
56 if (support::isStrDbl(fl_get_input(ob)))
59 return FL_INVALID|FL_RINGBELL;
63 int fl_unsigned_float_filter(FL_OBJECT * ob,
64 char const * /*not_used*/,
65 char const * /*unused*/,
68 if (c == 0 /* final test before handing contents to app */
69 || strchr("0123456789.", c)) {
70 if (support::isStrDbl(fl_get_input(ob)))
73 return FL_INVALID|FL_RINGBELL;
77 int fl_lowercase_filter(FL_OBJECT * /*ob*/,
78 char const * /*not_used*/,
79 char const * /*unused*/,
82 if (c == 0 /* final test before handing contents to app */
83 || strchr("abcdefghijklmnopqrstuvwxyz0123456789", c)) {
84 /* since we only accept numerals then it must be valid */
87 return FL_INVALID|FL_RINGBELL;
91 #if defined(__cplusplus)