本文整理汇总了C++中MHRoot类的典型用法代码示例。如果您正苦于以下问题:C++ MHRoot类的具体用法?C++ MHRoot怎么用?C++ MHRoot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MHRoot类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetValue
// Return the value, looking up any indirect ref.
void MHGenericOctetString::GetValue(MHOctetString &str, MHEngine *engine) const
{
if (m_fIsDirect) str.Copy(m_Direct);
else {
MHUnion result;
MHRoot *pBase = engine->FindObject(m_Indirect);
pBase->GetVariableValue(result, engine);
// From my reading of the MHEG documents implicit conversion is only
// performed when assigning variables. Nevertheless the Channel 4
// Teletext assumes that implicit conversion takes place here as well.
if (result.m_Type == MHUnion::U_Int) {
// Implicit conversion of int to string.
char buff[30]; // 30 chars is more than enough.
#ifdef WIN32
_snprintf(buff, sizeof(buff), "%0d", result.m_nIntVal);
#else
snprintf(buff, sizeof(buff), "%0d", result.m_nIntVal);
#endif
str.Copy(buff);
}
else {
result.CheckType(MHUnion::U_String);
str.Copy(result.m_StrVal);
}
}
}
示例2: CallAction
// Clone - make a copy of the target and set the object reference variable to the new object ref.
void MHClone::CallAction(MHEngine *engine, MHRoot *pTarget, MHRoot *pRef)
{
// We need to get the group (scene or application) that contains the target.
MHObjectRef groupRef;
groupRef.m_GroupId.Copy(pTarget->m_ObjectReference.m_GroupId);
groupRef.m_nObjectNo = 0; // The group always has object ref zero.
MHRoot *pGroup = engine->FindObject(groupRef);
// Get the group to make the clone and add it to its ingredients.
pGroup->MakeClone(pTarget, pRef, engine);
}
示例3: Perform
void MHAppend::Perform(MHEngine *engine)
{
MHUnion targetVal;
// Find the target and get its current value. The target can be an indirect reference.
MHObjectRef parm;
m_Target.GetValue(parm, engine);
MHRoot *pTarget = engine->FindObject(parm);
pTarget->GetVariableValue(targetVal, engine);
targetVal.CheckType(MHUnion::U_String);
// Get the string to append.
MHOctetString toAppend;
m_Operand.GetValue(toAppend, engine);
targetVal.m_StrVal.Append(toAppend); // Add it on the end
pTarget->SetVariableValue(targetVal); // Set the target to the result.
}
示例4: GetValue
// Return the value, looking up any indirect ref.
void MHGenericObjectRef::GetValue(MHObjectRef &ref, MHEngine *engine) const
{
if (m_fIsDirect)
{
ref.Copy(m_ObjRef);
}
else
{
// LVR - Hmm I don't think this is right. Should be: ref.Copy(m_Indirect);
// But it's used in several places so workaround in Stream::MHActionGenericObjectRefFix
MHUnion result;
MHRoot *pBase = engine->FindObject(m_Indirect);
pBase->GetVariableValue(result, engine);
result.CheckType(MHUnion::U_ObjRef);
ref.Copy(result.m_ObjRefVal);
}
}
示例5: Update
// Update action - set the position of the cells to be displayed and deactivate those
// which aren't.
void MHListGroup::Update(MHEngine *engine)
{
if (!m_ItemList.size()) // Special cases when the list becomes empty
{
if (m_fFirstItemDisplayed)
{
m_fFirstItemDisplayed = false;
engine->EventTriggered(this, EventFirstItemPresented, false);
}
if (m_fLastItemDisplayed)
{
m_fLastItemDisplayed = false;
engine->EventTriggered(this, EventLastItemPresented, false);
}
}
else // Usual case.
{
for (int i = 0; i < m_ItemList.size(); i++)
{
MHRoot *pVis = m_ItemList.at(i)->m_pVisible;
int nCell = i + 1 - m_nFirstItem; // Which cell does this item map onto?
if (nCell >= 0 && nCell < m_Positions.Size())
{
if (i == 0 && ! m_fFirstItemDisplayed)
{
m_fFirstItemDisplayed = true;
engine->EventTriggered(this, EventFirstItemPresented, true);
}
if (i == m_ItemList.size() - 1 && ! m_fLastItemDisplayed)
{
m_fLastItemDisplayed = true;
engine->EventTriggered(this, EventLastItemPresented, true);
}
try
{
pVis->SetPosition(m_Positions.GetAt(i - m_nFirstItem + 1).x(), m_Positions.GetAt(i - m_nFirstItem + 1).y(), engine);
}
catch (...) {}
if (! pVis->GetRunningStatus())
{
pVis->Activation(engine);
}
}
else
{
if (i == 0 && m_fFirstItemDisplayed)
{
m_fFirstItemDisplayed = false;
engine->EventTriggered(this, EventFirstItemPresented, false);
}
if (i == m_ItemList.size() - 1 && m_fLastItemDisplayed)
{
m_fLastItemDisplayed = false;
engine->EventTriggered(this, EventLastItemPresented, false);
}
if (pVis->GetRunningStatus())
{
pVis->Deactivation(engine);
pVis->ResetPosition();
}
}
}
}
// Generate the HeadItems and TailItems events. Even in the MHEG corrigendum this is unclear.
// I'm not at all sure this is right.
if (m_nLastFirstItem != m_nFirstItem)
{
engine->EventTriggered(this, EventHeadItems, m_nFirstItem);
}
if (m_nLastCount - m_nLastFirstItem != m_ItemList.size() - m_nFirstItem)
{
engine->EventTriggered(this, EventTailItems, m_ItemList.size() - m_nFirstItem);
}
m_nLastCount = m_ItemList.size();
m_nLastFirstItem = m_nFirstItem;
}