summaryrefslogtreecommitdiff
path: root/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace zend_bool uses with boolNikita Popov2021-01-151-1/+1
| | | | | | | We're starting to see a mix between uses of zend_bool and bool. Replace all usages with the standard bool type everywhere. Of course, zend_bool is retained as an alias.
* Prevent double-construction of IntlRuleBasedBreakIteratorNikita Popov2020-08-261-1/+8
|
* Ensure RuleBasedBreakIterator constructor throws on failureNikita Popov2020-08-251-13/+13
| | | | | Constructors must throw on failure indepdendent of the configured intl error mode.
* Convert code path which should never happen to assertionGeorge Peter Banyard2020-06-051-7/+4
|
* Get rid of method mapping of BreakIterator classesMáté Kocsis2020-02-251-4/+4
|
* Use RETURN_THROWS() during ZPP in most of the extensionsMáté Kocsis2019-12-311-5/+5
| | | | Except for some bigger ones: reflection, sodium, spl
* zend_parse_parameters_throw() is obsoleteChristoph M. Becker2019-11-011-1/+1
| | | | | | Since `zend_parse_parameters()` throws now, there is no reason to explicitly call `zend_parse_parameters_throw()` anymore, and since both have actually the same implementation, we redefine the latter as macro.
* Cleanup return values for Intl when parameter parsing is unsuccessfulMáté Kocsis2019-10-301-4/+4
| | | | Closes GH-4871.
* Remove mention of PHP major version in Copyright headersGabriel Caruso2019-09-251-2/+0
| | | | Closes GH-4732.
* Intl: Don't separately report "bad arguments" errorsNikita Popov2019-03-111-10/+0
| | | | | zpp will be throwing for these now, don't report them in addition to that.
* Use ZEND_THIS macro to hide implementation details in extensions code.Dmitry Stogov2018-11-151-5/+5
|
* Eliminate useless $this related checkDmitry Stogov2018-11-141-4/+4
|
* Replace getThis() by EX(This), when additional check is not necessary.Dmitry Stogov2018-11-141-1/+1
|
* Require ICU ≥ 50.1Christoph M. Becker2018-09-151-8/+0
| | | | | | | | | | | | | | | | | Given that ICU is a set of lively developed libraries, that ICU 50.1 has been released on 2012-11-05, and PHP 7.4 is scheduled to be released seven years after it, we consider it appropriate to ditch these legacy versions. Particularly, that would be a reasonable groundwork to implement part two of the “Deprecate and remove INTL_IDNA_VARIANT_2003” RFC[1], namely to default idn_to_ascii()'s and idn_to_utf8()'s $variant parameter to INTL_IDNA_VARIANT_UTS46, which is not defined in ICU < 4.6. See also the related discussion on internals@[2]. [1] <https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003> [2] <http://news.php.net/php.internals/101626>ff
* Merge branch 'PHP-7.2'Anatol Belski2018-04-121-0/+1
|\ | | | | | | | | * PHP-7.2: Fix memory leak
| * Fix memory leakAnatol Belski2018-04-121-0/+1
| |
* | Simplify namespace accessAnatol Belski2018-04-011-2/+2
| | | | | | | | The icu namespace is an alias which resolves to the real namespace.
* | Utilize the recommended way to handle the icu namespaceAnatol Belski2018-03-311-0/+3
|/
* Cleanup (avoid string reallocations)Dmitry Stogov2015-07-011-6/+4
|
* Use ZSTR_ API to access zend_string elements (this is just renaming without ↵Dmitry Stogov2015-06-301-3/+3
| | | | semantick changes).
* Fixed redundand internal constructor behavior (they shouldn't return NULL ↵Dmitry Stogov2015-05-071-9/+0
| | | | anymore)
* Always throw TypeException on throwing zpp failuresNikita Popov2015-04-061-2/+1
| | | | | | | | | | | | | | Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to report FAILURE errors using a TypeException instead of a Warning, like it would happen in strict mode. Adds a zend_parse_parameters_throw() convenience function, which invokes zpp with this flag. Converts all cases I could identify, where we currently have throwing zpp usage in constructors and replaces them with this API. Error handling is still replaced to EH_THROW in some cases to handle other, domain-specific errors in constructors.
* Patch improvement:Dmitry Stogov2015-03-301-4/+7
| | | | | | | | Removed the corresponding core code. Fixed ext/com_dotnet and ext/date. Refactored ext/intl changes. Improved ext/fileinfo and ext/pdo changes. Fixed tests.
* Fixed use after freeDmitry Stogov2015-01-261-1/+0
|
* cleanup intl typesStanislav Malyshev2014-12-291-2/+2
|
* first shot remove TSRMLS_* thingsAnatol Belski2014-12-131-17/+17
|
* s/PHP 5/PHP 7/Johannes Schlüter2014-09-191-1/+1
|
* first show to make 's' work with size_tAnatol Belski2014-08-271-1/+1
|
* master renames phase 1Anatol Belski2014-08-251-3/+3
|
* basic macro replacements, all at onceAnatol Belski2014-08-191-2/+2
|
* Partial fix that allows internal constructors to set $this to null.Dmitry Stogov2014-07-091-0/+1
| | | | | | | The address of $this passed to drectly called internal constructor in execute_data->return_value. Internal constructors should use ZEND_CTOR_MAKE_NULL() macro (insted of previous ZEND_NULL(EG(This))) to do the work. This patch doesn't fix the problem for indirectly called constructors. e.g. parant::__construct().
* TypoDmitry Stogov2014-07-091-4/+4
|
* Fixed compilation problemsDmitry Stogov2014-06-301-4/+4
|
* Fixed temporarily un-expected object re-initXinchen Hui2014-06-291-8/+10
|
* Refactoring ext/intl (only compilerable now, far to finish :<)Xinchen Hui2014-06-281-5/+8
|
* Fixed leak in RuleBasedBreakIterator constructorGustavo Lopes2012-07-231-0/+2
| | | | The leak occurred in case of error.
* Fixed function nameGustavo Lopes2012-07-231-2/+2
|
* Fix typo in error messageGustavo André dos Santos Lopes2012-06-251-1/+1
|
* BreakIterator: fix compat with old ICU versionsGustavo André dos Santos Lopes2012-06-251-0/+8
|
* Add Intl prefix to BreakIterator/RuleBasedBIGustavo André dos Santos Lopes2012-06-101-1/+1
|
* Remove trailing spaceGustavo André dos Santos Lopes2012-06-101-14/+14
|
* Replaced zend_parse_method_params with plain zppGustavo André dos Santos Lopes2012-06-101-9/+9
|
* BreakIter: Removed getAvailableLocales/getHashCodeGustavo André dos Santos Lopes2012-06-101-16/+0
|
* BreakIterator and RuleBasedBreakiterator addedGustavo André dos Santos Lopes2012-06-041-0/+227
This commit adds wrappers for the classes BreakIterator and RuleBasedbreakIterator. The C++ ICU classes are described here: <http://icu-project.org/apiref/icu4c/classBreakIterator.html> <http://icu-project.org/apiref/icu4c/classRuleBasedBreakIterator.html> Additionally, a tutorial is available at: <http://userguide.icu-project.org/boundaryanalysis> This implementation wraps UTF-8 text in a UText. The text is iterated without any copying or conversion to UTF-16. There is also no validation that the input is actually UTF-8; where there are malformed sequences, the UText will simply U+FFFD. The class BreakIterator cannot be instantiated directly (has a private constructor). It provides the interface exposed by the ICU abstract class with the same name. The PHP class is not abstract because we may use it to wrap native subclasses of BreakIterator that we don't know how to wrap. This class includes methods to move the iterator position to the beginning (first()), to the end (last()), forward (next()), backwards (previous()), to the boundary preceding a certain position (preceding()) and following a certain position (following()) and to obtain the current position (current()). next() can also be used to advance or recede an arbitrary number of positions. BreakIterator also exposes other native methods: getAvailableLocales(), getLocale() and factory methods to build several predefined types of BreakIterators: createWordInstance() for word boundaries, createCharacterInstance() for locale dependent notions of "characters", createSentenceInstance() for sentences, createLineInstance() and createTitleInstance() -- for title casing breaks. These factories currently return RuleBasedbreakIterators where the names of the rule sets are found in the ICU data, observing the passed locale (although the locale is taken into considering there are very few exceptions to the root rules). The clone and compare_object PHP object handlers are also implemented, though the comparison does not yield meaningful results when used with >, <, >= and <=. Note that BreakIterator is an iterator only in the sense of the first 'Iterator' in 'IteratorIterator', i.e., it does not implement the Iterator interface. The reason is that there is no sensible implementation for Iterator::key(). Using it for an ordinal of the current boundary is not feasible because we are allowed to move to any boundary at any time. It we were to determine the current ordinal when last() is called we'd have to traverse the whole input text to find out how many breaks there were before. Therefore, BreakIterator implements only Traversable. It can be wrapped in an IteratorIterator, but the usual warnings apply. Finally, I added a convenience method to BreakIterator: getPartsIterator(). This provides an IntlIterator, backed by the BreakIterator PHP object (i.e. moving the pointer or changing the text in BreakIterator affects the iterator and also moving the iterator affects the backing BreakIterator), which allows traversing the text between each boundary. This iterator uses the original text to retrieve the text between two positions, not the code points returned by the wrapping UText. Therefore, if the text includes invalid code unit sequences, these invalid sequences will be in the output of this iterator, not U+FFFD code points. The class RuleBasedIterator exposes a constructor that allows building an iterator from arbitrary compiled or non-compiled rules. The form of these rules in described in the tutorial linked above. The rest of the methods allow retrieving the rules -- getRules() and getCompiledRules() --, a hash code of the rule set (hashCode()) and the rules statuses (getRuleStatus() and getRuleStatusVec()). Because the RuleBasedBreakIterator constructor may return parse errors, I reuse the UParseError to text function that was in the transliterator files. Therefore, I move that function to intl_error.c. common_enum.cpp was also changed, mainly to expose previously static functions. This avoided code duplication when implementing the BreakIterator iterator and the IntlIterator returned by BreakIterator::getPartsIterator().