crashanalysercmd/Libraries/Engine/CrashItemLib/Engine/Sources/Types/CIEngineSourceReader.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.IO;
       
    19 using System.Collections;
       
    20 using System.Collections.Generic;
       
    21 using System.Text;
       
    22 using SymbianUtils;
       
    23 using SymbianUtils.Tracer;
       
    24 using CrashItemLib.PluginAPI;
       
    25 using CrashItemLib.Crash.Source;
       
    26 using CrashItemLib.Crash.Container;
       
    27 
       
    28 namespace CrashItemLib.Engine.Sources.Types
       
    29 {
       
    30     internal abstract class CIEngineSourceReader : ITracer
       
    31     {
       
    32         #region Constructors
       
    33         protected CIEngineSourceReader( CIEngineSource aSource )
       
    34         {
       
    35             iSource = aSource;
       
    36         }
       
    37         #endregion
       
    38 
       
    39         #region Abstract API
       
    40         public abstract CIEngineSource.TState Read();
       
    41 
       
    42         public abstract CFFSource.TReaderOperationType OpType
       
    43         {
       
    44             get;
       
    45         }
       
    46         #endregion
       
    47 
       
    48         #region API
       
    49         protected void AddException( Exception aException )
       
    50         {
       
    51             iExceptions.Add( aException );
       
    52         }
       
    53 
       
    54         protected void SaveCrash( CIContainer aCrashContainer )
       
    55         {
       
    56             iSource.SaveContainer( aCrashContainer );
       
    57         }
       
    58         #endregion
       
    59 
       
    60         #region Properties
       
    61         public CIEngineSource Source
       
    62         {
       
    63             get { return iSource; }
       
    64         }
       
    65 
       
    66         public int CrashItemCount
       
    67         {
       
    68             get { return iSource.ContainerCount; }
       
    69         }
       
    70 
       
    71         public bool HasExceptions
       
    72         {
       
    73             get { return iExceptions.Count > 0; }
       
    74         }
       
    75 
       
    76         public Exception[] Exceptions
       
    77         {
       
    78             get { return iExceptions.ToArray(); }
       
    79         }
       
    80         #endregion
       
    81 
       
    82         #region Internal methods
       
    83         #endregion
       
    84 
       
    85         #region From ITracer
       
    86         public void Trace( string aMessage )
       
    87         {
       
    88             iSource.Engine.Trace( aMessage );
       
    89         }
       
    90 
       
    91         public void Trace( string aFormat, params object[] aParams )
       
    92         {
       
    93             iSource.Engine.Trace( aFormat, aParams );
       
    94         }
       
    95         #endregion
       
    96 
       
    97         #region Data members
       
    98         private readonly CIEngineSource iSource;
       
    99         private List<Exception> iExceptions = new List<Exception>();
       
   100         #endregion
       
   101     }
       
   102 }