// Return the value, looking up any indirect ref. public int GetValue(MHEngine engine) { if (m_fIsDirect) { return(m_nDirect); } else { MHUnion result = new MHUnion(); 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.Type == MHUnion.U_String) { // Implicit conversion of string to integer. return(Convert.ToInt32(result.String.ToString())); } else { result.CheckType(MHUnion.U_Int); return(result.Int); } } }
// Return the value, looking up any indirect ref. public void GetValue(MHOctetString str, MHEngine engine) { if (m_fIsDirect) { str.Copy(m_Direct); } else { MHUnion result = new MHUnion(); 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.Type == MHUnion.U_Int) { // Implicit conversion of string to integer. MHOctetString s = new MHOctetString("" + result.Int); str.Copy(s); } else { result.CheckType(MHUnion.U_String); str.Copy(result.String); } } }
// Return the value, looking up any indirect ref. public void GetValue(MHContentRef reference, MHEngine engine) { if (m_fIsDirect) { reference.Copy(m_Direct); } else { MHUnion result = new MHUnion(); MHRoot pBase = engine.FindObject(m_Indirect); pBase.GetVariableValue(result, engine); result.CheckType(MHUnion.U_ContentRef); reference.Copy(result.ContentRef); } }
// Return the value, looking up any indirect ref. public bool GetValue(MHEngine engine) { if (m_fIsDirect) { return(m_fDirect); } else { MHUnion result = new MHUnion(); MHRoot pBase = engine.FindObject(m_Indirect); pBase.GetVariableValue(result, engine); result.CheckType(MHUnion.U_Bool); return(result.Bool); } }