void MHIngredient::Initialise(MHParseNode *p, MHEngine *engine) { MHRoot::Initialise(p, engine); MHParseNode *pIA = p->GetNamedArg(C_INITIALLY_ACTIVE); if (pIA) { m_fInitiallyActive = pIA->GetArgN(0)->GetBoolValue(); } MHParseNode *pCHook = p->GetNamedArg(C_CONTENT_HOOK); if (pCHook) { m_nContentHook = pCHook->GetArgN(0)->GetIntValue(); } MHParseNode *pOrigContent = p->GetNamedArg(C_ORIGINAL_CONTENT); if (pOrigContent) { MHParseNode *pArg = pOrigContent->GetArgN(0); // Either a string - included content. if (pArg->m_nNodeType == MHParseNode::PNString) { m_ContentType = IN_IncludedContent; pArg->GetStringValue(m_OrigIncludedContent); } else // or a sequence - referenced content. { // In the text version this is tagged with :ContentRef m_ContentType = IN_ReferencedContent; m_OrigContentRef.Initialise(pArg->GetArgN(0), engine); MHParseNode *pContentSize = pArg->GetNamedArg(C_CONTENT_SIZE); if (pContentSize) { m_nOrigContentSize = pContentSize->GetArgN(0)->GetIntValue(); } MHParseNode *pCCPrio = pArg->GetNamedArg(C_CONTENT_CACHE_PRIORITY); if (pCCPrio) { m_nOrigCCPrio = pCCPrio->GetArgN(0)->GetIntValue(); } } } MHParseNode *pShared = p->GetNamedArg(C_SHARED); if (pShared) { m_fShared = pShared->GetArgN(0)->GetBoolValue(); } }
// An object reference is either an integer or a pair of a group id and an integer. void MHObjectRef::Initialise(MHParseNode *p, MHEngine *engine) { if (p->m_nNodeType == MHParseNode::PNInt) { m_nObjectNo = p->GetIntValue(); // Set the group id to the id of this group. m_GroupId.Copy(engine->GetGroupId()); } else if (p->m_nNodeType == MHParseNode::PNSeq) { MHParseNode *pFirst = p->GetSeqN(0); MHOctetString groupId; pFirst->GetStringValue(m_GroupId); m_nObjectNo = p->GetSeqN(1)->GetIntValue(); } else p->Failure("ObjectRef: Argument is not int or sequence"); }