• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ resolveReference函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: codeLength

	void Loader::loadCode(const char *entryLabel)
	{
		int length = codeLength() + 64;   // NOTE: Code length is not accurate due to alignment issues

		machineCode = new unsigned char[length];
		unsigned char *currentCode = machineCode;

		#ifdef WIN32
			unsigned long oldProtection;
			VirtualProtect(machineCode, length, PAGE_EXECUTE_READWRITE, &oldProtection);
		#elif __unix__
			mprotect(machineCode, length, PROT_READ | PROT_WRITE | PROT_EXEC);
		#endif

		Instruction *instruction = instructions;

		while(instruction)
		{
			Encoding &encoding = *instruction;
			encoding.setAddress(currentCode);
			const char *reference = encoding.getReference();
			const char *label = encoding.getLabel();

			if(reference)
			{
				if(encoding.relativeReference())
				{
					int offset = resolveReference(reference, instruction) - currentCode - encoding.length(currentCode);
					encoding.setJumpOffset(offset);
				}
				else
				{
					int address = (int)resolveReference(reference, instruction);

					// Encoded as memory reference or immediate?
					if(encoding.hasDisplacement())
					{
						encoding.addDisplacement(address);
					}
					else if(encoding.hasImmediate())
					{
						encoding.setImmediate(address);
					}
					else
					{
						INTERNAL_ERROR;
					}
				}
			}
			else if(encoding.hasImmediate() && encoding.relativeReference())
			{
				int offset = encoding.getImmediate() - (int)currentCode - encoding.length(currentCode);
				encoding.setCallOffset(offset);
			}

			currentCode += encoding.writeCode(currentCode);

			instruction = instruction->next();
		}
	}
开发者ID:XhmikosR,项目名称:avisynth-mt,代码行数:60,代码来源:Loader.cpp


示例2: parseSlotValue

