diff options
author | Gustavo André dos Santos Lopes <cataphract@php.net> | 2012-06-22 18:19:54 +0200 |
---|---|---|
committer | Gustavo André dos Santos Lopes <cataphract@php.net> | 2012-06-22 18:19:54 +0200 |
commit | 0a7ae87e91368fe17c52767cfb31dabf3a94e38f (patch) | |
tree | 66d32ab8bed0c0e364b4990565f20a1caefced64 /ext/intl/breakiterator/breakiterator_methods.cpp | |
parent | cee31091a960014ce5315008fc64437d04174caf (diff) | |
download | php-git-0a7ae87e91368fe17c52767cfb31dabf3a94e38f.tar.gz |
Added IntlCodePointBreakIterator.
Objects of this class can be instantiated with
IntlBreakIterator::createCodePointInstance()
The method does not take a locale, as it would not make sense in this
context.
This class has one additional method:
long IntlCodePointIterator::getLastCodePoint()
which returns either -1 or the last code point we moved over, if any
(and discounting any movement before the last call to
IntlBreakIterator::first() or IntlBreakIterator::last()).
Diffstat (limited to 'ext/intl/breakiterator/breakiterator_methods.cpp')
-rw-r--r-- | ext/intl/breakiterator/breakiterator_methods.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index 5b8f859d52..e9e6b19ba3 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -19,6 +19,7 @@ #endif #include <unicode/brkiter.h> +#include "codepointiterator_internal.h" #include "breakiterator_iterators.h" @@ -29,6 +30,8 @@ extern "C" { #include <zend_exceptions.h> } +using PHP::CodePointBreakIterator; + U_CFUNC PHP_METHOD(BreakIterator, __construct) { zend_throw_exception( NULL, @@ -107,6 +110,21 @@ U_CFUNC PHP_FUNCTION(breakiter_create_title_instance) INTERNAL_FUNCTION_PARAM_PASSTHRU); } +U_CFUNC PHP_FUNCTION(breakiter_create_code_point_instance) +{ + UErrorCode status = UErrorCode(); + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_create_code_point_instance: bad arguments", 0 TSRMLS_CC); + RETURN_NULL(); + } + + CodePointBreakIterator *cpbi = new CodePointBreakIterator(); + breakiterator_object_create(return_value, cpbi TSRMLS_CC); +} + U_CFUNC PHP_FUNCTION(breakiter_get_text) { BREAKITER_METHOD_INIT_VARS; |