Exemple #1
0
bool TNodeJsUtil::IsFldClass(v8::Local<v8::Object> Obj, const TStr& FldNm, const TStr& ClassId) {
	if (!IsObjFld(Obj, FldNm)) { return false; }

	v8::Isolate* Isolate = v8::Isolate::GetCurrent();
	v8::HandleScope HandleScope(Isolate);

	v8::Local<v8::Value> FldVal = Obj->Get(v8::String::NewFromUtf8(Isolate, FldNm.CStr()));
	v8::Handle<v8::Object> FldObj = v8::Handle<v8::Object>::Cast(FldVal);

	TStr ClassStr = GetClass(FldObj);
	return ClassStr.EqI(ClassId);
}
Exemple #2
0
bool TNodeJsUtil::IsArgWrapObj(const v8::FunctionCallbackInfo<v8::Value>& Args, const int& ArgN, const TStr& ClassNm) {
    v8::Isolate* Isolate = v8::Isolate::GetCurrent();
    v8::HandleScope HandleScope(Isolate);
    // check we have enough arguments
    EAssertR(Args.Length() > ArgN, TStr::Fmt("Missing argument %d of class %s", ArgN, ClassNm.CStr()));
    // check argument is an object
	if (!Args[ArgN]->IsObject()) return false;
    // check it's class name
    v8::Handle<v8::Value> Val = Args[ArgN];
    v8::Handle<v8::Object> Data = v8::Handle<v8::Object>::Cast(Val);
    TStr ClassStr = GetClass(Data);
    return ClassStr.EqI(ClassNm);
}
Exemple #3
0
TEST(TStr, EqI) {    
	TStr Mixedcase = "AbCd";
	TStr Empty = "";
	EXPECT_TRUE(Mixedcase.EqI(Mixedcase.GetUc()));    
	EXPECT_TRUE(Empty.EqI(Empty));
}