crashanalysercmd/Libraries/Engine/CrashItemLib/Crash/InfoHW/CIInfoHW.cs
changeset 0 818e61de6cd1
child 2 0c91f0baec58
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.Collections.Generic;
       
    20 using CrashItemLib.Crash;
       
    21 using CrashItemLib.Crash.Base;
       
    22 using CrashItemLib.Crash.Base.DataBinding;
       
    23 using CrashItemLib.Crash.Utils;
       
    24 using CrashItemLib.Crash.Container;
       
    25 
       
    26 namespace CrashItemLib.Crash.InfoHW
       
    27 {
       
    28     [CIDBAttributeColumn( "Name", 0 )]
       
    29     [CIDBAttributeColumn( "Value", 1, true )]
       
    30     public class CIInfoHW : CIElement, IEnumerable<CIVersionInfo>
       
    31     {
       
    32         #region Constructors
       
    33         public CIInfoHW( CIContainer aContainer )
       
    34             : base( aContainer )
       
    35 		{
       
    36 		}
       
    37 		#endregion
       
    38 
       
    39         #region API
       
    40         public void ClearVersions()
       
    41         {
       
    42             iVersions.Clear();
       
    43         }
       
    44 
       
    45         public void AddVersion( string aVersionText )
       
    46         {
       
    47             CIVersionInfo version = new CIVersionInfo( aVersionText );
       
    48             AddVersion( version );
       
    49         }
       
    50 
       
    51         public void AddVersion( CIVersionInfo aVersion )
       
    52         {
       
    53             if ( aVersion.IsValid )
       
    54             {
       
    55                 iVersions.Add( aVersion );
       
    56             }
       
    57         }
       
    58         #endregion
       
    59 
       
    60         #region Properties
       
    61         public int VersionCount
       
    62         {
       
    63             get { return iVersions.Count; }
       
    64         }
       
    65 
       
    66         [CIDBAttributeCell( "Product Type", 1 )]
       
    67         public string ProductType
       
    68         {
       
    69             get { return iProductType; }
       
    70             set { iProductType = value; }
       
    71         }
       
    72 
       
    73         [CIDBAttributeCell( "Product Code", 0 )]
       
    74         public string ProductCode
       
    75         {
       
    76             get { return iProductCode; }
       
    77             set { iProductCode = value; }
       
    78         }
       
    79 
       
    80         [CIDBAttributeCell( "Serial Number", 2 )]
       
    81         public string SerialNumber
       
    82         {
       
    83             get { return iSerialNumber; }
       
    84             set { iSerialNumber = value; }
       
    85         }
       
    86         #endregion
       
    87 
       
    88         #region Internal methods
       
    89         #endregion
       
    90 
       
    91         #region From System.Object
       
    92         public override string ToString()
       
    93         {
       
    94             return iProductType;
       
    95         }
       
    96         #endregion
       
    97 
       
    98         #region From CIElement
       
    99         public override void PrepareRows()
       
   100         {
       
   101             base.PrepareRows();
       
   102             foreach ( CIVersionInfo ver in iVersions )
       
   103             {
       
   104                 DataBindingModel.Add( ver );
       
   105             }
       
   106         }
       
   107         #endregion
       
   108 
       
   109         #region From IEnumerable<CIVersionInfo>
       
   110         public new IEnumerator<CIVersionInfo> GetEnumerator()
       
   111         {
       
   112             foreach ( CIVersionInfo v in iVersions )
       
   113             {
       
   114                 yield return v;
       
   115             }
       
   116         }
       
   117 
       
   118         System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
       
   119         {
       
   120             foreach ( CIVersionInfo v in iVersions )
       
   121             {
       
   122                 yield return v;
       
   123             }
       
   124         }
       
   125         #endregion
       
   126 
       
   127         #region Data members
       
   128         private string iProductType = string.Empty;
       
   129         private string iProductCode = string.Empty;
       
   130         private string iSerialNumber = string.Empty;
       
   131         private List<CIVersionInfo> iVersions = new List<CIVersionInfo>();
       
   132         #endregion
       
   133     }
       
   134 }