本文整理汇总了C++中JSString::tryGetValueImpl方法的典型用法代码示例。如果您正苦于以下问题:C++ JSString::tryGetValueImpl方法的具体用法?C++ JSString::tryGetValueImpl怎么用?C++ JSString::tryGetValueImpl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSString
的用法示例。
在下文中一共展示了JSString::tryGetValueImpl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equalToStringImpl
static TriState equalToStringImpl(JSValue value, StringImpl* stringImpl)
{
if (!value.isString())
return FalseTriState;
JSString* jsString = asString(value);
const StringImpl* string = jsString->tryGetValueImpl();
if (!string)
return MixedTriState;
return triState(WTF::equal(stringImpl, string));
}
示例2: equalToSingleCharacter
static TriState equalToSingleCharacter(JSValue value, UChar character)
{
if (!value.isString())
return FalseTriState;
JSString* jsString = asString(value);
if (jsString->length() != 1)
return FalseTriState;
const StringImpl* string = jsString->tryGetValueImpl();
if (!string)
return MixedTriState;
return triState(string->at(0) == character);
}
示例3: dumpForBacktrace
void JSValue::dumpForBacktrace(PrintStream& out) const
{
if (!*this)
out.print("<JSValue()>");
else if (isInt32())
out.printf("%d", asInt32());
else if (isDouble())
out.printf("%lf", asDouble());
else if (isCell()) {
if (asCell()->inherits(JSString::info())) {
JSString* string = jsCast<JSString*>(asCell());
const StringImpl* impl = string->tryGetValueImpl();
if (impl)
out.print("\"", impl, "\"");
else
out.print("(unresolved string)");
} else if (asCell()->inherits(Structure::info())) {
out.print("Structure[ ", asCell()->structure()->classInfo()->className);
#if USE(JSVALUE64)
out.print(" ID: ", asCell()->structureID());
#endif
out.print("]: ", RawPointer(asCell()));
} else {
out.print("Cell[", asCell()->structure()->classInfo()->className);
#if USE(JSVALUE64)
out.print(" ID: ", asCell()->structureID());
#endif
out.print("]: ", RawPointer(asCell()));
}
} else if (isTrue())
out.print("True");
else if (isFalse())
out.print("False");
else if (isNull())
out.print("Null");
else if (isUndefined())
out.print("Undefined");
else
out.print("INVALID");
}
示例4: dumpInContextAssumingStructure
void JSValue::dumpInContextAssumingStructure(
PrintStream& out, DumpContext* context, Structure* structure) const
{
if (!*this)
out.print("<JSValue()>");
else if (isInt32())
out.printf("Int32: %d", asInt32());
else if (isDouble()) {
#if USE(JSVALUE64)
out.printf("Double: %lld, %lf", (long long)reinterpretDoubleToInt64(asDouble()), asDouble());
#else
union {
double asDouble;
uint32_t asTwoInt32s[2];
} u;
u.asDouble = asDouble();
out.printf("Double: %08x:%08x, %lf", u.asTwoInt32s[1], u.asTwoInt32s[0], asDouble());
#endif
} else if (isCell()) {
if (structure->classInfo()->isSubClassOf(JSString::info())) {
JSString* string = jsCast<JSString*>(asCell());
out.print("String");
if (string->isRope())
out.print(" (rope)");
const StringImpl* impl = string->tryGetValueImpl();
if (impl) {
if (impl->isAtomic())
out.print(" (atomic)");
if (impl->isAtomic())
out.print(" (identifier)");
if (impl->isSymbol())
out.print(" (symbol)");
} else
out.print(" (unresolved)");
out.print(": ", impl);
} else if (structure->classInfo()->isSubClassOf(Symbol::info()))
out.print("Symbol: ", RawPointer(asCell()));
else if (structure->classInfo()->isSubClassOf(Structure::info()))
out.print("Structure: ", inContext(*jsCast<Structure*>(asCell()), context));
else if (structure->classInfo()->isSubClassOf(JSObject::info())) {
out.print("Object: ", RawPointer(asCell()));
out.print(" with butterfly ", RawPointer(asObject(asCell())->butterfly()));
out.print(" (", inContext(*structure, context), ")");
} else {
out.print("Cell: ", RawPointer(asCell()));
out.print(" (", inContext(*structure, context), ")");
}
#if USE(JSVALUE64)
out.print(", ID: ", asCell()->structureID());
#endif
} else if (isTrue())
out.print("True");
else if (isFalse())
out.print("False");
else if (isNull())
out.print("Null");
else if (isUndefined())
out.print("Undefined");
else
out.print("INVALID");
}