1 Star 0 Fork 345

wukong / swoole-src

forked from swoole / swoole-src 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
php_swoole_cxx.h 1.00 KB
一键复制 编辑 原始数据 按行查看 历史
韩天峰 提交于 2019-01-17 21:07 . remove convert_to_string[3]
#pragma once
#include "php_swoole.h"
namespace zend
{
class string
{
public:
string()
{
str = nullptr;
}
string(zval *v)
{
str = zval_get_string(v);
}
void operator =(zval* v)
{
if (str)
{
zend_string_release(str);
}
str = zval_get_string(v);
}
inline char* val()
{
return str->val;
}
inline size_t len()
{
return str->len;
}
~string()
{
if (str)
{
zend_string_release(str);
}
}
private:
zend_string *str;
};
inline char* string_dup(zval *v)
{
zend::string str(v);
return sw_strndup(str.val(), str.len());
}
class string_ptr
{
public:
string_ptr(zend_string *_str)
{
str = _str;
}
string_ptr(string_ptr &&o)
{
str = o.str;
o.str = nullptr;
}
~string_ptr()
{
if (str)
{
zend_string_release(str);
}
}
zend_string *str;
};
}
C
1
https://gitee.com/scaly/swoole.git
git@gitee.com:scaly/swoole.git
scaly
swoole
swoole-src
master

搜索帮助