本文整理汇总了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(); //>
}
//.........这里部分代码省略.........