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


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

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


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

示例1: nextName

	// Iterator support - for in, for each
	Atom VectorBaseObject::nextName(int index)
	{
		AvmAssert(index > 0);
		if (((uint32)index) <= m_length)
		{
			AvmCore *core = this->core();
			return core->intToAtom(index-1);
		}
		else
		{
			return nullStringAtom;
		}
	}
开发者ID:weimingtom,项目名称:mod-actionscript,代码行数:14,代码来源:VectorClass.cpp

示例2: nextName

	// Iterator support - for in, for each
	Atom ArrayObject::nextName(int index)
	{
		AvmAssert(index > 0);

		int denseLength = (int)getDenseLength();
		if (index <= denseLength)
		{
			AvmCore *core = this->core();
 			return core->intToAtom(index-1);
		}
		else
		{
			return ScriptObject::nextName (index - denseLength);
		}
	}
开发者ID:weimingtom,项目名称:mod-actionscript,代码行数:16,代码来源:ArrayObject.cpp

示例3: getAtomProperty

	Atom ArrayObject::getAtomProperty(Atom name) const
	{
		if (traits()->needsHashtable())
		{
			AvmCore *core = this->core();
			if (hasDense())
			{
				uint32 index;
				if (AvmCore::getIndexFromAtom(name, &index))
				{
					// if we get here, we have a valid integer index.
					if ((index < getDenseLength()))
						return m_denseArr.getAtFast(index);
				}
			}

			if (name == core->klength->atom())
				return core->intToAtom (getLength());
		}

		return ScriptObject::getAtomProperty(name);
	}
开发者ID:weimingtom,项目名称:mod-actionscript,代码行数:22,代码来源:ArrayObject.cpp

示例4: _exec

    ArrayObject* RegExpObject::_exec(Stringp subject, 
									UTF8String *utf8Subject,
									int startIndex,
									int& matchIndex,
									int& matchLen)
	{
		AvmAssert(subject != NULL);
		AvmAssert(utf8Subject != NULL);
		
		int ovector[OVECTOR_SIZE];
		int results;
		int subjectLength = utf8Subject->length();

		if( startIndex < 0 ||
			startIndex > subjectLength ||
			(results = pcre_exec((pcre*)m_pcreInst,
								NULL,
								utf8Subject->c_str(),
								subjectLength,
								startIndex,
								PCRE_NO_UTF8_CHECK,
								ovector,
								OVECTOR_SIZE)) < 0)
		{
			matchIndex = 0;
			matchLen = 0;
			return NULL;
		}

		AvmCore *core = this->core();
		ArrayObject *a = toplevel()->arrayClass->newArray(results);

		a->setAtomProperty(toplevel()->regexpClass()->kindex,
			   core->intToAtom(Utf8ToUtf16Index(subject, utf8Subject, ovector[0])));
		a->setAtomProperty(toplevel()->regexpClass()->kinput,
			   subject->atom());
		a->setLength(results);

		// set array slots
		for (int i=0; i<results; i++) {
			if (ovector[i*2] > -1) {
				int length = ovector[i*2 + 1] - ovector[i*2];
				Atom match = stringFromUTF8(utf8Subject->c_str()+ovector[i*2], length);
				a->setUintProperty(i, match);
			} else {
				a->setUintProperty(i, undefinedAtom);
			}
		}

		// handle named groups
		if (m_hasNamedGroups)
		{
			int entrySize;
			pcre_fullinfo((pcre*)m_pcreInst, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrySize);
	 
			int nameCount;
			pcre_fullinfo((pcre*)m_pcreInst, NULL, PCRE_INFO_NAMECOUNT, &nameCount);
	 
			// this space is freed when (pcre*)m_pcreInst is freed 
			char *nameTable;
			pcre_fullinfo((pcre*)m_pcreInst, NULL, PCRE_INFO_NAMETABLE, &nameTable);
	 
			/* nameTable is a series of fixed length entries (entrySize) 
			   the first two bytes are the index into the ovector and the result
			   is a null terminated string (the subgroup name) */
			for (int i = 0; i < nameCount; i++)
			{
				int nameIndex, length;
				nameIndex = (nameTable[0] << 8) + nameTable[1];
				length = ovector[nameIndex * 2 + 1] - ovector[ nameIndex * 2 ];

				Atom name = stringFromUTF8((char*)(nameTable+2), (uint32)strlen(nameTable+2));
				name = core->internString(name)->atom();

				Atom value = stringFromUTF8(utf8Subject->c_str()+ovector[nameIndex*2], length);

				a->setAtomProperty(name, value);

				nameTable += entrySize;
			}
		}
		
		matchIndex = ovector[0];
		matchLen = ovector[1]-ovector[0];

		return a;
	}
开发者ID:PushButtonLabs,项目名称:PBNetworking,代码行数:87,代码来源:RegExpObject.cpp


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