#include <unicode/utrans.h>
+// #define ICU_CHAIN_SORTKEY
+#undef ICU_CHAIN_SORTKEY
/* declared structs and functions */
};
struct icu_buf_utf16 * icu_buf_utf16_create(size_t capacity);
+
+struct icu_buf_utf16 * icu_buf_utf16_clear(struct icu_buf_utf16 * buf16);
+
struct icu_buf_utf16 * icu_buf_utf16_resize(struct icu_buf_utf16 * buf16,
size_t capacity);
+
struct icu_buf_utf16 * icu_buf_utf16_copy(struct icu_buf_utf16 * dest16,
struct icu_buf_utf16 * src16);
+
void icu_buf_utf16_destroy(struct icu_buf_utf16 * buf16);
};
struct icu_buf_utf8 * icu_buf_utf8_create(size_t capacity);
+
+struct icu_buf_utf8 * icu_buf_utf8_clear(struct icu_buf_utf8 * buf8);
+
struct icu_buf_utf8 * icu_buf_utf8_resize(struct icu_buf_utf8 * buf8,
size_t capacity);
+
void icu_buf_utf8_destroy(struct icu_buf_utf8 * buf8);
enum icu_chain_step_type {
ICU_chain_step_type_none,
ICU_chain_step_type_display, /* convert to utf8 display format */
+#ifdef ICU_CHAIN_SORTKEY
ICU_chain_step_type_index, /* convert to utf8 index format */
ICU_chain_step_type_sortkey, /* convert to utf8 sortkey format */
+#endif
ICU_chain_step_type_casemap, /* apply utf16 charmap */
ICU_chain_step_type_normalize, /* apply utf16 normalization */
ICU_chain_step_type_tokenize /* apply utf16 tokenization */
struct icu_chain
{
- uint8_t identifier[128];
uint8_t locale[16];
+ int sort;
+
+ UCollator * coll;
/* number of tokens returned so far */
int32_t token_count;
struct icu_chain_step * steps;
};
-struct icu_chain * icu_chain_create(const uint8_t * identifier,
- const uint8_t * locale);
+struct icu_chain * icu_chain_create(const uint8_t * locale,
+ int sort,
+ UErrorCode * status);
void icu_chain_destroy(struct icu_chain * chain);
-struct icu_chain * icu_chain_xml_config(xmlNode *xml_node,
+struct icu_chain * icu_chain_xml_config(xmlNode *xml_node,
+ const uint8_t * locale,
+ int sort,
UErrorCode * status);
-
struct icu_chain_step * icu_chain_insert_step(struct icu_chain * chain,
enum icu_chain_step_type type,
const uint8_t * rule,
UErrorCode *status);
-
int icu_chain_step_next_token(struct icu_chain * chain,
struct icu_chain_step * step,
UErrorCode *status);
const char * icu_chain_get_sort(struct icu_chain * chain);
+const UCollator * icu_chain_get_coll(struct icu_chain * chain);
+
#endif /* ICU_I18NL_H */
/*