当前位置: 首页>>代码示例>>C++>>正文


C++ TiValue::isString方法代码示例

本文整理汇总了C++中TiValue::isString方法的典型用法代码示例。如果您正苦于以下问题:C++ TiValue::isString方法的具体用法?C++ TiValue::isString怎么用?C++ TiValue::isString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TiValue的用法示例。


在下文中一共展示了TiValue::isString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TiValueIsString

bool TiValueIsString(TiContextRef ctx, TiValueRef value)
{
    TiExcState* exec = toJS(ctx);
    APIEntryShim entryShim(exec);

    TiValue jsValue = toJS(exec, value);
    return jsValue.isString();
}
开发者ID:adelyte,项目名称:tijscore,代码行数:8,代码来源:TiValueRef.cpp

示例2: constructDate

// ECMA 15.9.3
TiObject* constructDate(TiExcState* exec, const ArgList& args)
{
    int numArgs = args.size();

    double value;

    if (numArgs == 0) // new Date() ECMA 15.9.3.3
        value = jsCurrentTime();
    else if (numArgs == 1) {
        if (args.at(0).inherits(&DateInstance::info))
            value = asDateInstance(args.at(0))->internalNumber();
        else {
            TiValue primitive = args.at(0).toPrimitive(exec);
            if (primitive.isString())
                value = parseDate(exec, primitive.getString(exec));
            else
                value = primitive.toNumber(exec);
        }
    } else {
        if (isnan(args.at(0).toNumber(exec))
                || isnan(args.at(1).toNumber(exec))
                || (numArgs >= 3 && isnan(args.at(2).toNumber(exec)))
                || (numArgs >= 4 && isnan(args.at(3).toNumber(exec)))
                || (numArgs >= 5 && isnan(args.at(4).toNumber(exec)))
                || (numArgs >= 6 && isnan(args.at(5).toNumber(exec)))
                || (numArgs >= 7 && isnan(args.at(6).toNumber(exec))))
            value = NaN;
        else {
            GregorianDateTime t;
            int year = args.at(0).toInt32(exec);
            t.year = (year >= 0 && year <= 99) ? year : year - 1900;
            t.month = args.at(1).toInt32(exec);
            t.monthDay = (numArgs >= 3) ? args.at(2).toInt32(exec) : 1;
            t.hour = args.at(3).toInt32(exec);
            t.minute = args.at(4).toInt32(exec);
            t.second = args.at(5).toInt32(exec);
            t.isDST = -1;
            double ms = (numArgs >= 7) ? args.at(6).toNumber(exec) : 0;
            value = gregorianDateTimeToMS(exec, t, ms, false);
        }
    }

    return new (exec) DateInstance(exec, value);
}
开发者ID:adelyte,项目名称:tijscore,代码行数:45,代码来源:DateConstructor.cpp

示例3: entryShim

::TiType TiValueGetType(TiContextRef ctx, TiValueRef value)
{
    TiExcState* exec = toJS(ctx);
    APIEntryShim entryShim(exec);

    TiValue jsValue = toJS(exec, value);

    if (jsValue.isUndefined())
        return kTITypeUndefined;
    if (jsValue.isNull())
        return kTITypeNull;
    if (jsValue.isBoolean())
        return kTITypeBoolean;
    if (jsValue.isNumber())
        return kTITypeNumber;
    if (jsValue.isString())
        return kTITypeString;
    ASSERT(jsValue.isObject());
    return kTITypeObject;
}
开发者ID:adelyte,项目名称:tijscore,代码行数:20,代码来源:TiValueRef.cpp

示例4: operationGetByVal

EncodedTiValue operationGetByVal(TiExcState* exec, EncodedTiValue encodedBase, EncodedTiValue encodedProperty)
{
    TiValue baseValue = TiValue::decode(encodedBase);
    TiValue property = TiValue::decode(encodedProperty);

    if (LIKELY(baseValue.isCell())) {
        TiCell* base = baseValue.asCell();

        if (property.isUInt32()) {
            TiGlobalData* globalData = &exec->globalData();
            uint32_t i = property.asUInt32();

            // FIXME: the JIT used to handle these in compiled code!
            if (isTiArray(globalData, base) && asArray(base)->canGetIndex(i))
                return TiValue::encode(asArray(base)->getIndex(i));

            // FIXME: the JITstub used to relink this to an optimized form!
            if (isTiString(globalData, base) && asString(base)->canGetIndex(i))
                return TiValue::encode(asString(base)->getIndex(exec, i));

            // FIXME: the JITstub used to relink this to an optimized form!
            if (isTiArrayArray(globalData, base) && asByteArray(base)->canAccessIndex(i))
                return TiValue::encode(asByteArray(base)->getIndex(exec, i));

            return TiValue::encode(baseValue.get(exec, i));
        }

        if (property.isString()) {
            Identifier propertyName(exec, asString(property)->value(exec));
            PropertySlot slot(base);
            if (base->fastGetOwnPropertySlot(exec, propertyName, slot))
                return TiValue::encode(slot.getValue(exec, propertyName));
        }
    }

    Identifier ident(exec, property.toString(exec));
    return TiValue::encode(baseValue.get(exec, ident));
}
开发者ID:AngelkPetkov,项目名称:tijscore,代码行数:38,代码来源:DFGOperations.cpp

示例5: getPrimitiveNumber

bool TiObject::getPrimitiveNumber(TiExcState* exec, double& number, TiValue& result)
{
    result = defaultValue(exec, PreferNumber);
    number = result.toNumber(exec);
    return !result.isString();
}
开发者ID:rseagraves,项目名称:tijscore,代码行数:6,代码来源:TiObject.cpp


注:本文中的TiValue::isString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。