本文整理汇总了C++中MediaList类的典型用法代码示例。如果您正苦于以下问题:C++ MediaList类的具体用法?C++ MediaList怎么用?C++ MediaList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MediaList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: jsMediaListLength
JSValue jsMediaListLength(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSMediaList* castedThis = static_cast<JSMediaList*>(asObject(slotBase));
UNUSED_PARAM(exec);
MediaList* imp = static_cast<MediaList*>(castedThis->impl());
JSValue result = jsNumber(imp->length());
return result;
}
示例3: jsMediaListMediaText
JSValue jsMediaListMediaText(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSMediaList* castedThis = static_cast<JSMediaList*>(asObject(slotBase));
UNUSED_PARAM(exec);
MediaList* imp = static_cast<MediaList*>(castedThis->impl());
JSValue result = jsStringOrNull(exec, imp->mediaText());
return result;
}
示例4: setJSMediaListMediaText
void setJSMediaListMediaText(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSMediaList* castedThis = static_cast<JSMediaList*>(thisObject);
MediaList* imp = static_cast<MediaList*>(castedThis->impl());
ExceptionCode ec = 0;
imp->setMediaText(valueToStringWithNullCheck(exec, value), ec);
setDOMException(exec, ec);
}
示例5: mediaTextAttrSetter
static void mediaTextAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.MediaList.mediaText._set");
MediaList* imp = V8MediaList::toNative(info.Holder());
V8Parameter<WithNullCheck> v = value;
ExceptionCode ec = 0;
imp->setMediaText(v, ec);
if (UNLIKELY(ec))
V8Proxy::setDOMException(ec);
return;
}
示例6: switch
void JSMediaList::putValueProperty(ExecState* exec, int token, JSValue* value)
{
switch (token) {
case MediaTextAttrNum: {
MediaList* imp = static_cast<MediaList*>(impl());
ExceptionCode ec = 0;
imp->setMediaText(valueToStringWithNullCheck(exec, value), ec);
setDOMException(exec, ec);
break;
}
}
}
示例7: 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;
}
示例8: 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();
}
示例9: main
int main (int argc, char * argv []) {
MediaList includeMedia;
myStderr = stderr;
printf ("MeMo Compiler v%s\n", VERSION);
setExePath (argv[0]);
if (argc < 2) { usage (argv[0]); }
if (strcmp (argv[1], "-d") ==0) {
dumpTable (argv[2]);
return (0);
}
if (strcmp (argv[1], "-b") ==0) {
ByteCode::generate (argv[2]);
return (0);
}
bool verbose = false;
int start = 1;
char * dir = (char *)".";
char * file = NULL;
while (start < argc) {
if (strcmp (argv[start], "-v") == 0) {
verbose = true;
} else if (strcmp (argv[start], "-s") == 0) {
myStderr = stdout;
} else if (strcmp (argv[start], "-o") == 0) {
start++;
dir = strdup (argv[start]);
} else if (strcmp (argv[start], "-I") == 0) {
start++;
MultiPathFile::addMultiplePaths (argv[start]);
} else if (strcmp (argv[start], "-i") == 0) {
start++;
includeMedia.addMedia (argv[start]);
} else if (strcmp (argv[start], "-h") ==0) {
usage (argv[0]);
return (0);
} else if (strcmp (argv[start], "--compat") == 0) {
ByteCode::s_compat = true;
} else if (strcmp (argv[start], "--ignore-new-paths") == 0) {
MultiPathFile::s_follow = false;
} else {
file = argv [start];
}
start++;
}
if (file != NULL && endsWith (file, "wrl")) {
compile (file, dir, includeMedia, verbose);
} else {
usage (argv[0]);
}
return (0);
}
示例10: 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);
}
示例11: 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());
}
示例12: 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>();
}
示例13: throwError
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;
}
示例14: compile
void compile (char * inName, char * dir, MediaList &includeMedia, bool verbose) {
char * orgName = inName;
MultiPathFile::addPath (inName, true); // main path is set as last path
int cd = open (".", O_RDONLY);
int i = lastIndexOf (inName, '/');
if (i >= 0) {
inName [i] = '\0';
chdir (inName);
//MultiPathFile::addPath (inName);
inName += i+1;
}
char * binName = strdup (inName);
strcpy (binName+strlen(binName)-3, "m4m");
printf ("compile %s -> %s/%s\n", orgName, dir, binName);
Scene scene (binName, verbose);
FILE * in = fopen (inName, "rb");
if (in == NULL) {
fprintf (myStderr, "cannot open %s", inName);
exit (1);
}
printf (">> Compiling scene %s\n", inName);
scene.parse (inName, in, verbose);
fchdir (cd);
char * outName = (char *)malloc (strlen (binName)+strlen(dir)+2);
sprintf (outName, "%s/%s", dir, binName);
FILE * out = fopen (outName, "wb");
if (out == NULL) {
fprintf (myStderr, "Cannot open %s for writing, please check if path exists\n", outName);
exit (1);
}
int total = includeMedia.dump (out);
total += scene.encode (out, verbose);
total += FontManager::dumpAll (execPath, out);
write (out, 0xFFFF); // final end of file
printf ("<< End of scene %s [%d B]\n", inName, total);
fclose (in);
fclose (out);
LocaleManager::checkMissingTranslations();
}
示例15: lengthAttrGetter
static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.MediaList.length._get");
MediaList* imp = V8MediaList::toNative(info.Holder());
return v8::Integer::NewFromUnsigned(imp->length());
}