Esempio n. 1
0
/* {{{ proto string CursorId::__toString()
   Returns the string representation of the CursorId */
PHP_METHOD(CursorId, __toString)
{
	php_phongo_cursorid_t    *intern;
	char *tmp;
	int tmp_len;
	SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(return_value_used)

	intern = Z_CURSORID_OBJ_P(getThis());

	if (zend_parse_parameters_none() == FAILURE) {
		return;
	}

	tmp_len = spprintf(&tmp, 0, "%" PRIu64, intern->id);
	PHONGO_RETVAL_STRINGL(tmp, tmp_len);
	efree(tmp);
}
/* {{{ proto string Timestamp::__toString()
   Returns [increment:timestamp] */
PHP_METHOD(Timestamp, __toString)
{
    php_phongo_timestamp_t    *intern;
    char                      *retval;
    int                        retval_len;


    intern = Z_TIMESTAMP_OBJ_P(getThis());

    if (zend_parse_parameters_none() == FAILURE) {
        return;
    }

    retval_len = spprintf(&retval, 0, "[%d:%d]", intern->increment, intern->timestamp);
    PHONGO_RETVAL_STRINGL(retval, retval_len);
    efree(retval);
}
Esempio n. 3
0
/* {{{ proto string UTCDateTime::__toString()
   Returns the string representation of the UTCDateTime */
PHP_METHOD(UTCDateTime, __toString)
{
	php_phongo_utcdatetime_t    *intern;
	char *tmp;
	int tmp_len;


	intern = Z_UTCDATETIME_OBJ_P(getThis());

	if (zend_parse_parameters_none() == FAILURE) {
		return;
	}

	tmp_len = spprintf(&tmp, 0, "%" PRId64, intern->milliseconds);
	PHONGO_RETVAL_STRINGL(tmp, tmp_len);
	efree(tmp);
}
/* {{{ proto void Regex::__toString()
    */
PHP_METHOD(Regex, __toString)
{
	php_phongo_regex_t       *intern;
	char                     *regex;
	int                       regex_len;


	intern = Z_REGEX_OBJ_P(getThis());

	if (zend_parse_parameters_none() == FAILURE) {
		return;
	}


	regex_len = spprintf(&regex, 0, "/%s/%s", intern->pattern, intern->flags);
	PHONGO_RETVAL_STRINGL(regex, regex_len);
	efree(regex);
}