示例#1
0
            public bool Validate(Validator v, string sIdentity, OTTable table)
            {
                bool bRet = true;

                bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetBaseValuesTable, CalcLength(), v, sIdentity, table.GetTag());

                // check BaseCoord offsets
                bool bOffsetsOk = true;

                for (uint i = 0; i < BaseCoordCount; i++)
                {
                    ushort bco = GetBaseCoordOffset(i);
                    if (bco == 0)
                    {
                        v.Error(T.T_NULL, E.BASE_E_BaseValuesTable_BCO_0, table.m_tag, sIdentity + ", BaseCoordOffset index = " + i);
                        bOffsetsOk = false;
                        bRet       = false;
                    }
                    else if (bco + m_offsetBaseValuesTable > m_bufTable.GetLength())
                    {
                        v.Error(T.T_NULL, E.BASE_E_BaseValuesTable_BCO_invalid, table.m_tag, sIdentity + ", BaseCoordOffset index = " + i);
                        bOffsetsOk = false;
                        bRet       = false;
                    }
                }
                if (bOffsetsOk)
                {
                    v.Pass(T.T_NULL, P.BASE_P_BaseValuesTable_BCO, table.m_tag, sIdentity);
                }

                // check the BaseCoord tables
                for (uint i = 0; i < BaseCoordCount; i++)
                {
                    BaseCoordTable_val bct = GetBaseCoordTable_val(i);
                    bct.Validate(v, sIdentity, table);
                }

                return(bRet);
            }
示例#2
0
            public bool Validate(Validator v, string sIdentity, OTTable table)
            {
                bool bRet = true;

                bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetMinMaxTable, CalcLength(), v, sIdentity, table.GetTag());

                // check the MinCoordOffset
                if (MinCoordOffset == 0)
                {
                    v.Pass(T.T_NULL, P.BASE_P_MinMaxTable_MinCO_0, table.m_tag, sIdentity);
                }
                else if (MinCoordOffset + m_offsetMinMaxTable > m_bufTable.GetLength())
                {
                    v.Error(T.T_NULL, E.BASE_E_MinMaxTable_MinCO, table.m_tag, sIdentity);
                    bRet = false;
                }
                else
                {
                    v.Pass(T.T_NULL, P.BASE_P_MinMaxTable_MinCO, table.m_tag, sIdentity);
                }

                // check the MaxCoordOffset
                if (MaxCoordOffset == 0)
                {
                    v.Pass(T.T_NULL, P.BASE_P_MinMaxTable_MaxCO_0, table.m_tag, sIdentity);
                }
                else if (MaxCoordOffset + m_offsetMinMaxTable > m_bufTable.GetLength())
                {
                    v.Error(T.T_NULL, E.BASE_E_MinMaxTable_MaxCO, table.m_tag, sIdentity);
                    bRet = false;
                }
                else
                {
                    v.Pass(T.T_NULL, P.BASE_P_MinMaxTable_MaxCO, table.m_tag, sIdentity);
                }

                // check the FeatMinMaxRecords
                bool bFeatMinMaxRecordsOk = true;

                for (uint i = 0; i < FeatMinMaxCount; i++)
                {
                    FeatMinMaxRecord fmmr = GetFeatMinMaxRecord(i);

                    if (fmmr != null)
                    {
                        if (fmmr.MinCoordOffset + m_offsetMinMaxTable > m_bufTable.GetLength())
                        {
                            v.Error(T.T_NULL, E.BASE_E_FeatMinMaxRecords_MinCO_offset, table.m_tag, sIdentity + ", FeatMinMaxRecord[" + i + "]");
                            bFeatMinMaxRecordsOk = false;
                            bRet = false;
                        }

                        if (fmmr.MaxCoordOffset + m_offsetMinMaxTable > m_bufTable.GetLength())
                        {
                            v.Error(T.T_NULL, E.BASE_E_FeatMinMaxRecords_MaxCO_offset, table.m_tag, sIdentity + ", FeatMinMaxRecord[" + i + "]");
                            bFeatMinMaxRecordsOk = false;
                            bRet = false;
                        }
                    }
                    else
                    {
                        bFeatMinMaxRecordsOk = false;
                    }
                }
                if (bFeatMinMaxRecordsOk)
                {
                    v.Pass(T.T_NULL, P.BASE_P_FeatMinMaxRecords_offsets, table.m_tag, sIdentity);
                }

                // check the BaseCoord Tables
                BaseCoordTable_val bct = null;

                bct = GetMinCoordTable_val();
                if (bct != null)
                {
                    bct.Validate(v, sIdentity, table);
                }

                bct = GetMaxCoordTable_val();
                if (bct != null)
                {
                    bct.Validate(v, sIdentity, table);
                }
                for (uint i = 0; i < FeatMinMaxCount; i++)
                {
                    FeatMinMaxRecord fmmr = GetFeatMinMaxRecord(i);

                    bct = GetFeatMinCoordTable_val(fmmr);
                    if (bct != null)
                    {
                        bct.Validate(v, sIdentity, table);
                    }

                    bct = GetFeatMaxCoordTable_val(fmmr);
                    if (bct != null)
                    {
                        bct.Validate(v, sIdentity, table);
                    }
                }

                return(bRet);
            }