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


C++ AvmCore::newNamespace方法代码示例

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


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

示例1: construct

    // this = argv[0] (ignored)
    // arg1 = argv[1]
    // argN = argv[argc]
    Atom NamespaceClass::construct(int argc, Atom* argv)
    {
        AvmCore* core = this->core();

        // See E4X 13.2.2, pg 65
        if (argc < 1)
            return core->newNamespace(core->kEmptyString->atom())->atom();
        else if (argc == 1)
            return core->newNamespace(argv[1])->atom();
        else
        {
            // Rhino throws an error when prefix is specified and uri is not a valid string
            String *p = core->string (argv[1]);
            String *u = core->string (argv[2]);
            if (p->length() && !u->length())
            {
                toplevel()->throwTypeError(kXMLNamespaceWithPrefixAndNoURI, p);
            }

            return core->newNamespace(argv[1], argv[2])->atom();
        }
    }
开发者ID:AdiKo,项目名称:avmplus,代码行数:25,代码来源:NamespaceClass.cpp

示例2: getClass

	ClassClosure* DomainObject::getClass(Stringp name)
	{
		AvmCore *core = this->core();

		if (name == NULL) {
			toplevel()->throwArgumentError(kNullArgumentError, core->toErrorString("name"));
		}

			
		// Search for a dot from the end.
        int dot = name->lastIndexOf(core->cachedChars[(int)'.']);
		
		// If there is a '.', this is a fully-qualified
		// class name in a package.  Must turn it into
		// a namespace-qualified multiname.
		Namespace* ns;
		Stringp className;
		if (dot >= 0) {
            Stringp uri = core->internString(name->substring(0, dot));
			ns = core->internNamespace(core->newNamespace(uri));
            className = core->internString(name->substring(dot+1, name->length()));
		} else {
			ns = core->publicNamespace;
			className = core->internString(name);
		}

		Multiname multiname(ns, className);

        // OOO: In the distribution, we search core->codeContext()->domainEnv rather than
        // our own domainEnv, which is surely a bug?
        ScriptObject *container = finddef(multiname, domainEnv);
		if (!container) {
			toplevel()->throwTypeError(kClassNotFoundError, core->toErrorString(&multiname));
		}
		Atom atom = toplevel()->getproperty(container->atom(),
											&multiname,
											container->vtable);

		if (!AvmCore::istype(atom, core->traits.class_itraits)) {
			toplevel()->throwTypeError(kClassNotFoundError, core->toErrorString(&multiname));
		}
		return (ClassClosure*)AvmCore::atomToScriptObject(atom);
	}
开发者ID:FlowShift,项目名称:thane,代码行数:43,代码来源:DomainClass.cpp

示例3: construct

	// E4X 13.3.2, page 67
	Atom QNameClass::construct(int argc, Atom* argv)
	{
		AvmCore* core = this->core();

		if (argc == 0)
			return (new (core->GetGC(), ivtable()->getExtraSize()) QNameObject(this, undefinedAtom))->atom();

		if (argc == 1)
		{
			if (core->isObject(argv[1]) && AvmCore::istype(argv[1], core->traits.qName_itraits))
				return argv[1];

			return (new (core->GetGC(), ivtable()->getExtraSize()) QNameObject(this, argv[1]))->atom();
		}
		else
		{
			Atom a = argv[1];
			if (a == undefinedAtom)
			{
				// ns undefined same as unspecified
				return (new (core->GetGC(), ivtable()->getExtraSize()) QNameObject(this, argv[2]))->atom();
			}
			else
			{
				Namespace* ns;
				if (AvmCore::isNull(a))
					ns = NULL;
				// It's important to preserve the incoming namespace because it's type
				// may not be public.  I.E...
				// namespace ns;
				// q = new QName(ns, "name"); // ns is a NS_PackageInternal ns
				// If we ever use this QName as a multiname, we need to preserve the exact ns
				else if (core->isNamespace(a))
					ns = core->atomToNamespace(a);				
				else
					ns = core->newNamespace (a);
				return (new (core->GetGC(), ivtable()->getExtraSize()) QNameObject(this, ns, argv[2]))->atom();
			}
		}
	}
开发者ID:hgl888,项目名称:nashtest,代码行数:41,代码来源:XMLClass.cpp


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