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


C++ Toplevel::stringClass方法代码示例

本文整理汇总了C++中Toplevel::stringClass方法的典型用法代码示例。如果您正苦于以下问题:C++ Toplevel::stringClass方法的具体用法?C++ Toplevel::stringClass怎么用?C++ Toplevel::stringClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Toplevel的用法示例。


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

示例1: if

    ClassClosure *SamplerScript::getType(Toplevel* ss_toplevel, SamplerObjectType sot, const void *ptr)
    {
        Toplevel* tl;

        switch (sotGetKind(sot))
        {
            case kSOT_String:
            {
                // toplevel can be null here if there was no CodeContext active
                // when the sample was taken (ie, string was allocated from C++ code).
                // in that case, use the TL from the SamplerScript itself... it isn't
                // technically the right one to use, but is adequate for our purposes here
                // (it will return a stringClass or namespaceClass that will be valid
                // for the sampler)
                tl = sotGetToplevel(sot);
                if (!tl) tl = ss_toplevel;
                return tl->stringClass();
            }
            case kSOT_Namespace:
            {
                tl = sotGetToplevel(sot);
                if (!tl) tl = ss_toplevel;
                return tl->namespaceClass();
            }
            default:
                AvmAssert(0);
            case kSOT_Object:
                break;
        }

        VTable* vt = sotGetVTable(sot);
        tl = vt->toplevel();
        AvmCore* core = tl->core();

        ClassClosure *type;
        ScriptObject* obj = (ScriptObject*)ptr;
        if (obj && AvmCore::istype(obj->atom(), core->traits.class_itraits))
        {
            type = tl->classClass();
        }
        else if (obj && AvmCore::istype(obj->atom(), core->traits.function_itraits))
        {
            type = tl->functionClass();
        }
        else if (obj && obj->traits()->isActivationTraits())
        {
            type = tl->objectClass;
        }
        else
        {
            // fallback answer
            type = tl->objectClass;

            // note that note all types will have an init method,
            // so those types may get reported as "objectClass" rather
            // than something more specific. However, it's not clear
            // that the Sampler ever really cared about reporting those
            // objects well in the first place (eg activation or catch objects),
            // so it doesn't seem we're a lot worse off than before.
            ScopeChain* sc = NULL;
            if (vt->init)
                sc = vt->init->scope();

            if (sc && sc->getSize() <= 1)
            {
                if(sc->getSize() == 1)
                    type = tl->classClass();
            }
            else if (sc)
            {
                Atom ccAtom = sc->getScope(sc->getSize()-1);
                if(AvmCore::isObject(ccAtom))
                {
                    type = (ClassClosure*) AvmCore::atomToScriptObject(ccAtom);
                    if(!AvmCore::istype(type->atom(), core->traits.class_itraits))
                    {
                        // obj is a ClassClosure
                        type = tl->classClass();
                    }
                }
            }
        }
        AvmAssert(AvmCore::istype(type->atom(), core->traits.class_itraits));
        return type;
    }
开发者ID:DaZhu,项目名称:crossbridge,代码行数:85,代码来源:SamplerScript.cpp


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