本文整理汇总了C++中MediaList::item方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaList::item方法的具体用法?C++ MediaList::item怎么用?C++ MediaList::item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaList
的用法示例。
在下文中一共展示了MediaList::item方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: itemCallback
static v8::Handle<v8::Value> itemCallback(const v8::Arguments& args)
{
INC_STATS("DOM.MediaList.item");
MediaList* imp = V8MediaList::toNative(args.Holder());
EXCEPTION_BLOCK(unsigned, index, toUInt32(args[0]));
return v8StringOrNull(imp->item(index));
}
示例2: jsMediaListPrototypeFunctionItem
JSValue* jsMediaListPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSMediaList::s_info))
return throwError(exec, TypeError);
JSMediaList* castedThisObj = static_cast<JSMediaList*>(thisValue);
MediaList* imp = static_cast<MediaList*>(castedThisObj->impl());
unsigned index = args.at(exec, 0)->toInt32(exec);
JSC::JSValue* result = jsStringOrNull(exec, imp->item(index));
return result;
}
示例3: jsMediaListPrototypeFunctionItem
EncodedJSValue JSC_HOST_CALL jsMediaListPrototypeFunctionItem(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSMediaList::s_info))
return throwVMTypeError(exec);
JSMediaList* castedThis = static_cast<JSMediaList*>(asObject(thisValue));
MediaList* imp = static_cast<MediaList*>(castedThis->impl());
unsigned index(exec->argument(0).toUInt32(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = jsStringOrNull(exec, imp->item(index));
return JSValue::encode(result);
}
示例4: callAsFunction
JSValue* JSMediaListPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSMediaList::info))
return throwError(exec, TypeError);
JSMediaList* castedThisObj = static_cast<JSMediaList*>(thisObj);
MediaList* imp = static_cast<MediaList*>(castedThisObj->impl());
switch (id) {
case JSMediaList::ItemFuncNum: {
bool indexOk;
unsigned index = args[0]->toInt32(exec, indexOk);
if (!indexOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
}
KJS::JSValue* result = jsStringOrNull(imp->item(index));
return result;
}
case JSMediaList::DeleteMediumFuncNum: {
ExceptionCode ec = 0;
String oldMedium = args[0]->toString(exec);
imp->deleteMedium(oldMedium, ec);
setDOMException(exec, ec);
return jsUndefined();
}
case JSMediaList::AppendMediumFuncNum: {
ExceptionCode ec = 0;
String newMedium = args[0]->toString(exec);
imp->appendMedium(newMedium, ec);
setDOMException(exec, ec);
return jsUndefined();
}
}
return 0;
}