include/libtu/map.h

Sat, 05 Apr 2003 22:32:55 +0200

author
tuomov
date
Sat, 05 Apr 2003 22:32:55 +0200
changeset 51
2d95d77aa954
parent 36
63cd573ffbcf
child 53
f8f9366b359c
permissions
-rw-r--r--

trunk: changeset 55
stringintmap_value added

34
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
1 /*
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
2 * libtu/map.h
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
3 *
36
63cd573ffbcf trunk: changeset 39
tuomov
parents: 34
diff changeset
4 * Copyright (c) Tuomo Valkonen 1999-2002.
34
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
5 * See the included file LICENSE for details.
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
6 */
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
7
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
8 #ifndef LIBTU_MAP_H
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
9 #define LIBTU_MAP_H
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
10
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
11 typedef struct _StringIntMap{
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
12 const char *string;
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
13 int value;
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
14 } StringIntMap;
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
15
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
16 #define END_STRINGINTMAP {NULL, 0}
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
17
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
18 /* Return the index of str in map or -1 if not found. */
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
19 extern int stringintmap_ndx(const StringIntMap *map, const char *str);
51
2d95d77aa954 trunk: changeset 55
tuomov
parents: 36
diff changeset
20 extern int stringintmap_value(const StringIntMap *map, const char *str,
2d95d77aa954 trunk: changeset 55
tuomov
parents: 36
diff changeset
21 int dflt);
2d95d77aa954 trunk: changeset 55
tuomov
parents: 36
diff changeset
22
34
828f3afd5c76 trunk: changeset 37
tuomov
parents:
diff changeset
23 #endif /* LIBTU_MAP_H */

mercurial