common_enum.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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: Vadim Savchuk <vsavchuk@productengine.com> |
  14. | Dmitry Lakhtyuk <dlakhtyuk@productengine.com> |
  15. +----------------------------------------------------------------------+
  16. */
  17. #ifndef INTL_COMMON_ENUM_H
  18. #define INTL_COMMON_ENUM_H
  19. #include <unicode/umachine.h>
  20. #ifdef __cplusplus
  21. #include <unicode/strenum.h>
  22. extern "C" {
  23. #include <math.h>
  24. #endif
  25. #include <php.h>
  26. #include "../intl_error.h"
  27. #include "../intl_data.h"
  28. #ifdef __cplusplus
  29. }
  30. #endif
  31. #define INTLITERATOR_ERROR(ii) (ii)->err
  32. #define INTLITERATOR_ERROR_P(ii) &(INTLITERATOR_ERROR(ii))
  33. #define INTLITERATOR_ERROR_CODE(ii) INTL_ERROR_CODE(INTLITERATOR_ERROR(ii))
  34. #define INTLITERATOR_ERROR_CODE_P(ii) &(INTL_ERROR_CODE(INTLITERATOR_ERROR(ii)))
  35. #define INTLITERATOR_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlIterator, ii)
  36. #define INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(IntlIterator, ii)
  37. #define INTLITERATOR_METHOD_FETCH_OBJECT\
  38. object = getThis(); \
  39. INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \
  40. if (ii->iterator == NULL) { \
  41. intl_errors_set(&ii->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlIterator", 0 TSRMLS_CC); \
  42. RETURN_FALSE; \
  43. }
  44. typedef struct {
  45. zend_object zo;
  46. intl_error err;
  47. zend_object_iterator *iterator;
  48. } IntlIterator_object;
  49. typedef struct {
  50. zend_object_iterator zoi;
  51. zval *current;
  52. zval *wrapping_obj;
  53. void (*destroy_it)(zend_object_iterator *iterator TSRMLS_DC);
  54. } zoi_with_current;
  55. extern zend_class_entry *IntlIterator_ce_ptr;
  56. extern zend_object_handlers IntlIterator_handlers;
  57. U_CFUNC void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC);
  58. U_CFUNC int zoi_with_current_valid(zend_object_iterator *iter TSRMLS_DC);
  59. U_CFUNC void zoi_with_current_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC);
  60. U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC);
  61. #ifdef __cplusplus
  62. U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object TSRMLS_DC);
  63. #endif
  64. U_CFUNC void intl_register_IntlIterator_class(TSRMLS_D);
  65. #endif // INTL_COMMON_ENUM_H