RETURN_RES(obj->stream.ptr->res);
}
-static ZEND_METHOD(ion_Serializer_Serializer, serializeNull)
-{
- php_ion_serializer *obj = php_ion_obj(serializer, Z_OBJ_P(ZEND_THIS));
- OBJ_CHECK(obj);
-
- ZEND_PARSE_PARAMETERS_NONE();
-
- ION_CHECK(ion_writer_write_null(php_ion_obj(writer, obj->wri)->writer));
-}
-
-static ZEND_METHOD(ion_Serializer_Serializer, serializeBool)
-{
- php_ion_serializer *obj = php_ion_obj(serializer, Z_OBJ_P(ZEND_THIS));
- OBJ_CHECK(obj);
-
- zend_bool b;
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_BOOL(b)
- ZEND_PARSE_PARAMETERS_END();
-
- ION_CHECK(ion_writer_write_bool(php_ion_obj(writer, obj->wri)->writer, b));
-}
-
-static ZEND_METHOD(ion_Serializer_Serializer, serializeInt)
-{
- php_ion_serializer *obj = php_ion_obj(serializer, Z_OBJ_P(ZEND_THIS));
- OBJ_CHECK(obj);
-
- zend_long l;
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_LONG(l);
- ZEND_PARSE_PARAMETERS_END();
-
- ION_CHECK(ion_writer_write_int64(php_ion_obj(writer, obj->wri)->writer, l));
-}
-
-static ZEND_METHOD(ion_Serializer_Serializer, serializeFloat)
-{
- php_ion_serializer *obj = php_ion_obj(serializer, Z_OBJ_P(ZEND_THIS));
- OBJ_CHECK(obj);
-
- double d;
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_DOUBLE(d);
- ZEND_PARSE_PARAMETERS_END();
-
- ION_CHECK(ion_writer_write_double(php_ion_obj(writer, obj->wri)->writer, d));
-}
-
-static ZEND_METHOD(ion_Serializer_Serializer, serializeString)
-{
- php_ion_serializer *obj = php_ion_obj(serializer, Z_OBJ_P(ZEND_THIS));
- OBJ_CHECK(obj);
-
- zend_string *zs;
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_STR(zs);
- ZEND_PARSE_PARAMETERS_END();
-
- ION_STRING is;
- ION_CHECK(ion_writer_write_string(php_ion_obj(writer, obj->wri)->writer, ion_string_from_zend(&is, zs)));
-}
-
-static ZEND_METHOD(ion_Serializer_Serializer, serializeArray)
-{
- php_ion_serializer *obj = php_ion_obj(serializer, Z_OBJ_P(ZEND_THIS));
- OBJ_CHECK(obj);
-
- zend_array *arr;
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ARRAY_HT(arr)
- ZEND_PARSE_PARAMETERS_END();
-
- if (zend_array_is_list(arr)) {
- php_ion_serialize_list(obj, arr);
- } else {
- php_ion_serialize_struct(obj, arr, false, false);
- }
-}
-
-static ZEND_METHOD(ion_Serializer_Serializer, serializeObject)
-{
- php_ion_serializer *obj = php_ion_obj(serializer, Z_OBJ_P(ZEND_THIS));
- OBJ_CHECK(obj);
-
- zend_object *o;
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_OBJ(o)
- ZEND_PARSE_PARAMETERS_END();
-
- php_ion_serialize_object(obj, o);
-}
-
static ZEND_METHOD(ion_Serializer_Serializer, __construct)
{
php_ion_serializer *obj = php_ion_obj(serializer, Z_OBJ_P(ZEND_THIS));