breakiterator_class.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | http://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Authors: Gustavo Lopes <cataphract@php.net> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef BREAKITERATOR_CLASS_H
  17. #define BREAKITERATOR_CLASS_H
  18. //redefinition of inline in PHP headers causes problems, so include this before
  19. #include <math.h>
  20. #include <php.h>
  21. #include "../intl_error.h"
  22. #include "../intl_data.h"
  23. #ifndef USE_BREAKITERATOR_POINTER
  24. typedef void BreakIterator;
  25. #endif
  26. typedef struct {
  27. zend_object zo;
  28. // error handling
  29. intl_error err;
  30. // ICU break iterator
  31. BreakIterator* biter;
  32. // current text
  33. zval *text;
  34. } BreakIterator_object;
  35. #define BREAKITER_ERROR(bio) (bio)->err
  36. #define BREAKITER_ERROR_P(bio) &(BREAKITER_ERROR(bio))
  37. #define BREAKITER_ERROR_CODE(bio) INTL_ERROR_CODE(BREAKITER_ERROR(bio))
  38. #define BREAKITER_ERROR_CODE_P(bio) &(INTL_ERROR_CODE(BREAKITER_ERROR(bio)))
  39. #define BREAKITER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(BreakIterator, bio)
  40. #define BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(BreakIterator, bio)
  41. #define BREAKITER_METHOD_FETCH_OBJECT \
  42. BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK; \
  43. if (bio->biter == NULL) \
  44. { \
  45. intl_errors_set(&bio->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed BreakIterator", 0 TSRMLS_CC); \
  46. RETURN_FALSE; \
  47. }
  48. void breakiterator_object_create(zval *object, BreakIterator *break_iter TSRMLS_DC);
  49. void breakiterator_object_construct(zval *object, BreakIterator *break_iter TSRMLS_DC);
  50. void breakiterator_register_BreakIterator_class(TSRMLS_D);
  51. extern zend_class_entry *BreakIterator_ce_ptr,
  52. *RuleBasedBreakIterator_ce_ptr;
  53. extern zend_object_handlers BreakIterator_handlers;
  54. #endif /* #ifndef BREAKITERATOR_CLASS_H */