本文整理汇总了C++中CObjRef::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ CObjRef::isNull方法的具体用法?C++ CObjRef::isNull怎么用?C++ CObjRef::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObjRef
的用法示例。
在下文中一共展示了CObjRef::isNull方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Array
NestedVariableEnvironment::NestedVariableEnvironment
(LVariableTable *ext, const Block &blk, CArrRef params /* = Array() */,
CObjRef current_object /* = Object() */)
: m_ext(ext), m_block(blk), m_params(params) {
m_byIdx.resize(m_block.varIndices().size());
if (!current_object.isNull()) setCurrentObject(current_object);
}
示例2: f_socket_last_error
int64_t f_socket_last_error(CObjRef socket /* = null_object */) {
if (!socket.isNull()) {
Socket *sock = socket.getTyped<Socket>();
return sock->getError();
}
return Socket::getLastError();
}
示例3: Array
NestedVariableEnvironment::NestedVariableEnvironment
(LVariableTable *ext, const Block &blk, CArrRef params /* = Array() */,
CObjRef current_object /* = Object() */)
: m_ext(ext), m_block(blk), m_params(params) {
if (!current_object.isNull()) setCurrentObject(current_object);
g_sinit.initGlobals(*this);
}
示例4: same
bool same(CVarRef v1, CObjRef v2) {
bool null1 = v1.isNull();
bool null2 = v2.isNull();
if (null1 && null2) return true;
if (null1 || null2) return false;
if (!v1.isObject()) return false;
auto const od = v1.getObjectData();
return od == v2.get();
}
示例5: SetOnFailedCallback
void AsioSession::SetOnFailedCallback(CObjRef on_failed_cb) {
if (!on_failed_cb.isNull()) {
on_failed_cb->incRefCount();
}
if (s_on_failed_cb.get()) {
decRefObj(s_on_failed_cb.get());
}
s_on_failed_cb.set(on_failed_cb.get());
}
示例6: t___construct
void c_DateTime::t___construct(const String& time /*= "now"*/,
CObjRef timezone /*= null_object*/) {
m_dt = NEWOBJ(DateTime)(TimeStamp::Current());
if (!time.empty()) {
m_dt->fromString(time, c_DateTimeZone::unwrap(timezone));
} else if (!timezone.isNull()) {
// We still have to tell the underlying DateTime the timezone incase they
// call setTimestamp or something else later
m_dt->setTimezone(c_DateTimeZone::unwrap(timezone));
}
}
示例7: ti_create
Object c_SetResultToRefWaitHandle::ti_create(CObjRef wait_handle, VRefParam ref) {
TypedValue* var_or_cell = ref->asTypedValue();
if (wait_handle.isNull()) {
tvSetNull(*var_or_cell);
return wait_handle;
}
if (!wait_handle.get()->getAttribute(ObjectData::IsWaitHandle)) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Expected wait_handle to be an instance of WaitHandle or null"));
throw e;
}
auto wh = static_cast<c_WaitHandle*>(wait_handle.get());
// succeeded? set result to ref and give back succeeded wait handle
if (wh->isSucceeded()) {
tvSet(wh->getResult(), *var_or_cell);
return wh;
}
// failed? reset ref and give back failed wait handle
if (wh->isFailed()) {
tvSetNull(*var_or_cell);
return wh;
}
// it's still running so it must be WaitableWaitHandle
auto child = static_cast<c_WaitableWaitHandle*>(wh);
// import child into the current context, detect cross-context cycles
auto session = AsioSession::Get();
if (session->isInContext()) {
child->enterContext(session->getCurrentContextIdx());
}
// make sure the reference is properly boxed so that we can store cell pointer
if (UNLIKELY(var_or_cell->m_type != KindOfRef)) {
tvBox(var_or_cell);
}
p_SetResultToRefWaitHandle my_wh = NEWOBJ(c_SetResultToRefWaitHandle)();
my_wh->initialize(child, var_or_cell->m_data.pref);
if (UNLIKELY(session->hasOnSetResultToRefCreateCallback())) {
session->onSetResultToRefCreate(my_wh.get(), child);
}
return my_wh;
}
示例8: write
void VariableSerializer::write(CObjRef v) {
if (!v.isNull() && m_type == JSON) {
if (incNestedLevel(v.get(), true)) {
writeOverflow(v.get(), true);
} else {
Array props(ArrayData::Create());
ClassInfo::GetArray(v.get(), v->o_getClassPropTable(), props, true);
setObjectInfo(v->o_getClassName(), v->o_getId());
props.serialize(this);
}
decNestedLevel(v.get());
} else {
v.serialize(this);
}
}
示例9: ti_create
Object c_SetResultToRefWaitHandle::ti_create(CObjRef wait_handle, VRefParam ref) {
TypedValue* var_or_cell = ref->asTypedValue();
if (wait_handle.isNull()) {
tvSet(make_tv<KindOfNull>(), *var_or_cell);
return wait_handle;
}
if (!wait_handle.get()->instanceof(c_WaitHandle::classof())) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Expected wait_handle to be an instance of WaitHandle or null"));
throw e;
}
c_WaitHandle* wh = static_cast<c_WaitHandle*>(wait_handle.get());
// succeeded? set result to ref and give back succeeded wait handle
if (wh->isSucceeded()) {
tvSet(wh->getResult(), *var_or_cell);
return wh;
}
// failed? reset ref and give back failed wait handle
if (wh->isFailed()) {
tvSet(make_tv<KindOfNull>(), *var_or_cell);
return wh;
}
// it's still running so it must be WaitableWaitHandle
c_WaitableWaitHandle* child_wh = static_cast<c_WaitableWaitHandle*>(wh);
// make sure the reference is properly boxed so that we can store cell pointer
if (UNLIKELY(var_or_cell->m_type != KindOfRef)) {
tvBox(var_or_cell);
}
p_SetResultToRefWaitHandle my_wh = NEWOBJ(c_SetResultToRefWaitHandle)();
my_wh->initialize(child_wh, var_or_cell->m_data.pref);
AsioSession* session = AsioSession::Get();
if (UNLIKELY(session->hasOnSetResultToRefCreateCallback())) {
session->onSetResultToRefCreate(my_wh.get(), child_wh);
}
return my_wh;
}
示例10: write
void VariableSerializer::write(CObjRef v) {
if (!v.isNull() && m_type == JSON) {
Array props = v->o_toArray();
ClassInfo::PropertyVec properties;
ClassInfo::GetClassProperties(properties, v->o_getClassName());
for (ClassInfo::PropertyVec::const_iterator iter = properties.begin();
iter != properties.end(); ++iter) {
if ((*iter)->attribute & ClassInfo::IsProtected) {
props.remove((*iter)->name);
}
}
// Remove private props
for (ArrayIter it(props); !it.end(); it.next()) {
if (it.first().toString().charAt(0) == '\0') {
props.remove(it.first());
}
}
setObjectInfo(v->o_getClassName(), v->o_getId());
props.serialize(this);
} else {
v.serialize(this);
}
}
示例11: f_socket_clear_error
void f_socket_clear_error(CObjRef socket /* = null_object */) {
if (!socket.isNull()) {
Socket *sock = socket.getTyped<Socket>();
sock->setError(0);
}
}