summaryrefslogtreecommitdiff
path: root/iup/src/iup_mask.h
blob: 5e87f2448c465bf2c8ec4f39e8c90e1809e66a3c (plain)
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
/** \file
 * \brief Mask functions
 *
 * See Copyright Notice in "iup.h"
 */
 
#ifndef __IUP_MASK_H 
#define __IUP_MASK_H

#ifdef __cplusplus
extern "C" {
#endif


/** \defgroup mask Text Mask
 * \par
 * Used to filter text input in IupText.
 * \par
 * See \ref iup_mask.h
 * \ingroup util */

typedef struct _Imask Imask;

/** Creates a mask given a string.  \n
 * If casei is true, will turn the mask case insensitive.
 * \ingroup mask */
Imask* iupMaskCreate(const char* mask_str, int casei);

/** Creates an integer mask with limits.
 * \ingroup mask */
Imask* iupMaskCreateInt(int min, int max);

/** Creates a float mask with limits.
 * \ingroup mask */
Imask* iupMaskCreateFloat(float min, float max);

/** Destroys the mask.
 * \ingroup mask */
void iupMaskDestroy(Imask* mask);

/** Check if the value is valid using the mask to filter it.
 * Returns 1 if full match, -1 if partial match, and 0 otherwise.
 * \ingroup mask */
int iupMaskCheck(Imask* mask, const char *value);

/** Returns the mask string.
 * \ingroup mask */
char* iupMaskGetStr(Imask* mask);


#ifdef __cplusplus
}
#endif

#endif