Path added
[phpCairo.git] / individual_files / phpCairoPath.c
blob0d7463ba31b4b28f3f6fc7c460b21e6bc01b8d5e
1 /* {{{ Class CairoPath */
3 static zend_class_entry * CairoPath_ce_ptr = NULL;
4 static zend_object_handlers CairoPath_handlers;
6 typedef _path_object {
7 zend_object std;
8 cairo_path_t path;
9 } path_object;
11 /* {{{ Methods */
14 /* {{{ proto void construct()
16 PHP_METHOD(CairoPath, __construct)
18 zend_class_entry * _this_ce;
19 zval * _this_zval;
23 if (ZEND_NUM_ARGS()>0) {
24 WRONG_PARAM_COUNT;
28 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
31 /* }}} __construct */
35 /* {{{ proto string str()
37 PHP_METHOD(CairoPath, str)
39 zend_class_entry * _this_ce;
41 zval * _this_zval = NULL;
45 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPath_ce_ptr) == FAILURE) {
46 return;
49 _this_ce = Z_OBJCE_P(_this_zval);
52 php_error(E_WARNING, "str: not yet implemented"); RETURN_FALSE;
54 RETURN_STRINGL("", 0, 1);
56 /* }}} str */
59 static zend_function_entry CairoPath_methods[] = {
60 PHP_ME(CairoPath, __construct, NULL, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
61 PHP_ME(CairoPath, str, NULL, /**/ZEND_ACC_PUBLIC)
62 { NULL, NULL, NULL }
65 /* }}} Methods */
67 static void CairoPath_object_dtor(void *object)
69 path_object *path = (path_object *)object;
70 zend_hash_destroy(path->std.properties);
71 if(path->path) {
72 cairo_path_destroy(path->path);
74 efree(object);
77 static zend_object_value CairoPath_object_new(zend_class_entrt *ce)
79 zend_object_value retval;
80 path_object path;
81 zval *temp;
83 path = emalloc(sizeof(path_object));
84 memcpy(path,0,sizeof(path_object));
86 path->std.ce = ce;
88 ALLOC_HASHTABLE(path->std.properties);
89 zend_hash_init(path->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
90 zend_hash_copy(path->std.properties, &ce->default_properties, copy_ctor_func_t zval_add_ref, (void *) &temp, sizeof(zval *));
91 retval.handle = zend_objects_store_put(path, NULL, (zend_object_free_storage_t)CairoPath_object_dtor, NULL TSRMLS_CC);
92 retval.handlers = &CairoPath_handlers;
93 return retval;
97 static void class_init_CairoPath(void)
99 zend_class_entry ce;
101 INIT_CLASS_ENTRY(ce, "CairoPath", CairoPath_methods);
102 CairoPath_ce_ptr = zend_register_internal_class(&ce);
103 CairoPath_ce_ptr->create_object = CairoPath_object_new;
104 memcpy(&CarioPath_handlers, zend_get_std_object_handlers(),sizeof(zend_object_handlers));
105 CairoPath_handlers.clone_obj = NULL;
109 /* }}} Class CairoPath */