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


C++ Dictionary::GetValue方法代码示例

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


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

示例1: if

const Object *ObjReader::ReadObj(void)
{
	unsigned int nOffset, nOffTmp;
	int c, n;
	Object *pObj;
	Dictionary *pDict;
	const Object *pcObj;
	char str[32 * 1024], *ptr;
	int nParentheses;

	nOffset = m_pSource->Position();
	c = m_pSource->Read();
	switch (c)
	{
		case '/':  //name
			pObj = new Name();
			m_pSource->ReadStr(str, sizeof(str));
			((Name *)pObj)->SetValue(str);
			break;
		case '(':  //string
			pObj = new String();
			ptr = str;
			nParentheses = 0;
			while (true)
			{
				c = m_pSource->Read();
				if (c == '\\')
				{
					*ptr++ = c;
					c = m_pSource->Read();
				}
				else if (c == '(')
					++nParentheses;
				else if (c == ')')
				{
					if (--nParentheses <= 0)
						break;
				}
				*ptr++ = c;
			}
			*ptr = '\0';
			((String *)pObj)->SetValue(str, ptr - str, String::LITERAL);
			break;
		case '<':
			c = m_pSource->Read();
			if (c == '<')  //dictionary
			{
				pDict = new Dictionary();
				while (true)
				{
					m_pSource->Skip();
					c = m_pSource->Read();
					if (c == '>')
					{
						m_pSource->Read();  //>
						m_pSource->Skip();
						m_pSource->Read(str, 6);
						if (strncmp(str, "stream", 6) == 0)  //stream
						{
							pcObj = pDict->GetValue("Length");
							if (pcObj->GetType() == Object::OBJ_REFERENCE)
							{
								nOffTmp = m_pSource->Position();
								pcObj = ReadIndirectObj(((const Reference *)pcObj)->GetObjNum(), ((const Reference *)pcObj)->GetGeneration());
								m_pSource->Seek(nOffTmp, SEEK_SET);
								n = ((const Numeric *)pcObj)->GetValue();
								delete pcObj;
							}
							else
								n = ((const Numeric *)pcObj)->GetValue();
							pObj = new Stream(pDict);
							m_pSource->Skip();
							ptr = new char[n];
							m_pSource->Read(ptr, n);
							((Stream *)pObj)->SetValue((unsigned char *)ptr, n);
							delete[] ptr;
						}
						else
						{
							pObj = pDict;
							m_pSource->Seek(-6, SEEK_CUR);
						}
						break;
					}
					else
					{
						m_pSource->Seek(-1, SEEK_CUR);
						pcObj = ReadObj();
						pDict->Add(pcObj, ReadObj());
					}
				}
			}
			else  //hexadecimal string
			{
				m_pSource->Seek(-1, SEEK_CUR);
				pObj = new String();
				n = m_pSource->ReadStr(str, sizeof(str));
				((String *)pObj)->SetValue(str, n, String::HEXADECIMAL);
				m_pSource->Read();  //>
			}
//.........这里部分代码省略.........
开发者ID:vincent0629,项目名称:PDFParser,代码行数:101,代码来源:ObjReader.cpp


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