1set_input_approver(3)           gstream manual           set_input_approver(3)
2
3
4

NAME

6       set_input_approver
7

SYNOPSIS

9       #include <gstream.h>
10
11
12       void set_input_approver(bool (*input_approver)(int));
13

DESCRIPTION

15       The  function  handed  over  will  be  called  with every new character
16       inputted and determines whether the character will be accepted  by  the
17       inputter. If it returns true, the character is accepted and inserted in
18       the input string, if false, the character is thrown away.
19
20       A short example:
21
22          bool ia_abc_is_what_we_want(int chr)
23          {
24            if (chr == 'a' || chr == 'b' || chr == 'c')
25              return true;
26            else
27              return false;
28          }
29
30          //...
31
32          gs.set_input_approver(ia_abc_is_what_we_want);
33          gs >> my_string; // the user is only able to input a, b or c
34
35       If you want to declare any variables of the type of the  function,  the
36       typedef 'input_approver' in 'gbuf' makes it easy, e.g.
37
38          gbuf::input_approver tmp_ap;
39
40          //...
41
42          tmp_ap = gs1.get_input_approver();
43          gs1.set_input_approver(gs2.get_input_approver());
44          gs2.set_input_approver(tmp_ap);
45
46       Note  that a default input string as entered by set_input_string is not
47       checked by this function. The default approver is
48
49

SEE ALSO

51       gstream-save_input_approver(3),      gstream-restore_input_approver(3),
52       gstream-get_input_approver(3),   gstream-set_input_string(3),  gstream-
53       ia_allow_everything(3)
54
55
56
57gstream                           version 1.6            set_input_approver(3)
Impressum