本文整理汇总了C++中MediaList::appendMedium方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaList::appendMedium方法的具体用法?C++ MediaList::appendMedium怎么用?C++ MediaList::appendMedium使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaList
的用法示例。
在下文中一共展示了MediaList::appendMedium方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsMediaListPrototypeFunctionAppendMedium
JSValue* jsMediaListPrototypeFunctionAppendMedium(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());
ExceptionCode ec = 0;
const UString& newMedium = args.at(exec, 0)->toString(exec);
imp->appendMedium(newMedium, ec);
setDOMException(exec, ec);
return jsUndefined();
}
示例2: appendMediumCallback
static v8::Handle<v8::Value> appendMediumCallback(const v8::Arguments& args)
{
INC_STATS("DOM.MediaList.appendMedium");
MediaList* imp = V8MediaList::toNative(args.Holder());
ExceptionCode ec = 0;
{
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, newMedium, args[0]);
imp->appendMedium(newMedium, ec);
if (UNLIKELY(ec))
goto fail;
return v8::Handle<v8::Value>();
}
fail:
V8Proxy::setDOMException(ec);
return v8::Handle<v8::Value>();
}
示例3: jsMediaListPrototypeFunctionAppendMedium
EncodedJSValue JSC_HOST_CALL jsMediaListPrototypeFunctionAppendMedium(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());
ExceptionCode ec = 0;
const String& newMedium(ustringToString(exec->argument(0).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
imp->appendMedium(newMedium, ec);
setDOMException(exec, ec);
return JSValue::encode(jsUndefined());
}
示例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;
}