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


C++ MethodList类代码示例

本文整理汇总了C++中MethodList的典型用法代码示例。如果您正苦于以下问题:C++ MethodList类的具体用法?C++ MethodList怎么用?C++ MethodList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Undefined

Value RuntimeObjectImp::get(ExecState *exec, const Identifier &propertyName) const
{
    Value result = Undefined();

    instance->begin();
    
    Class *aClass = instance->getClass();
    
    if (aClass) {
        
        // See if the instance have a field with the specified name.
        Field *aField = aClass->fieldNamed(propertyName.ascii(), instance);
        if (aField) {
            result = instance->getValueOfField (exec, aField); 
        }
        else {
            // Now check if a method with specified name exists, if so return a function object for
            // that method.
            MethodList methodList = aClass->methodsNamed(propertyName.ascii(), instance);
            if (methodList.length() > 0) {
                result = Object (new RuntimeMethodImp(exec, propertyName, methodList));
            }
        }
	
        if (result.type() == UndefinedType) {
            // Try a fallback object.
            result = aClass->fallbackObject (exec, instance, propertyName);
        }
    }
        
    instance->end();

    
    return result;
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:35,代码来源:runtime_object.cpp

示例2: methodsNamed

MethodList BalClass::methodsNamed(const Identifier& identifier, Instance* instance) const
{
    MethodList methodList;

    Method* method = m_methods.get(identifier.ustring().rep());
    if (method) {
        methodList.append(method);
        return methodList;
    }

    const char *ident = identifier.ascii();
    const BalInstance* inst = static_cast<const BalInstance*>(instance);
    BalObject* obj = inst->getObject();
    if( obj->hasMethod( ident ) )
    {
        Method* aMethod = new BalMethod(ident); // deleted in the CClass destructor
        {
            JSLock lock(false);
            m_methods.set(identifier.ustring().rep(), aMethod);
        }
        methodList.append(aMethod);
    }

    return methodList;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:25,代码来源:bal_class.cpp

示例3: methodsNamed

MethodList EAClass::methodsNamed(const Identifier& identifier, Instance* instance) const
{
    MethodList methodList;

    // Check to see if the method has been cached first.
    Method* method = mMethods.get(identifier.impl());
    if (method) 
    {
        methodList.append(method);
        return methodList;
    }

    // Method hasn't been called before, see if the object supports it.
    // Rather than doing identifier.ascii().data(), we need to create CString separately otherwise it goes out of scope.
	CString identStr = identifier.ascii();
	const char *ident = identStr.data(); 

    const EAInstance *inst = static_cast<const EAInstance*>(instance);
    EA::WebKit::IJSBoundObject *obj = inst->getObject();
    if (obj->hasMethod(ident)) 
    {
        // The object says it has this method, cache it so that the string
        // lookup can be avoided in the future.
        EAMethod* aMethod = new EAMethod(ident);
        {
            JSLock lock(SilenceAssertionsOnly);
            mMethods.set(identifier.impl(), aMethod);
        }
        methodList.append(aMethod);
    }

    return methodList;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:33,代码来源:ea_class.cpp

示例4: methodsNamed

MethodList BalClass::methodsNamed(const Identifier& identifier, Instance* instance) const
{
    MethodList methodList;

    Method* method = m_methods.get(identifier.ustring().rep());
    if (method) {
        methodList.append(method);
        return methodList;
    }

	const UChar* ident16 = identifier.ustring().data();
	char ident[256];
	sprintf(ident,"%S",ident16);
	ident[identifier.ustring().size()] = '\0';

    const BalInstance* inst = static_cast<const BalInstance*>(instance);
    BalObject* obj = inst->getObject();
    if( obj->hasMethod( ident ) )
    {
        BalMethod *aMethod= new BalMethod(obj, 0, ident, 0);
        m_methods.set(identifier.ustring().rep(), aMethod);
        methodList.append(aMethod);
    }

    return methodList;
}
开发者ID:GRGSIBERIA,项目名称:EAWebKit,代码行数:26,代码来源:bal_class.cpp

示例5: LOG_ERROR

JavaClass::JavaClass(jobject anInstance)
{
    jobject aClass = callJNIMethod<jobject>(anInstance, "getClass", "()Ljava/lang/Class;");

    if (!aClass) {
        LOG_ERROR("Unable to call getClass on instance %p", anInstance);
        m_name = fastStrDup("<Unknown>");
        return;
    }

    if (jstring className = (jstring)callJNIMethod<jobject>(aClass, "getName", "()Ljava/lang/String;")) {
        const char* classNameC = getCharactersFromJString(className);
        m_name = fastStrDup(classNameC);
        releaseCharactersForJString(className, classNameC);
    } else
        m_name = fastStrDup("<Unknown>");

    int i;
    JNIEnv* env = getJNIEnv();

    // Get the fields
    if (jarray fields = (jarray)callJNIMethod<jobject>(aClass, "getFields", "()[Ljava/lang/reflect/Field;")) {
        int numFields = env->GetArrayLength(fields);
        for (i = 0; i < numFields; i++) {
            jobject aJField = env->GetObjectArrayElement((jobjectArray)fields, i);
            JavaField* aField = new JavaField(env, aJField); // deleted in the JavaClass destructor
            {
                JSLock lock(SilenceAssertionsOnly);
                m_fields.set(((UString)aField->name()).rep(), aField);
            }
            env->DeleteLocalRef(aJField);
        }
        env->DeleteLocalRef(fields);
    }

    // Get the methods
    if (jarray methods = (jarray)callJNIMethod<jobject>(aClass, "getMethods", "()[Ljava/lang/reflect/Method;")) {
        int numMethods = env->GetArrayLength(methods);
        for (i = 0; i < numMethods; i++) {
            jobject aJMethod = env->GetObjectArrayElement((jobjectArray)methods, i);
            JavaMethod* aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor
            MethodList* methodList;
            {
                JSLock lock(SilenceAssertionsOnly);

                methodList = m_methods.get(((UString)aMethod->name()).rep());
                if (!methodList) {
                    methodList = new MethodList();
                    m_methods.set(((UString)aMethod->name()).rep(), methodList);
                }
            }
            methodList->append(aMethod);
            env->DeleteLocalRef(aJMethod);
        }
        env->DeleteLocalRef(methods);
    }

    env->DeleteLocalRef(aClass);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:59,代码来源:JavaClassJSC.cpp

示例6: assert

void Package::addMethod(Method *mtd)
{
	assert(mtd && "ERROR!!: Method is NULL\n");
	MethodList *list = (mtds->exists(mtd->subname)) ?
		mtds->get(mtd->subname) : new MethodList();
	list->add(mtd);
	mtds->add(MethodMap::value_type(mtd->subname, list));
}
开发者ID:goccy,项目名称:p5-Test-AutoGenerator,代码行数:8,代码来源:package.cpp

示例7: m_requireAnnotation

JavaClassJobject::JavaClassJobject(jobject anInstance, bool requireAnnotation)
    : m_requireAnnotation(requireAnnotation)
#else
JavaClassJobject::JavaClassJobject(jobject anInstance)
#endif
{
    jobject aClass = callJNIMethod<jobject>(anInstance, "getClass", "()Ljava/lang/Class;");

    if (!aClass) {
        LOG_ERROR("unable to call getClass on instance %p", anInstance);
        return;
    }

    JNIEnv* env = getJNIEnv();

    // Get the fields
    jarray fields = static_cast<jarray>(callJNIMethod<jobject>(aClass, "getFields", "()[Ljava/lang/reflect/Field;"));
    int numFields = env->GetArrayLength(fields);
    for (int i = 0; i < numFields; i++) {
        jobject aJField = env->GetObjectArrayElement(static_cast<jobjectArray>(fields), i);
        JavaField* aField = new JavaFieldJobject(env, aJField); // deleted in the JavaClass destructor
        m_fields.set(aField->name(), aField);
        env->DeleteLocalRef(aJField);
    }

    // Get the methods
    jarray methods = static_cast<jarray>(callJNIMethod<jobject>(aClass, "getMethods", "()[Ljava/lang/reflect/Method;"));
    int numMethods = env->GetArrayLength(methods);
#if PLATFORM(ANDROID)
    jmethodID isAnnotationPresentMethodID = getAnnotationMethodID(env);
    if (!isAnnotationPresentMethodID) {
        LOG_ERROR("unable to find method %s on instance %p", kIsAnnotationPresent, anInstance);
        return;
    }
#endif
    for (int i = 0; i < numMethods; i++) {
        jobject aJMethod = env->GetObjectArrayElement(static_cast<jobjectArray>(methods), i);
#if PLATFORM(ANDROID)
        if (jsAccessAllowed(env, isAnnotationPresentMethodID, aJMethod)) {
#endif
            JavaMethod* aMethod = new JavaMethodJobject(env, aJMethod); // deleted in the JavaClass destructor
            MethodList* methodList = m_methods.get(aMethod->name());
            if (!methodList) {
                methodList = new MethodList();
                m_methods.set(aMethod->name(), methodList);
            }
            methodList->append(aMethod);
#if PLATFORM(ANDROID)
        }
#endif
        env->DeleteLocalRef(aJMethod);
    }
    env->DeleteLocalRef(fields);
    env->DeleteLocalRef(methods);
    env->DeleteLocalRef(aClass);
}
开发者ID:wufuyue,项目名称:TCL_S820,代码行数:56,代码来源:JavaClassJobjectV8.cpp

示例8: methodsNamed

MethodList QtPixmapClass::methodsNamed(const Identifier& identifier, Instance*) const
{
    MethodList methods;
    if (identifier == QtPixmapToDataUrlMethod::name())
        methods.append(&qt_pixmap_metaData.toDataUrlMethod);
    else if (identifier == QtPixmapAssignToElementMethod::name())
        methods.append(&qt_pixmap_metaData.assignToElementMethod);
    else if (identifier == QtPixmapToStringMethod::name())
        methods.append(&qt_pixmap_metaData.toStringMethod);
    return methods;
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:11,代码来源:qt_pixmapruntime.cpp

示例9: fprintf

JavaClass::JavaClass(jobject anInstance)
{
    jobject aClass = callJNIMethod<jobject>(anInstance, "getClass", "()Ljava/lang/Class;");
    
    if (!aClass) {
        fprintf(stderr, "%s:  unable to call getClass on instance %p\n", __PRETTY_FUNCTION__, anInstance);
        return;
    }
    
    jstring className = (jstring)callJNIMethod<jobject>(aClass, "getName", "()Ljava/lang/String;");
    const char *classNameC = getCharactersFromJString(className);
    _name = strdup(classNameC);
    releaseCharactersForJString(className, classNameC);

    int i;
    JNIEnv *env = getJNIEnv();

    JSGlobalData* globalData = WebCore::JSDOMWindow::commonJSGlobalData();
    
    // Get the fields
    jarray fields = (jarray)callJNIMethod<jobject>(aClass, "getFields", "()[Ljava/lang/reflect/Field;");
    int numFields = env->GetArrayLength(fields);    
    for (i = 0; i < numFields; i++) {
        jobject aJField = env->GetObjectArrayElement((jobjectArray)fields, i);
        Field *aField = new JavaField(env, aJField); // deleted in the JavaClass destructor
        {
            JSLock lock(false);
            _fields.set(Identifier(globalData, UString(aField->name())).ustring().rep(), aField);
        }
        env->DeleteLocalRef(aJField);
    }

    // Get the methods
    jarray methods = (jarray)callJNIMethod<jobject>(aClass, "getMethods", "()[Ljava/lang/reflect/Method;");
    int numMethods = env->GetArrayLength(methods);
    for (i = 0; i < numMethods; i++) {
        jobject aJMethod = env->GetObjectArrayElement((jobjectArray)methods, i);
        Method *aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor
        MethodList* methodList;
        {
            JSLock lock(false);

            methodList = _methods.get(Identifier(globalData, UString(aMethod->name())).ustring().rep());
            if (!methodList) {
                methodList = new MethodList();
                _methods.set(Identifier(globalData, UString(aMethod->name())).ustring().rep(), methodList);
            }
        }
        methodList->append(aMethod);
        env->DeleteLocalRef(aJMethod);
    }    
}
开发者ID:acss,项目名称:owb-mirror,代码行数:52,代码来源:jni_class.cpp

示例10:

Method *Package::getMethod(const char *mtd_name)
{
	if (!mtds->size()) return NULL;
	MethodList *list = mtds->get(mtd_name);
	MethodList::reverse_iterator it = list->rbegin();
	Method *mtd = NULL;
	while (it != list->rend()) {
		mtd = *it;
		if (!mtd->ret) return mtd;
		it++;
	}
	return mtd;
}
开发者ID:goccy,项目名称:p5-Test-AutoGenerator,代码行数:13,代码来源:package.cpp

示例11: methodsNamed

MethodList QtPixmapClass::methodsNamed(PropertyName identifier, Instance*) const
{
    MethodList methods;
    UString ustring(identifier.publicName());
    if (ustring == QtPixmapToDataUrlMethod::name())
        methods.append(&qt_pixmap_metaData.toDataUrlMethod);
    else if (ustring == QtPixmapToImageDataMethod::name())
        methods.append(&qt_pixmap_metaData.toImageDataMethod);
    else if (ustring == QtPixmapAssignToElementMethod::name())
        methods.append(&qt_pixmap_metaData.assignToElementMethod);
    else if (ustring == QtPixmapToStringMethod::name())
        methods.append(&qt_pixmap_metaData.toStringMethod);
    return methods;
}
开发者ID:dzhshf,项目名称:WebKit,代码行数:14,代码来源:qt_pixmapruntime.cpp

示例12: getJNIEnv

void JavaClass::_commonInit (jobject aClass)
{
    long i;

    JNIEnv *env = getJNIEnv();
    
    // Get the fields
    jarray fields = (jarray)callJNIObjectMethod (aClass, "getFields", "()[Ljava/lang/reflect/Field;");
    long numFields = env->GetArrayLength (fields);    
    _fields = CFDictionaryCreateMutable(NULL, numFields, &kCFTypeDictionaryKeyCallBacks, NULL);
    for (i = 0; i < numFields; i++) {
        jobject aJField = env->GetObjectArrayElement ((jobjectArray)fields, i);
        Field *aField = new JavaField (env, aJField);
        CFStringRef fieldName = CFStringCreateWithCString(NULL, aField->name(), kCFStringEncodingASCII);
        CFDictionaryAddValue ((CFMutableDictionaryRef)_fields, fieldName, aField);
        CFRelease (fieldName);
        env->DeleteLocalRef (aJField);
    }
    
    // Get the methods
    jarray methods = (jarray)callJNIObjectMethod (aClass, "getMethods", "()[Ljava/lang/reflect/Method;");
    long numMethods = env->GetArrayLength (methods);    
    _methods = CFDictionaryCreateMutable(NULL, numMethods, &kCFTypeDictionaryKeyCallBacks, NULL);
    for (i = 0; i < numMethods; i++) {
        jobject aJMethod = env->GetObjectArrayElement ((jobjectArray)methods, i);
        Method *aMethod = new JavaMethod (env, aJMethod);
        CFStringRef methodName = CFStringCreateWithCString(NULL, aMethod->name(), kCFStringEncodingASCII);
        MethodList *methodList = (MethodList *)CFDictionaryGetValue ((CFMutableDictionaryRef)_methods, methodName);
        if (!methodList) {
            methodList = new MethodList();
            CFDictionaryAddValue ((CFMutableDictionaryRef)_methods, methodName, methodList);
        }
        methodList->addMethod (aMethod);
        CFRelease (methodName);
        env->DeleteLocalRef (aJMethod);
    }

    // Get the constructors
    jarray constructors = (jarray)callJNIObjectMethod (aClass, "getConstructors", "()[Ljava/lang/reflect/Constructor;");
    _numConstructors = env->GetArrayLength (constructors);    
    _constructors = new JavaConstructor[_numConstructors];
    for (i = 0; i < _numConstructors; i++) {
        jobject aConstructor = env->GetObjectArrayElement ((jobjectArray)constructors, i);
        _constructors[i] = JavaConstructor (env, aConstructor);
        env->DeleteLocalRef (aConstructor);
    }
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:47,代码来源:jni_class.cpp

示例13: throwInvalidAccessError

bool RuntimeObject::getOwnPropertySlot(JSCell* cell, ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
    RuntimeObject* thisObject = static_cast<RuntimeObject*>(cell);
    if (!thisObject->m_instance) {
        throwInvalidAccessError(exec);
        return false;
    }
    
    RefPtr<Instance> instance = thisObject->m_instance;

    instance->begin();
    
    Class *aClass = instance->getClass();
    
    if (aClass) {
        // See if the instance has a field with the specified name.
        Field *aField = aClass->fieldNamed(propertyName, instance.get());
        if (aField) {
            slot.setCustom(thisObject, thisObject->fieldGetter);
            instance->end();
            return true;
        } else {
            // Now check if a method with specified name exists, if so return a function object for
            // that method.
            MethodList methodList = aClass->methodsNamed(propertyName, instance.get());
            if (methodList.size() > 0) {
                slot.setCustom(thisObject, thisObject->methodGetter);
                
                instance->end();
                return true;
            }
        }

        // Try a fallback object.
        if (!aClass->fallbackObject(exec, instance.get(), propertyName).isUndefined()) {
            slot.setCustom(thisObject, thisObject->fallbackObjectGetter);
            instance->end();
            return true;
        }
    }
        
    instance->end();
    
    return instance->getOwnPropertySlot(thisObject, exec, propertyName, slot);
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:45,代码来源:runtime_object.cpp

示例14: throwInvalidAccessError

bool RuntimeObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
    if (!instance) {
        throwInvalidAccessError(exec);
        return false;
    }
    
    instance->begin();
    
    Class *aClass = instance->getClass();
    
    if (aClass) {
        // See if the instance has a field with the specified name.
        Field *aField = aClass->fieldNamed(propertyName, instance.get());
        if (aField) {
            slot.setCustom(this, fieldGetter);
            instance->end();
            return true;
        } else {
            // Now check if a method with specified name exists, if so return a function object for
            // that method.
            MethodList methodList = aClass->methodsNamed(propertyName, instance.get());
            if (methodList.size() > 0) {
                slot.setCustom(this, methodGetter);
                
                instance->end();
                return true;
            }
        }

        // Try a fallback object.
        if (!aClass->fallbackObject(exec, instance.get(), propertyName)->isUndefined()) {
            slot.setCustom(this, fallbackObjectGetter);
            instance->end();
            return true;
        }
    }
        
    instance->end();

    // don't call superclass, because runtime objects can't have custom properties or a prototype
    return false;
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:43,代码来源:runtime_object.cpp

示例15: release

LuaExportTypeDescriptor::~LuaExportTypeDescriptor()
{
    //释放类方法
    for (MethodMap::iterator it = _classMethods.begin(); it != _classMethods.end(); it++)
    {
        MethodList methodList = it -> second;
        for (MethodList::iterator mit = methodList.begin(); mit != methodList.end(); mit++)
        {
            (*mit) -> release();
        }
    }
    
    //释放实例方法
    for (MethodMap::iterator it = _instanceMethods.begin(); it != _instanceMethods.end(); it++)
    {
        MethodList methodList = it -> second;
        for (MethodList::iterator mit = methodList.begin(); mit != methodList.end(); mit++)
        {
            (*mit) -> release();
        }
    }
    
    //释放属性
    for (PropertyMap::iterator it = _properties.begin(); it != _properties.end(); it++)
    {
        it -> second -> release();
    }
}
开发者ID:vimfung,项目名称:LuaScriptCore,代码行数:28,代码来源:LuaExportTypeDescriptor.cpp


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