resourcebundle_class.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. +----------------------------------------------------------------------+
  3. | This source file is subject to version 3.01 of the PHP license, |
  4. | that is bundled with this package in the file LICENSE, and is |
  5. | available through the world-wide-web at the following url: |
  6. | https://www.php.net/license/3_01.txt |
  7. | If you did not receive a copy of the PHP license and are unable to |
  8. | obtain it through the world-wide-web, please send a note to |
  9. | license@php.net so we can mail you a copy immediately. |
  10. +----------------------------------------------------------------------+
  11. | Authors: Hans-Peter Oeri (University of St.Gallen) <hp@oeri.ch> |
  12. +----------------------------------------------------------------------+
  13. */
  14. #ifndef RESOURCEBUNDLE_CLASS_H
  15. #define RESOURCEBUNDLE_CLASS_H
  16. #include <unicode/ures.h>
  17. #include <zend.h>
  18. #include "php.h"
  19. #include "intl_error.h"
  20. typedef struct {
  21. intl_error error;
  22. UResourceBundle *me;
  23. UResourceBundle *child;
  24. zend_object zend;
  25. } ResourceBundle_object;
  26. static inline ResourceBundle_object *php_intl_resourcebundle_fetch_object(zend_object *obj) {
  27. return (ResourceBundle_object *)((char*)(obj) - XtOffsetOf(ResourceBundle_object, zend));
  28. }
  29. #define Z_INTL_RESOURCEBUNDLE_P(zv) php_intl_resourcebundle_fetch_object(Z_OBJ_P(zv))
  30. #define RESOURCEBUNDLE_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(ResourceBundle, rb)
  31. #define RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(INTL_RESOURCEBUNDLE, rb)
  32. #define RESOURCEBUNDLE_METHOD_FETCH_OBJECT \
  33. INTL_METHOD_FETCH_OBJECT(INTL_RESOURCEBUNDLE, rb); \
  34. if (RESOURCEBUNDLE_OBJECT(rb) == NULL) { \
  35. zend_throw_error(NULL, "Found unconstructed ResourceBundle"); \
  36. RETURN_THROWS(); \
  37. }
  38. #define RESOURCEBUNDLE_OBJECT(rb) (rb)->me
  39. void resourcebundle_register_class( void );
  40. extern zend_class_entry *ResourceBundle_ce_ptr;
  41. #endif // #ifndef RESOURCEBUNDLE_CLASS_H