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