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;
20 using support::contains;
21 using support::isStrInt;
22 using support::isStrDbl;
24 #if defined(__cplusplus)
29 int fl_int_filter(FL_OBJECT * ob,
30 char const *, char const *, int c)
32 if (c == 0 /* final test before handing contents to app */
33 || contains("0123456789+-", c)) {
34 if (isStrInt(fl_get_input(ob)))
37 return FL_INVALID|FL_RINGBELL;
41 int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
42 char const *, char const *, int c)
44 if (c == 0 /* final test before handing contents to app */
45 || contains("0123456789", c)) {
46 /* since we only accept numerals then it must be valid */
49 return FL_INVALID|FL_RINGBELL;
53 int fl_float_filter(FL_OBJECT * ob,
54 char const *, char const *, int c)
56 if (c == 0 /* final test before handing contents to app */
57 || contains("0123456789.+-", c)) {
58 if (isStrDbl(fl_get_input(ob)))
61 return FL_INVALID|FL_RINGBELL;
65 int fl_unsigned_float_filter(FL_OBJECT * ob,
66 char const * /*not_used*/,
67 char const * /*unused*/,
70 if (c == 0 /* final test before handing contents to app */
71 || contains("0123456789.", c)) {
72 if (isStrDbl(fl_get_input(ob)))
75 return FL_INVALID|FL_RINGBELL;
79 int fl_lowercase_filter(FL_OBJECT * /*ob*/,
80 char const * /*not_used*/,
81 char const * /*unused*/,
84 if (c == 0 /* final test before handing contents to app */
85 || contains("abcdefghijklmnopqrstuvwxyz0123456789", c)) {
86 /* since we only accept numerals then it must be valid */
89 return FL_INVALID|FL_RINGBELL;
93 #if defined(__cplusplus)