这篇教程C++ toObject函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中toObject函数的典型用法代码示例。如果您正苦于以下问题:C++ toObject函数的具体用法?C++ toObject怎么用?C++ toObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了toObject函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: toObjectbool JSCell::getOwnPropertySlot(ExecState* exec, unsigned identifier, PropertySlot& slot){ // This is not a general purpose implementation of getOwnPropertySlot. // It should only be called by JSValue::get. // It calls getPropertySlot, not getOwnPropertySlot. JSObject* object = toObject(exec); slot.setBase(object); if (!object->getPropertySlot(exec, identifier, slot)) slot.setUndefined(); return true;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:11,
示例2: hasPropertybool Dictionary::hasProperty(const String& key) const{ v8::Local<v8::Object> object; if (!toObject(object)) return false; ASSERT(m_isolate); ASSERT(m_isolate == v8::Isolate::GetCurrent()); ASSERT(m_exceptionState); v8::Local<v8::String> v8Key = v8String(m_isolate, key); return v8CallBoolean(object->Has(v8Context(), v8Key));}
开发者ID:Tarnyko,项目名称:chromium-blink,代码行数:12,
示例3: fileInfoQString HttpDaemon::Private::findHandler(QString const &filename) const{ QFileInfo fileInfo(filename); auto suffix = fileInfo.suffix(); auto handle = serverSettings.object().value(settings_handler); auto handleObj = handle.toObject(); for (auto k : handleObj.keys()) { if (handleObj.value(k).toArray().contains(suffix)) return k; } return QString();}
开发者ID:NanoSim,项目名称:Porto,代码行数:12,
示例4: getInternalbool Dictionary::getInternal(const v8::Local<v8::Value>& key, v8::Local<v8::Value>& result) const { v8::Local<v8::Object> object; if (!toObject(object)) return false; DCHECK(m_isolate); DCHECK_EQ(m_isolate, v8::Isolate::GetCurrent()); if (!v8CallBoolean(object->Has(v8Context(), key))) return false; return object->Get(v8Context(), key).ToLocal(&result);}
开发者ID:mirror,项目名称:chromium,代码行数:12,
示例5: readFromDatavoid StringManager::readFromData(QJsonObject& out ,EdgableItems*,QGraphicsScene* scene){ /*settings.beginGroup("StringManager"); m_availableLang = settings.value("Availablelang"); m_currentLang = settings.value("currentlang");*/ /*out >> m_availableLang; QMap<QString,QString> lang; out >> lang; m_currentLang.unite(lang);*/ // qDebug()<< m_currentLang.size() << m_availableLang.size(); QJsonObject stringManager = out["stringManager"].toObject(); QJsonArray array = stringManager["curretLang"].toArray(); for(auto it = array.begin(); it != array.end();++it) { QJsonObject duo = it->toObject(); QString key = duo["key"].toString(); QString val = duo["value"].toString(); m_currentLang.insert(key,val); } QJsonArray array2 = stringManager["availLang"].toArray(); for(auto it = array2.begin(); it != array2.end();++it) { QJsonArray array3 = it->toArray(); QMap<QString, QString> map; for(auto it = array3.begin(); it != array3.end();++it) { QJsonObject duo = it->toObject(); QString key = duo["key"].toString(); QString val = duo["value"].toString(); map.insert(key,val); } m_availableLang.append(map); }}
开发者ID:obiwankennedy,项目名称:rmindmap,代码行数:40,
示例6: utf8_string_or_nonePy::Object toObject ( const svn_wc_entry_t &svn_entry, SvnPool &pool, const DictWrapper &wrapper_entry ){ Py::Dict entry; entry[ str_checksum ] = utf8_string_or_none( svn_entry.checksum ); entry[ str_commit_author ] = utf8_string_or_none( svn_entry.cmt_author ); entry[ str_commit_revision ] = Py::asObject( new pysvn_revision( svn_opt_revision_number, 0, svn_entry.cmt_rev ) ); entry[ str_commit_time ] = toObject( svn_entry.cmt_date ); entry[ str_conflict_new ] = path_string_or_none( svn_entry.conflict_new, pool ); entry[ str_conflict_old ] = path_string_or_none( svn_entry.conflict_old, pool ); entry[ str_conflict_work ] = path_string_or_none( svn_entry.conflict_wrk, pool ); entry[ str_copy_from_revision ] = Py::asObject( new pysvn_revision( svn_opt_revision_number, 0, svn_entry.copyfrom_rev ) ); entry[ str_copy_from_url ] = utf8_string_or_none( svn_entry.copyfrom_url ); entry[ str_is_absent ] = Py::Int( svn_entry.absent ); entry[ str_is_copied ] = Py::Int( svn_entry.copied ); entry[ str_is_deleted ] = Py::Int( svn_entry.deleted ); entry[ str_kind ] = toEnumValue( svn_entry.kind ); entry[ str_name ] = path_string_or_none( svn_entry.name, pool ); entry[ str_properties_time ] = toObject( svn_entry.prop_time ); entry[ str_property_reject_file ] = path_string_or_none( svn_entry.prejfile, pool ); entry[ str_repos ] = utf8_string_or_none( svn_entry.repos ); entry[ str_revision ] = Py::asObject( new pysvn_revision( svn_opt_revision_number, 0, svn_entry.revision ) ); entry[ str_schedule ] = toEnumValue( svn_entry.schedule ); entry[ str_text_time ] = toObject( svn_entry.text_time ); entry[ str_url ] = utf8_string_or_none( svn_entry.url ); entry[ str_uuid ] = utf8_string_or_none( svn_entry.uuid );#if defined( PYSVN_HAS_CLIENT_STATUS2 ) entry[ str_lock_token ] = utf8_string_or_none( svn_entry.lock_token ); entry[ str_lock_owner ] = utf8_string_or_none( svn_entry.lock_owner ); entry[ str_lock_comment ] = utf8_string_or_none( svn_entry.lock_comment ); entry[ str_lock_creation_date ] = toObject( svn_entry.lock_creation_date );#endif return wrapper_entry.wrapDict( entry );}
开发者ID:Formulka,项目名称:pysvn,代码行数:40,
示例7: HHVM_METHODstatic Variant HHVM_METHOD(Yaf_Controller_Abstract, redirect, const String& location){ auto tmp = this_->o_realProp(YAF_CONTROLLER_PROPERTY_NAME_RESPONSE, ObjectData::RealPropUnchecked, "Yaf_Controller_Abstract"); if (tmp->isNull()) { return false; } auto response = tmp->toObject(); (void)yaf_response_set_redirect(response, location); return true;}
开发者ID:sherlockhua,项目名称:hhvm-yaf,代码行数:13,
示例8: get_request_json_documentstd::vector<CSSEnvironment>CRestWorker::get_environments(int& http_code, int& err_code, int& network_error) { std::vector<CSSEnvironment> lst_res; QJsonDocument doc = get_request_json_document("environments", http_code, err_code, network_error); QJsonArray arr = doc.array(); for (auto i = arr.begin(); i != arr.end(); ++i) { if (i->isNull() || !i->isObject()) continue; lst_res.push_back(CSSEnvironment(i->toObject())); } return lst_res;}
开发者ID:caidongyun,项目名称:tray,代码行数:13,
示例9: getKeybool Dictionary::getKey(const String& key, v8::Local<v8::Value>& value) const{ v8::Local<v8::Object> object; if (!toObject(object)) return false; ASSERT(m_isolate); ASSERT(m_isolate == v8::Isolate::GetCurrent()); ASSERT(m_exceptionState); v8::Local<v8::String> v8Key = v8String(m_isolate, key); if (!v8CallBoolean(object->Has(v8Context(), v8Key))) return false; return object->Get(v8Context(), v8Key).ToLocal(&value);}
开发者ID:Tarnyko,项目名称:chromium-blink,代码行数:14,
示例10: QDirvoid Project::fromJSON(const QJsonObject& project){ mEventTypes.clear(); mName = project["name"].toString(); if (!project["lastOpenedTimeline"].toString().isEmpty()) mLastOpenedTimeline = QDir(root()).filePath(project["lastOpenedTimeline"].toString()); const QJsonArray& eventTypes = project["eventTypes"].toArray(); for (auto it = eventTypes.begin(); it != eventTypes.end(); it++) { auto eventType = std::make_shared<EventType>(); eventType->fromJSON(it->toObject()); mEventTypes.push_back(eventType); }}
开发者ID:Aloshi,项目名称:bugel,代码行数:15,
示例11: _entityRenderableProceduralItem::ProceduralInfo::ProceduralInfo(EntityItem* entity) : _entity(entity) { QJsonObject userData; { const QString& userDataJson = entity->getUserData(); if (userDataJson.isEmpty()) { return; } QJsonParseError parseError; auto doc = QJsonDocument::fromJson(userDataJson.toUtf8(), &parseError); if (parseError.error != QJsonParseError::NoError) { return; } userData = doc.object(); } // Example //{ // "ProceduralEntity": { // "shaderUrl": "file:///C:/Users/bdavis/Git/hifi/examples/shaders/test.fs", // "color" : "#FFFFFF" // } //} auto proceduralData = userData[PROCEDURAL_USER_DATA_KEY]; if (proceduralData.isNull()) { return; } auto proceduralDataObject = proceduralData.toObject(); QString shaderUrl = proceduralDataObject["shaderUrl"].toString(); _shaderUrl = QUrl(shaderUrl); if (!_shaderUrl.isValid()) { qWarning() << "Invalid shader URL: " << shaderUrl; return; } if (_shaderUrl.isLocalFile()) { _shaderPath = _shaderUrl.toLocalFile(); qDebug() << "Shader path: " << _shaderPath; if (!QFile(_shaderPath).exists()) { return; } } else { qDebug() << "Shader url: " << _shaderUrl; _networkShader = ShaderCache::instance().getShader(_shaderUrl); } _enabled = true;}
开发者ID:rudi-c,项目名称:hifi,代码行数:48,
示例12: color_class_init// extern (used by Global.cpp)voidcolor_class_init(as_object& where, const ObjectURI& uri){ as_object* cl = registerBuiltinClass(where, color_ctor, attachColorInterface, 0, uri); as_object* proto = toObject( getMember(*cl, NSV::PROP_PROTOTYPE), getVM(where)); if (!proto) return; const int protect = as_object::DefaultFlags | PropFlags::readOnly; proto->set_member_flags(NSV::PROP_uuPROTOuu, protect); proto->set_member_flags(NSV::PROP_CONSTRUCTOR, protect); }
开发者ID:BrandRegard,项目名称:gnash,代码行数:17,
示例13: Resetbool Parameters::Deserialize(const QJsonObject &obj ){ Reset(); bool ret = test::CommonParameters::Deserialize( obj ); auto val = obj.value("hydro"); if ( val.isObject() ) { QJsonObject obj = val.toObject(); mGsType = obj.value("GsType").toString(); mVoltage = obj.value("Voltage").toInt(); mVoltageRange = obj.value("VoltageRange").toDouble(); mLost = obj.value("Lost").toDouble(); mVoltageType = static_cast<VOLTAGE_TYPE>( obj.value("VoltageType").toInt() ); mMaxWorkPressure = obj.value("MaxWorkPressure").toDouble(); mMinTestPressure = obj.value("MinTestPressure").toDouble(); mHermPressure = obj.value("HermPressure").toDouble(); mTestControlPressure = obj.value("TestControlPressure").toDouble(); mHermSignal = static_cast<CONTROL_SIGNAL>( obj.value("HermSignal").toDouble() ); mPABTSignal = static_cast<CONTROL_SIGNAL>( obj.value("PABTSignal").toInt() ); mPBATSignal = static_cast<CONTROL_SIGNAL>( obj.value("PBATSignal").toInt() ); mActuationOnTime = obj.value("ActuationOnTime").toDouble(); mActuationOffTime = obj.value("ActuationOffTime").toDouble(); mOnDD1A = obj.value("OnDD1A").toBool(); mOnDD2A = obj.value("OnDD2A").toBool();; mOnDD3A = obj.value("OnDD3A").toBool();; mOffDD1A = obj.value("OffDD1A").toBool();; mOffDD2A = obj.value("OffDD2A").toBool();; mOffDD3A = obj.value("OffDD3A").toBool();; mOnDD1B = obj.value("OnDD1B").toBool();; mOnDD2B = obj.value("OnDD2B").toBool();; mOnDD3B = obj.value("OnDD3B").toBool();; mOffDD1B = obj.value("OffDD1B").toBool();; mOffDD2B = obj.value("OffDD2B").toBool();; mOffDD3B = obj.value("OffDD3B").toBool();; mOnDynamic_1 = static_cast<DYNAMIC>( obj.value("OnDynamic_1").toInt() ); mOffDynamic_1 = static_cast<DYNAMIC>( obj.value("OffDynamic_1").toInt() ); mOnDynamic_2 = static_cast<DYNAMIC>( obj.value("OnDynamic_2").toInt() ); mOffDynamic_2 = static_cast<DYNAMIC>( obj.value("OffDynamic_2").toInt() ); ret = true; } else ret = false; return ret;}
开发者ID:firef0xff,项目名称:SSHGS01,代码行数:47,
示例14: clearvoid MindMap::readFromData(QJsonObject& obj){ clear(); QJsonArray rootListJson = obj["roots"].toArray(); for(auto it = rootListJson.begin(); it!=rootListJson.end(); ++it) { QJsonObject root = it->toObject(); Node* node=new Node(); addItem(node); node->readFromData(root); node->setPos(node->getX(),node->getY()); m_roots.append(node); }}
开发者ID:obiwankennedy,项目名称:rmindmap,代码行数:17,
示例15: as_object/// Construct an Array.///// This uses the _global Array class to initialize the "constructor" and/// "__proto__" properties. If Array.prototype is undefined, those properties/// are not added.as_object*Global_as::createArray(){ as_object* array = new as_object(*this); as_value ctor = getMember(*this, NSV::CLASS_ARRAY); as_object* obj = toObject(ctor, gnash::getVM(*this)); if (obj) { as_value proto; if (obj->get_member(NSV::PROP_PROTOTYPE, &proto)) { array->init_member(NSV::PROP_CONSTRUCTOR, ctor); array->set_prototype(getMember(*obj, NSV::PROP_PROTOTYPE)); } } array->init_member(NSV::PROP_LENGTH, 0.0); array->setArray(); return array;}
开发者ID:BrandRegard,项目名称:gnash,代码行数:24,
示例16: getPropertyNamesbool Dictionary::getPropertyNames(Vector<String>& names) const { v8::Local<v8::Object> object; if (!toObject(object)) return false; v8::Local<v8::Array> properties; if (!object->GetPropertyNames(v8Context()).ToLocal(&properties)) return false; for (uint32_t i = 0; i < properties->Length(); ++i) { v8::Local<v8::String> key; if (!propertyKey(v8Context(), properties, i, key)) continue; if (!v8CallBoolean(object->Has(v8Context(), key))) continue; TOSTRING_DEFAULT(V8StringResource<>, stringKey, key, false); names.append(stringKey); } return true;}
开发者ID:mirror,项目名称:chromium,代码行数:20,
示例17: switchJSValue* JSValue::getByIndex(ExecState* exec, unsigned propertyName) const{ switch (type()) { case StringType: { UString s = static_cast<const StringImp*>(asCell())->value(); if (propertyName < static_cast<unsigned>(s.size())) { return jsString(s.substr(propertyName, 1)); } // fall through } default: { JSObject* obj = toObject(exec); PropertySlot slot; if (obj->getPropertySlot(exec, propertyName, slot)) return slot.getValue(exec, obj, propertyName); return jsUndefined(); } }}
开发者ID:vasi,项目名称:kdelibs,代码行数:20,
示例18: HHVM_METHODstatic Variant HHVM_METHOD(Closure, call, const Variant& newthis, const Array& params) { if (newthis.isNull() || !newthis.isObject()) { raise_warning( "Closure::call() expects parameter 1 to be object, %s given", getDataTypeString(newthis.getType()).c_str() ); return init_null_variant; } // So, with bind/bindTo, if we are trying to bind an instance to a static // closure, we just raise a warning and continue on. However, with call // we are supposed to just return null (according to the PHP 7 implementation) // Here is that speciality check, then. Do it here so we don't have to go // through the rigormorale of binding if this is the case. if (this_->getVMClass()->getCachedInvoke()->isStatic()) { raise_warning("Cannot bind an instance to a static closure"); return init_null_variant; } auto bound = HHVM_MN(Closure, bindto)(this_, newthis, newthis); // If something went wrong in the binding (warning, for example), then // we can get an empty object back. And an empty object is null by // default. Return null if that is the case. if (bound.isNull()) { return init_null_variant; } // Could call vm_user_func(bound, params) here which goes through a // whole decode function process to get a Func*. But we know this // is a closure, and we can get a Func* via getInvokeFunc(), so just // bypass all that decode process to save time. return Variant::attach( g_context->invokeFunc(c_Closure::fromObject(this_)->getInvokeFunc(), params, bound.toObject().get(), nullptr, nullptr, nullptr, ExecutionContext::InvokeCuf, false, false) );}
开发者ID:fredemmott,项目名称:hhvm,代码行数:41,
示例19: switchZVariant ZVariant::operator[](const ZVariant &value) const{ switch (m_data->type) { case List: { bool ok = false; const ZVariant &val = toList().value(value.toInt(&ok)); if(!ok) return ZVariant(); else return val; } case Tuple: { bool ok; const ZVariant &val = *toTuple().value(value.toInt(&ok)); if(!ok) return ZVariant(); else return val; } case String: { bool ok; int index = value.toInt(&ok); const QString &str = toString(); if(!ok || index >= str.size()) return QString(); else return QString(str.at(index)); } case Function: case Object: return toObject()->property(value.toString().toLatin1().constData()); default: return Undefined; }}
开发者ID:zccrs,项目名称:zScript,代码行数:41,
示例20: QObjectRMProject::RMProject(const QJsonValueRef& json, RedMineManager* manager, QObject* parent): QObject(parent), m_manager(manager){ assert(json.isObject()); QJsonObject obj = json.toObject(); m_id = obj.value("id").toDouble(); m_createdOn = jsonDate(obj.value("created_on").toString()); m_updatedOn = jsonDate(obj.value("updated_on").toString()); m_identifier = obj.value("identifier").toString(); m_name = obj.value("name").toString(); m_description = obj.value("description").toString(); auto parentProj = obj.value("parent"); if (parentProj.isObject()) { m_parentProjectId = parentProj.toObject().value("id").toDouble(); }}
开发者ID:xvjau,项目名称:RedClient,代码行数:21,
示例21: CreateJsonFileForTestbool Parser::parseStations(QByteArray &data, QMap<QString,QString> &stations){ CreateJsonFileForTest(data,"test_StationReply.json"); QJsonDocument responce; responce = QJsonDocument::fromJson(data); if (responce.isObject()) { QJsonObject jsonobject = responce.object(); QJsonArray jsonStations = jsonobject["value"].toArray(); QJsonObject station; for(auto it2 = jsonStations.begin();it2 != jsonStations.end();++it2) { station = it2->toObject(); stations.insert(station["title"].toString(), station["station_id"].toString()); //stations.insert(station["title"].toString(), QString::number(station["station_id"].toInt())); // qDebug()<<"-- : "<< station["title"].toString()<<" "<<station["station_id"].toString(); } return true; } return false;}
开发者ID:dimininio,项目名称:TicketScanner,代码行数:21,
示例22: setBlendshapeCoefficientsvoid HeadData::fromJson(const QJsonObject& json) { if (json.contains(JSON_AVATAR_HEAD_BLENDSHAPE_COEFFICIENTS)) { auto jsonValue = json[JSON_AVATAR_HEAD_BLENDSHAPE_COEFFICIENTS]; if (jsonValue.isArray()) { QVector<float> blendshapeCoefficients; QJsonArray blendshapeCoefficientsJson = jsonValue.toArray(); for (const auto& blendshapeCoefficient : blendshapeCoefficientsJson) { blendshapeCoefficients.push_back((float)blendshapeCoefficient.toDouble()); setBlendshapeCoefficients(blendshapeCoefficients); } } else if (jsonValue.isObject()) { QJsonObject blendshapeCoefficientsJson = jsonValue.toObject(); for (const QString& name : blendshapeCoefficientsJson.keys()) { float value = (float)blendshapeCoefficientsJson[name].toDouble(); setBlendshape(name, value); } } else { qWarning() << "Unable to deserialize head json: " << jsonValue; } } if (json.contains(JSON_AVATAR_HEAD_ROTATION)) { setOrientation(quatFromJsonValue(json[JSON_AVATAR_HEAD_ROTATION])); } if (json.contains(JSON_AVATAR_HEAD_LEAN_FORWARD)) { setLeanForward((float)json[JSON_AVATAR_HEAD_LEAN_FORWARD].toDouble()); } if (json.contains(JSON_AVATAR_HEAD_LEAN_SIDEWAYS)) { setLeanSideways((float)json[JSON_AVATAR_HEAD_LEAN_SIDEWAYS].toDouble()); } if (json.contains(JSON_AVATAR_HEAD_LOOKAT)) { auto relativeLookAt = vec3FromJsonValue(json[JSON_AVATAR_HEAD_LOOKAT]); if (glm::length2(relativeLookAt) > 0.01f) { setLookAtPosition((_owningAvatar->getOrientation() * relativeLookAt) + _owningAvatar->getPosition()); } }}
开发者ID:zodsoft,项目名称:hifi,代码行数:38,
示例23: signupFailedvoid LoginDialog::signupFailed(QNetworkReply& reply) { // parse the returned JSON to see what the problem was auto jsonResponse = QJsonDocument::fromJson(reply.readAll()); static const QString RESPONSE_DATA_KEY = "data"; auto dataJsonValue = jsonResponse.object()[RESPONSE_DATA_KEY]; if (dataJsonValue.isObject()) { auto dataObject = dataJsonValue.toObject(); static const QString EMAIL_DATA_KEY = "email"; static const QString USERNAME_DATA_KEY = "username"; static const QString PASSWORD_DATA_KEY = "password"; QStringList errorStringList; if (dataObject.contains(EMAIL_DATA_KEY)) { errorStringList.append(QString("Email %1.").arg(errorStringFromAPIObject(dataObject[EMAIL_DATA_KEY]))); } if (dataObject.contains(USERNAME_DATA_KEY)) { errorStringList.append(QString("Username %1.").arg(errorStringFromAPIObject(dataObject[USERNAME_DATA_KEY]))); } if (dataObject.contains(PASSWORD_DATA_KEY)) { errorStringList.append(QString("Password %1.").arg(errorStringFromAPIObject(dataObject[PASSWORD_DATA_KEY]))); } emit handleSignupFailed(errorStringList.join('/n')); } else { static const QString DEFAULT_SIGN_UP_FAILURE_MESSAGE = "There was an unknown error while creating your account. Please try again later."; emit handleSignupFailed(DEFAULT_SIGN_UP_FAILURE_MESSAGE); }}
开发者ID:kitely,项目名称:hifiki,代码行数:38,
示例24: QUndoCommand//=================================================================================ModifyObjectCmd::ModifyObjectCmd(QJsonObject oldData, QJsonObject newData, ObjectItem* item, Modifications mod, QUndoCommand* parent) : QUndoCommand(parent), m_oldData(oldData), m_newData(oldData), // Set newData to oldData for the time being, update it later with the newData m_item(item), m_mod(mod){ // Overwrite the old data with the new data if available for (auto it = newData.constBegin(); it != newData.constEnd(); ++it) { if (it->isDouble()) m_newData[it.key()] = it->toDouble(); // This includes integers else if (it->isObject()) m_newData[it.key()] = it->toObject(); else if (it->isArray()) m_newData[it.key()] = it->toArray(); else if (it->isString()) m_newData[it.key()] = it->toString(); else if (it->isBool()) m_newData[it.key()] = it->toBool(); } // Set the type of modification for the data m_oldData["modifications"] = static_cast<int>(mod); m_newData["modifications"] = static_cast<int>(mod); setText(QObject::tr(qPrintable("Modify " + newData["type"].toString() + " " + newData["name"].toString())));}
开发者ID:gudajan,项目名称:Windsim,代码行数:24,
示例25: KJSValueToJSObjectUString UserObjectImp::toString(ExecState *exec) const{ UString result; JSUserObject* jsObjPtr = KJSValueToJSObject(toObject(exec), exec); CFTypeRef cfValue = jsObjPtr ? jsObjPtr->CopyCFValue() : 0; if (cfValue) { CFTypeID cfType = CFGetTypeID(cfValue); if (cfValue == GetCFNull()) { // } else if (cfType == CFBooleanGetTypeID()) { if (cfValue == kCFBooleanTrue) { result = "true"; } else { result = "false"; } } else if (cfType == CFStringGetTypeID()) { result = CFStringToUString((CFStringRef)cfValue); } else if (cfType == CFNumberGetTypeID()) { if (cfValue == kCFNumberNaN) { result = "Nan"; } else if (CFNumberCompare(kCFNumberPositiveInfinity, (CFNumberRef)cfValue, 0) == 0) { result = "Infinity"; } else if (CFNumberCompare(kCFNumberNegativeInfinity, (CFNumberRef)cfValue, 0) == 0) { result = "-Infinity"; } else { CFStringRef cfNumStr; double d = 0; CFNumberGetValue((CFNumberRef)cfValue, kCFNumberDoubleType, &d); if (CFNumberIsFloatType((CFNumberRef)cfValue)) { cfNumStr = CFStringCreateWithFormat(0, 0, CFSTR("%f"), d); } else { cfNumStr = CFStringCreateWithFormat(0, 0, CFSTR("%.0f"), d); } result = CFStringToUString(cfNumStr); ReleaseCFType(cfNumStr); } } else if (cfType == CFArrayGetTypeID()) { // } else if (cfType == CFDictionaryGetTypeID()) { // } else if (cfType == CFSetGetTypeID()) { // } else if (cfType == CFURLGetTypeID()) { CFURLRef absURL = CFURLCopyAbsoluteURL((CFURLRef)cfValue); if (absURL) { CFStringRef cfStr = CFURLGetString(absURL); if (cfStr) { result = CFStringToUString(cfStr); } ReleaseCFType(absURL); } } } ReleaseCFType(cfValue); if (jsObjPtr) jsObjPtr->Release(); return result;}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:88,
示例26: toObjectAJObject* AJCell::toThisObject(ExecState* exec) const{ return toObject(exec);}
开发者ID:PioneerLab,项目名称:OpenAphid-AJ,代码行数:4,
注:本文中的toObject函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ toPrettyChars函数代码示例 C++ toNumber函数代码示例 |