/** * @brief Create an object BUT DO NOT ADD to objects vector, used for messages. * @param aFilename * @return The newly created object. */ GameObject *ObjectManager::CreateObjectNoAdd(HashString const &aFilename, HashString const &aFolder) { TextParser parser(Common::RelativePath(aFolder, aFilename)); GameObject *object = new GameObject(this, aFilename); ParseDictionary(object, parser); return object; }
wxPdfObject* wxPdfParser::ParseObject() { wxPdfObject* obj; m_tokens->NextValidToken(); int type = m_tokens->GetTokenType(); switch (type) { case TOKEN_START_DICTIONARY: { wxPdfDictionary* dic = ParseDictionary(); int pos = m_tokens->Tell(); // be careful in the trailer. May not be a "next" token. if (m_tokens->NextToken() && m_tokens->GetStringValue() == _T("stream")) { int ch = m_tokens->ReadChar(); if (ch != '\n') ch = m_tokens->ReadChar(); if (ch != '\n') m_tokens->BackOnePosition(ch); wxPdfStream* stream = new wxPdfStream(m_tokens->Tell()); stream->SetDictionary(dic); obj = stream; } else { m_tokens->Seek(pos); obj = dic; } } break; case TOKEN_START_ARRAY: { obj = ParseArray(); } break; case TOKEN_NUMBER: { obj = new wxPdfNumber(m_tokens->GetStringValue()); } break; case TOKEN_STRING: { wxString token = m_tokens->GetStringValue(); // Decrypt if necessary if (m_encrypted) { m_decryptor->Encrypt(m_objNum, m_objGen, token); } wxPdfString* strObj = new wxPdfString(token); strObj->SetIsHexString(m_tokens->IsHexString()); obj = strObj; } break; case TOKEN_NAME: { obj = new wxPdfName(m_tokens->GetStringValue()); } break; case TOKEN_REFERENCE: { int num = m_tokens->GetReference(); obj = new wxPdfIndirectReference(num, m_tokens->GetGeneration()); } break; case TOKEN_BOOLEAN: { obj = new wxPdfBoolean((m_tokens->GetStringValue() == _T("true"))); } break; case TOKEN_NULL: { obj = new wxPdfNull(); } break; default: { wxString token = m_tokens->GetStringValue(); obj = new wxPdfLiteral(-type, m_tokens->GetStringValue()); } break; } return obj; }
/** * @brief Parse object from file, create components. * @param aObject */ void ObjectManager::ParseObject(GameObject *aObject) { TextParser parser(Common::RelativePath("Game", aObject->GetFileName())); ParseDictionary(aObject, parser); }