crashanalysercmd/Libraries/Engine/CrashItemLib/Crash/Messages/CIMessageDictionary.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 using System;
       
    18 using System.Text;
       
    19 using System.IO;
       
    20 using System.Collections.Generic;
       
    21 using CrashItemLib.Crash;
       
    22 using CrashItemLib.Crash.Base;
       
    23 using CrashItemLib.Crash.Base.DataBinding;
       
    24 using CrashItemLib.Crash.Registers;
       
    25 using CrashItemLib.Crash.Container;
       
    26 using SymbianStructuresLib.Uids;
       
    27 
       
    28 namespace CrashItemLib.Crash.Messages
       
    29 {
       
    30     #region Attributes
       
    31     [CIDBAttributeColumn( "Type", 0 )]
       
    32     [CIDBAttributeColumn( "Overview", 1, true )]
       
    33     #endregion
       
    34     public class CIMessageDictionary : CIElementList<CIMessage>
       
    35 	{
       
    36 		#region Constructors
       
    37         [CIElementAttributeMandatory()]
       
    38         public CIMessageDictionary( CIContainer aContainer )
       
    39             : base( aContainer )
       
    40 		{
       
    41             base.AddSupportedChildType( typeof( CrashItemLib.Crash.Messages.CIMessage ) );
       
    42 		}
       
    43 
       
    44         internal CIMessageDictionary( CIElementList<CIMessage> aList )
       
    45             : this( aList.Container )
       
    46         {
       
    47             base.AddRange( aList.ToArray() );
       
    48         }
       
    49 		#endregion
       
    50 
       
    51         #region API
       
    52         public void AddRange( CIMessageDictionary aFrom )
       
    53         {
       
    54             foreach ( CIMessage msg in aFrom )
       
    55             {
       
    56                 if ( !this.Contains( msg ) )
       
    57                 {
       
    58                     base.Add( msg );
       
    59                 }
       
    60             }
       
    61         }
       
    62         #endregion
       
    63 
       
    64         #region Properties
       
    65         #endregion
       
    66 
       
    67         #region From CIElement
       
    68         internal override void OnFinalize( CIElementFinalizationParameters aParams )
       
    69         {
       
    70             base.OnFinalize( aParams );
       
    71             //
       
    72             BuildIndex();
       
    73         }
       
    74 
       
    75         public override void PrepareRows()
       
    76         {
       
    77             DataBindingModel.ClearRows();
       
    78 
       
    79             // Our data binding model is based upon the object, rather
       
    80             // than any key-value-pair properties.
       
    81             foreach ( CIMessage msg in this )
       
    82             {
       
    83                 DataBindingModel.Add( msg );
       
    84             }
       
    85         }
       
    86         #endregion
       
    87 
       
    88         #region Internal methods
       
    89         private void BuildIndex()
       
    90         {
       
    91             CIElementList<CIMessage> messages = Container.ChildrenByType<CIMessage>( TChildSearchType.EEntireHierarchy );
       
    92             foreach ( CIMessage message in messages )
       
    93             {
       
    94                 if ( !base.Contains( message.Id ) )
       
    95                 {
       
    96                     base.Add( message );
       
    97                 }
       
    98             }
       
    99         }
       
   100         #endregion
       
   101 
       
   102         #region Data members
       
   103         #endregion
       
   104     }
       
   105 }