| 1 | #ifndef NU_UNACCENT_H |
| 2 | #define NU_UNACCENT_H |
| 3 | |
| 4 | #include <libnu/casemap.h> |
| 5 | #include <libnu/strings.h> |
| 6 | |
| 7 | #if defined (__cplusplus) || defined (c_plusplus) |
| 8 | extern "C" { |
| 9 | #endif |
| 10 | |
| 11 | /** |
| 12 | * @example unaccent.c |
| 13 | */ |
| 14 | |
| 15 | #ifdef NU_WITH_UNACCENT |
| 16 | |
| 17 | /** Return unaccented value of codepoint. If codepoint is |
| 18 | * accent (disacritic) itself, returns empty string. |
| 19 | * |
| 20 | * @note This is nunicode extenstion. |
| 21 | * |
| 22 | * @ingroup transformations |
| 23 | * @param codepoint unicode codepoint |
| 24 | * @return unaccented codepoint, 0 if mapping doesn't exist |
| 25 | * and empty string if codepoint is accent |
| 26 | */ |
| 27 | NU_EXPORT |
| 28 | const char* nu_tounaccent(uint32_t codepoint); |
| 29 | |
| 30 | /** Return unaccented value of codepoint. If codepoint is |
| 31 | * accent (disacritic) itself, returns empty string. |
| 32 | * |
| 33 | * @note This is nunicode extenstion. |
| 34 | * |
| 35 | * @ingroup transformations_internal |
| 36 | * @param encoded pointer to encoded string |
| 37 | * @param limit memory limit of encoded string or NU_UNLIMITED |
| 38 | * @param read read (decoding) function |
| 39 | * @param u (optional) codepoint which was (or wasn't) transformed |
| 40 | * @param transform output value of codepoint unaccented or 0 if |
| 41 | * mapping doesn't exist, or empty string if codepoint is accent. |
| 42 | * Can't be NULL, supposed to be decoded with nu_casemap_read |
| 43 | * @param context not used |
| 44 | * @return pointer to the next codepoint in string |
| 45 | */ |
| 46 | NU_EXPORT |
| 47 | const char* _nu_tounaccent(const char *encoded, const char *limit, nu_read_iterator_t read, |
| 48 | uint32_t *u, const char **transform, |
| 49 | void *context); |
| 50 | |
| 51 | #endif /* NU_WITH_UNACCENT */ |
| 52 | |
| 53 | #if defined (__cplusplus) || defined (c_plusplus) |
| 54 | } |
| 55 | #endif |
| 56 | |
| 57 | #endif /* NU_UNACCENT_H */ |
| 58 | |