RDF_Error
parseSlotValue (RDFFile f, RDF_Resource s, char* value, void** parsed_value, RDF_ValueType* data_type)
{
  if (value[0] == '"') {
    int32 size = strlen(value)-1;
    *parsed_value = getMem(size);
    value[size]  = '\0';
    *parsed_value = &value[1];
    *data_type = RDF_STRING_TYPE;
    return noRDFErr;
  } else if (value[0] == '#') {
    if (value[1] == '"') {
      value[strlen(value)-1] = '\0';
      value = &value[2];
    } else {
      value = &value[1];
    }
    *parsed_value = resolveReference(value, f);
    return noRDFErr;
  } else if (charSearch('.', value) == -1) {
    int16 ans = 0;
    /* XXX		sscanf(value, "%ld", &ans); */
    *data_type = RDF_INT_TYPE;
    return noRDFErr;
  } else {
    return -1;
  }
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:28,代码来源:mcff2mcf.c


示例3: resolveReference

void PdfBookReader::processPage(shared_ptr<PdfObject> pageObject, ZLInputStream &stream) {
	pageObject = resolveReference(pageObject, stream);
	if (pageObject.isNull() || pageObject->type() != PdfObject::DICTIONARY) {
		return;
	}
	const PdfDictionaryObject &pageDictionary = (const PdfDictionaryObject&)*pageObject;
	shared_ptr<PdfObject> contents = pageDictionary["Contents"];
	if (contents.isNull()) {
		return;
	}
	switch (contents->type()) {
		default:
			break;
		case PdfObject::REFERENCE:
			processContents(contents, stream);
			break;
		case PdfObject::ARRAY:
		{
			const PdfArrayObject &array = (const PdfArrayObject&)*contents;
			const size_t len = array.size();
			for (size_t i = 0; i < len; ++i) {
				processContents(array[i], stream);
			}
			break;
		}
	}
}
开发者ID:OpenInkpot-archive,项目名称:fbreader,代码行数:27,代码来源:PdfBookReader.cpp


示例4: recordTopicDefinitions

void recordTopicDefinitions( TTopicDefinition *p, THelpFile& helpFile )
{
    while (p != 0)
        {
        resolveReference(p->topic, p->value, *(helpFile.stream));
        helpFile.recordPositionInIndex(p->value);
        p = p->next;
        }
}
开发者ID:LucasvBerkel,项目名称:TweedejaarsProject,代码行数:9,代码来源:TVHC.CPP


示例5: resolveGenlPosReference

RDF_Resource
resolveGenlPosReference(char* tok,  RDFFile f)
{
  RDF_Resource ans;
  char* url = (char*)getMem(MAX_URL_SIZE);
  long i1, i2;
  i1 = charSearch('"', tok);
  i2 = revCharSearch('"', tok);
  memcpy(url, &tok[i1], i2-i1+1);
  ans = resolveReference(url, f);
  freeMem(url);
  return ans;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:13,代码来源:mcff2mcf.c


示例6: assignSlot

void
assignSlot (RDF_Resource u, char* slot, char* value, RDFFile f)
{
  PRBool tv = true;
  char* tvstr;
  if (value[0] == '(') {
    tv = false;
    value = &value[1];
    value[strlen(value)-1] = '\0';
  } 

  if (tv) {
    tvstr = "true";
  } else tvstr = "false";

  if (startsWith("default_genl", slot)) return;
  
  if (startsWith("name", slot) || (startsWith("local-name", slot))) { 
    value[strlen(value)-1] = '\0';
    addSlotValue(f, u, gCoreVocab->RDF_name, copyString(&value[1]), RDF_STRING_TYPE, tvstr);  
  }  else if (startsWith("specs", slot) || (startsWith("child", slot))) {
    RDF_Resource spec = resolveReference(value, f);  
    if (!nullp(spec)) addSlotValue(f, spec, gCoreVocab->RDF_parent, u, RDF_RESOURCE_TYPE, tvstr); 
  }  else if (startsWith("genls_pos", slot)) {
    RDF_Resource genl = resolveGenlPosReference(value, f);  
    if (!nullp(genl)) addSlotValue(f, u, gCoreVocab->RDF_parent, genl, RDF_RESOURCE_TYPE, tvstr);
  }  else if ((startsWith("genls", slot)) || (startsWith("parent", slot))) {
    RDF_Resource genl = resolveReference(value, f);
    if (!nullp(genl)) addSlotValue(f, u, gCoreVocab->RDF_parent, genl, RDF_RESOURCE_TYPE, tvstr);
  } else {
    void* parsed_value;
    RDF_ValueType data_type;
    RDF_Resource s = RDF_GetResource(NULL, slot, true);
    RDF_Error err = parseSlotValue(f, s, value, &parsed_value, &data_type); 
    if ((err == noRDFErr) && (!nullp(parsed_value)))   
      addSlotValue(f, u, s, parsed_value, data_type, tvstr);
  } 
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:38,代码来源:mcff2mcf.c


示例7: parseNextMCFLine

void
parseNextMCFLine (RDFFile f, char* line)
{
  char* nextToken ;
  int16 offset = 0;
  RDF_Error err;
  
  if ((nullp(line)) || (line[0] == '\0'))return; 
  nextToken = getMem(MAX_URL_SIZE);
  err = getFirstToken(line, nextToken, &offset);
  
  offset++; 
  if ((err != noRDFErr) &&  (nextToken[0] == ';')) {
    freeMem(nextToken);
    return;
  }
  if (startsWith("begin-headers", nextToken)) {
    f->status = HEADERS;
  } else if (startsWith("end-headers", nextToken)) {
    f->status = BODY;
  } else if (startsWith("unit", nextToken)) {
    f->status = BODY; 
    if (!(nullp(f->currentResource))) resourceTransition(f);
    getFirstToken(&line[offset], nextToken, &offset);
    f->currentResource = resolveReference(nextToken, f); 
  } else if (nextToken[strlen(nextToken)-1] == ':') {
    memset(f->currentSlot, '\0', 100);
    memcpy(f->currentSlot, nextToken, strlen(nextToken)-1);
    while (getFirstToken(&line[offset], nextToken, &offset) == noRDFErr) {
      if (f->status == HEADERS) {
	assignHeaderSlot(f, f->currentSlot, nextToken);
      } else if (f->currentResource) {
	assignSlot(f->currentResource, f->currentSlot, nextToken, f); 
      }
      offset++;
    }
  }
  freeMem(nextToken);
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:39,代码来源:mcff2mcf.c


示例8: resolveReference

Value &
Value::operator[]( const char *key )
{
   return resolveReference( key, false );
}
开发者ID:jjiezheng,项目名称:game-platform-core-native,代码行数:5,代码来源:json_value.cpp


示例9: resolveReference

Value &
Value::atStr( const StaticString &key )
{
   return resolveReference( key, true );
}
开发者ID:mikebd,项目名称:soa,代码行数:5,代码来源:json_value.cpp


示例10: resolveReference

Value& Value::operator[](const CppTL::ConstString& key) {
  return resolveReference(key.c_str(), key.end_c_str());
}
开发者ID:4ib3r,项目名称:domoticz,代码行数:3,代码来源:json_value.cpp


示例11: readLine

bool PdfBookReader::readBook(shared_ptr<ZLInputStream> stream) {
	if (stream.isNull() || !stream->open()) {
		return false;
	}

	readLine(*stream, myBuffer);
	if (!ZLStringUtil::stringStartsWith(myBuffer, "%PDF-")) {
		return false;
	}

	std::string version = myBuffer.substr(5);
	std::cerr << "version = " << version << "\n";

	size_t eofOffset = stream->sizeOfOpened();
	if (eofOffset < 100) {
		return false;
	}

	stream->seek(eofOffset - 100, true);
	bool readXrefOffset = false;
	size_t xrefOffset = (size_t)-1;
	while (true) {
		readLine(*stream, myBuffer);
		if (myBuffer.empty()) {
			break;
		}
		stripBuffer(myBuffer);
		if (readXrefOffset) {
			if (!myBuffer.empty()) {
				xrefOffset = atoi(myBuffer.c_str());
				break;
			}
		} else if (myBuffer == "startxref") {
			readXrefOffset = true;
		}
	}

	if (!readReferenceTable(*stream, xrefOffset)) {
		return false;
	}

	PdfDictionaryObject &trailerDictionary = (PdfDictionaryObject&)*myTrailer;
	shared_ptr<PdfObject> root = resolveReference(trailerDictionary["Root"], *stream);
	if (root.isNull() || (root->type() != PdfObject::DICTIONARY)) {
		return false;
	}

	PdfDictionaryObject &rootDictionary = (PdfDictionaryObject&)*root;
	if (rootDictionary["Type"] != PdfNameObject::nameObject("Catalog")) {
		return false;
	}
	shared_ptr<PdfObject> pageRootNode = resolveReference(rootDictionary["Pages"], *stream);
	if (pageRootNode.isNull() || (pageRootNode->type() != PdfObject::DICTIONARY)) {
		return false;
	}
	PdfDictionaryObject &pageRootNodeDictionary = (PdfDictionaryObject&)*pageRootNode;
	if (pageRootNodeDictionary["Type"] != PdfNameObject::nameObject("Pages")) {
		return false;
	}
	
	/*
	shared_ptr<PdfObject> count = pageRootNodeDictionary["Count"];
	if (!count.isNull() && (count->type() == PdfObject::INTEGER_NUMBER)) {
		std::cerr << "count = " << ((PdfIntegerObject&)*count).value() << "\n";
	}
	*/
	shared_ptr<PdfObject> pages = pageRootNodeDictionary["Kids"];
	if (pages.isNull() || (pages->type() != PdfObject::ARRAY)) {
		return false;
	}
	const PdfArrayObject& pagesArray = (const PdfArrayObject&)*pages;
	const size_t pageNumber = pagesArray.size();
	for (size_t i = 0; i < pageNumber; ++i) {
		processPage(pagesArray[i], *stream);
	}

	return true;
}
开发者ID:OpenInkpot-archive,项目名称:fbreader,代码行数:78,代码来源:PdfBookReader.cpp


示例12: JSON_ASSERT_MESSAGE

Value* Value::demand(char const* begin, char const* end) {
  JSON_ASSERT_MESSAGE(type() == nullValue || type() == objectValue,
                      "in Json::Value::demand(begin, end): requires "
                      "objectValue or nullValue");
  return &resolveReference(begin, end);
}
开发者ID:mloy,项目名称:jsoncpp,代码行数:6,代码来源:json_value.cpp


示例13: resolveReference

Value& Value::operator[](const String& key) {
  return resolveReference(key.data(), key.data() + key.length());
}
开发者ID:mloy,项目名称:jsoncpp,代码行数:3,代码来源:json_value.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ resolve_hostname函数代码示例发布时间:2022-05-30
下一篇:
C++ resolve函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap