123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- /*
- +----------------------------------------------------------------------+
- | XlsWriter Extension |
- +----------------------------------------------------------------------+
- | Copyright (c) 2017-2018 The Viest |
- +----------------------------------------------------------------------+
- | http://www.viest.me |
- +----------------------------------------------------------------------+
- | Author: viest <[email protected]> |
- +----------------------------------------------------------------------+
- */
- #ifdef HAVE_CONFIG_H
- #include "config.h"
- #endif
- #include "include.h"
- zend_class_entry *vtiful_format_ce;
- /* {{{ ARG_INFO
- */
- ZEND_BEGIN_ARG_INFO_EX(format_style_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, handle)
- ZEND_END_ARG_INFO()
- ZEND_BEGIN_ARG_INFO_EX(format_underline_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, handle)
- ZEND_ARG_INFO(0, style)
- ZEND_END_ARG_INFO()
- /* }}} */
- /** {{{ \Vtiful\Kernel\Format::bold()
- */
- PHP_METHOD(vtiful_format, bold)
- {
- zval *handle;
- lxw_format *bold_format;
- xls_resource_t *xls_res;
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_RESOURCE(handle)
- ZEND_PARSE_PARAMETERS_END();
- xls_res = zval_get_resource(handle);
- bold_format = workbook_add_format(xls_res->workbook);
- format_set_bold(bold_format);
- RETURN_RES(zend_register_resource(bold_format, le_xls_writer));
- }
- /* }}} */
- /** {{{ \Vtiful\Kernel\Format::italic()
- */
- PHP_METHOD(vtiful_format, italic)
- {
- zval *handle;
- lxw_format *italic_format;
- xls_resource_t *xls_res;
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_RESOURCE(handle)
- ZEND_PARSE_PARAMETERS_END();
- xls_res = zval_get_resource(handle);
- italic_format = workbook_add_format(xls_res->workbook);
- format_set_italic(italic_format);
- RETURN_RES(zend_register_resource(italic_format, le_xls_writer));
- }
- /* }}} */
- /** {{{ \Vtiful\Kernel\Format::underline()
- */
- PHP_METHOD(vtiful_format, underline)
- {
- zval *handle;
- zend_long style;
- lxw_format *underline_format;
- xls_resource_t *xls_res;
- ZEND_PARSE_PARAMETERS_START(2, 2)
- Z_PARAM_RESOURCE(handle)
- Z_PARAM_LONG(style)
- ZEND_PARSE_PARAMETERS_END();
- xls_res = zval_get_resource(handle);
- underline_format = workbook_add_format(xls_res->workbook);
- format_set_underline(underline_format, style);
- RETURN_RES(zend_register_resource(underline_format, le_xls_writer));
- }
- /* }}} */
- /** {{{ xls_methods
- */
- zend_function_entry format_methods[] = {
- PHP_ME(vtiful_format, bold, format_style_arginfo, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(vtiful_format, italic, format_style_arginfo, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(vtiful_format, underline, format_style_arginfo, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_FE_END
- };
- /* }}} */
- /** {{{ VTIFUL_STARTUP_FUNCTION
- */
- VTIFUL_STARTUP_FUNCTION(format) {
- zend_class_entry ce;
- INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Format", format_methods);
- vtiful_format_ce = zend_register_internal_class(&ce);
- REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_SINGLE", LXW_UNDERLINE_SINGLE)
- REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_DOUBLE ", LXW_UNDERLINE_DOUBLE)
- REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_SINGLE_ACCOUNTING", LXW_UNDERLINE_SINGLE_ACCOUNTING)
- REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_DOUBLE_ACCOUNTING", LXW_UNDERLINE_DOUBLE_ACCOUNTING)
- return SUCCESS;
- }
- /* }}} */
|