本文整理汇总了C++中CObjRef::get方法的典型用法代码示例。如果您正苦于以下问题:C++ CObjRef::get方法的具体用法?C++ CObjRef::get怎么用?C++ CObjRef::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObjRef
的用法示例。
在下文中一共展示了CObjRef::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: more
bool Array::more(CObjRef v2) const {
if (m_px == nullptr || v2.get() == nullptr) {
return HPHP::more(toBoolean(), v2.toBoolean());
}
check_collection_compare(v2.get());
return false;
}
示例2: equal
bool Object::equal(CObjRef v2) const {
if (m_px == v2.get())
return true;
if (!m_px || !v2.get())
return false;
if (isResource() || v2.isResource())
return false;
return (v2.get()->o_isClass(m_px->o_getClassName()) &&
toArray().equal(v2.toArray()));
}
示例3: 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;
}
示例4: 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);
}
}
示例5: equal
bool Object::equal(CObjRef v2) const {
if (m_px == v2.get()) {
return true;
}
if (!m_px || !v2.get()) {
return false;
}
if (v2.get()->getVMClass() != m_px->getVMClass()) {
return false;
}
if (m_px->isCollection()) {
return collectionEquals(m_px, v2.get());
}
return toArray().equal(v2.toArray());
}
示例6: equal
bool Object::equal(CObjRef v2) const {
if (m_px == v2.get()) {
check_collection_compare(m_px);
return true;
}
if (!m_px || !v2.get()) {
return false;
}
check_collection_compare(m_px, v2.get());
if (isResource() || v2.isResource()) {
return false;
}
return (v2.get()->o_isClass(m_px->o_getClassName()) &&
toArray().equal(v2.toArray()));
}
示例7: invokeStaticDirect
Variant MethodStatement::
invokeInstanceDirect(CObjRef obj, VariableEnvironment &env,
const FunctionCallExpression *caller) const {
if (getModifiers() & ClassStatement::Static) {
return invokeStaticDirect(obj->o_getClassName(), env, caller);
}
attemptAccess(FrameInjection::GetClassName(false));
DECLARE_THREAD_INFO
RECURSION_INJECTION
REQUEST_TIMEOUT_INJECTION
#ifdef HOTPROFILER
ProfilerInjection pi(info, m_fullName.c_str());
#endif
MethScopeVariableEnvironment fenv(this, 0);
directBind(env, caller, fenv);
fenv.setCurrentObject(obj);
String clsName(m_class->name().c_str(), m_class->name().size(),
AttachLiteral);
EvalFrameInjection fi(clsName, m_fullName.c_str(), fenv,
loc()->file, obj.get());
if (m_ref) {
return ref(evalBody(fenv));
}
return evalBody(fenv);
}
示例8: markAsFailed
void c_ContinuationWaitHandle::markAsFailed(CObjRef exception) {
AsioSession::Get()->onFailed(exception);
setException(exception.get());
m_continuation = nullptr;
m_child = nullptr;
}
示例9: throw_exception
void throw_exception(CObjRef e) {
if (!e.instanceof(SystemLib::s_ExceptionClass)) {
raise_error("Exceptions must be valid objects derived from the "
"Exception base class");
}
DEBUGGER_ATTACHED_ONLY(phpDebuggerExceptionThrownHook(e.get()));
throw e;
}
示例10: 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;
}
示例11: ti_create
Object c_StaticExceptionWaitHandle::ti_create(CObjRef exception) {
if (!exception.instanceof(SystemLib::s_ExceptionClass)) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Expected exception to be an instance of Exception"));
throw e;
}
return Create(exception.get());
}
示例12: 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();
}
示例13: markAsFailed
void c_SetResultToRefWaitHandle::markAsFailed(CObjRef exception) {
RefData* ref = m_ref;
m_ref = nullptr;
tvSetIgnoreRef(make_tv<KindOfNull>(), *ref->tv());
decRefRef(ref);
setException(exception.get());
m_child = nullptr;
}
示例14: markAsFailed
void c_ContinuationWaitHandle::markAsFailed(CObjRef exception) {
AsioSession* session = AsioSession::Get();
session->onFailed(exception);
if (UNLIKELY(session->hasOnContinuationFailCallback())) {
session->onContinuationFail(this, exception);
}
setException(exception.get());
m_continuation = nullptr;
m_child = nullptr;
}
示例15: more
bool String::more(CObjRef v2) const {
if (m_px == NULL || v2.get() == NULL) {
return HPHP::more(toBoolean(), v2.toBoolean());
}
if (v2.isResource()) return false;
try {
return more(v2.toString());
} catch (BadTypeConversionException &e) {
return false;
}
}