format.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Vtiful Extension |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 2017-2017 The Viest |
  6. +----------------------------------------------------------------------+
  7. | http://www.viest.me |
  8. +----------------------------------------------------------------------+
  9. | Author: viest <[email protected]> |
  10. +----------------------------------------------------------------------+
  11. */
  12. #ifdef HAVE_CONFIG_H
  13. #include "config.h"
  14. #endif
  15. #include "include.h"
  16. zend_class_entry *vtiful_format_ce;
  17. /* {{{ ARG_INFO
  18. */
  19. ZEND_BEGIN_ARG_INFO_EX(format_style_arginfo, 0, 0, 1)
  20. ZEND_ARG_INFO(0, handle)
  21. ZEND_END_ARG_INFO()
  22. /* }}} */
  23. /** {{{ \Vtiful\Kernel\Format::boldStype()
  24. */
  25. PHP_METHOD(vtiful_format, boldStype)
  26. {
  27. zval *handle;
  28. lxw_format *bold_format;
  29. excel_resource_t *excel_res;
  30. ZEND_PARSE_PARAMETERS_START(1, 1)
  31. Z_PARAM_RESOURCE(handle)
  32. ZEND_PARSE_PARAMETERS_END();
  33. excel_res = zval_get_resource(handle);
  34. bold_format = workbook_add_format(excel_res->workbook);
  35. format_set_bold(bold_format);
  36. RETURN_RES(zend_register_resource(bold_format, le_excel_writer));
  37. }
  38. /* }}} */
  39. /** {{{ excel_methods
  40. */
  41. zend_function_entry formac_methods[] = {
  42. PHP_ME(vtiful_format, boldStype, format_style_arginfo, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
  43. PHP_FE_END
  44. };
  45. /* }}} */
  46. /** {{{ VTIFUL_STARTUP_FUNCTION
  47. */
  48. VTIFUL_STARTUP_FUNCTION(format) {
  49. zend_class_entry ce;
  50. INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Format", formac_methods);
  51. vtiful_format_ce = zend_register_internal_class(&ce);
  52. return SUCCESS;
  53. }
  54. /* }}} */