Back to index

php5  5.3.10
grapheme_util.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | This source file is subject to version 3.01 of the PHP license,      |
00006    | that is bundled with this package in the file LICENSE, and is        |
00007    | available through the world-wide-web at the following url:           |
00008    | http://www.php.net/license/3_01.txt                                  |
00009    | If you did not receive a copy of the PHP license and are unable to   |
00010    | obtain it through the world-wide-web, please send a note to          |
00011    | license@php.net so we can mail you a copy immediately.               |
00012    +----------------------------------------------------------------------+
00013    | Authors: Ed Batutis <ed@batutis.com>                                 |
00014    +----------------------------------------------------------------------+
00015  */
00016 
00017 #ifndef GRAPHEME_GRAPHEME_UTIL_H
00018 #define GRAPHEME_GRAPHEME_UTIL_H
00019 
00020 #include "php_intl.h"
00021 #include "intl_convert.h"
00022 
00023 /* get_break_interator: get a break iterator from the global structure */
00024 UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC );
00025 
00026 void
00027 grapheme_substr_ascii(char *str, int32_t str_len, int32_t f, int32_t l, int argc, char **sub_str, int *sub_str_len);
00028 
00029 int
00030 grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int f_ignore_case TSRMLS_DC);
00031 
00032 int
00033 grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int *puchar_pos, int f_ignore_case TSRMLS_DC);
00034 
00035 int grapheme_ascii_check(const unsigned char *day, int32_t len);
00036 
00037 int grapheme_split_string(const UChar *text, int32_t text_length, int boundary_array[], int boundary_array_len TSRMLS_DC );
00038 
00039 int32_t
00040 grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len);
00041 
00042 int32_t
00043 grapheme_memnstr_grapheme(UBreakIterator *bi, UChar *haystack, UChar *needle, int32_t needle_len, UChar *end);
00044 
00045 inline void *grapheme_memrchr_grapheme(const void *s, int c, int32_t n);
00046 
00047 UChar *
00048 grapheme_get_haystack_offset(UBreakIterator* bi, UChar *uhaystack, int32_t uhaystack_len, int32_t offset);
00049 
00050 int32_t
00051 grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, unsigned char *needle, int32_t needle_len, int32_t offset);
00052 
00053 UBreakIterator* 
00054 grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC );
00055 
00056 /* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */
00057 #define OUTSIDE_STRING(offset, max_len) ( offset < INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) )
00058 
00059 #endif // GRAPHEME_GRAPHEME_UTIL_H