crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianSymbolLib/Plugins/SLPluginSymbol/Data/SymbolCollectionSegment.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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 
       
    18 using System;
       
    19 using System.IO;
       
    20 using System.Collections.Generic;
       
    21 using System.Text;
       
    22 using System.Text.RegularExpressions;
       
    23 using SymbianStructuresLib.Debug.Symbols;
       
    24 using SymbianStructuresLib.Debug.Symbols.Interfaces;
       
    25 using SymbianStructuresLib.Debug.Common.Interfaces;
       
    26 using SymbianStructuresLib.Debug.Common.FileName;
       
    27 using SymbianSymbolLib.SourceManagement.Source;
       
    28 using SymbianSymbolLib.SourceManagement.Provisioning;
       
    29 using SymbianUtils;
       
    30 using SymbianUtils.Tracer;
       
    31 using SymbianUtils.FileTypes;
       
    32 using SLPluginSymbol.Source;
       
    33 
       
    34 namespace SLPluginSymbol.Data
       
    35 {
       
    36 	internal class SymbolCollectionSegment : DisposableObject, IEnumerable<string>
       
    37 	{
       
    38 		#region Constructors
       
    39         public SymbolCollectionSegment( IPlatformIdAllocator aIdAllocator, string aHostFileName )
       
    40 		{
       
    41             iCollection = SymbolCollection.NewByHostFileName( aIdAllocator, aHostFileName );
       
    42 		}
       
    43         #endregion
       
    44 
       
    45         #region API
       
    46         public SymbolCollection ExcavateSymbolCollection()
       
    47         {
       
    48             SymbolCollection ret = iCollection;
       
    49             iCollection = null;
       
    50             return ret;
       
    51         }
       
    52 
       
    53         public void AddLine( string aLine )
       
    54         {
       
    55             iLines.Add( aLine );
       
    56         }
       
    57         #endregion
       
    58 
       
    59         #region Properties
       
    60         public int Count
       
    61         {
       
    62             get { return iLines.Count; }
       
    63         }
       
    64 
       
    65         public SymbolCollection Collection
       
    66         {
       
    67             get { return iCollection; }
       
    68         }
       
    69 
       
    70         public PlatformFileName FileName
       
    71         {
       
    72             get { return iCollection.FileName; }
       
    73         }
       
    74         #endregion
       
    75 
       
    76         #region Internal constants
       
    77         #endregion
       
    78 
       
    79         #region Internal methods
       
    80         #endregion
       
    81 
       
    82         #region From IEnumerable<string>
       
    83         public IEnumerator<string> GetEnumerator()
       
    84         {
       
    85             foreach ( string line in iLines )
       
    86             {
       
    87                 yield return line;
       
    88             }
       
    89         }
       
    90 
       
    91         System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
       
    92         {
       
    93             foreach ( string line in iLines )
       
    94             {
       
    95                 yield return line;
       
    96             }
       
    97         }
       
    98         #endregion
       
    99 
       
   100         #region From DisposableObject
       
   101         protected override void CleanupManagedResources()
       
   102         {
       
   103             try
       
   104             {
       
   105                 base.CleanupManagedResources();
       
   106             }
       
   107             finally
       
   108             {
       
   109                 iCollection = null;
       
   110                 iLines.Clear();
       
   111             }
       
   112         }
       
   113         #endregion
       
   114 
       
   115         #region Data members
       
   116         private SymbolCollection iCollection = null;
       
   117         private List<string> iLines = new List<string>();
       
   118         #endregion
       
   119     }
       
   120 }