diff -r 000000000000 -r 818e61de6cd1 crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianUtils/FileSystem/FilePair/FileNamePairCollection.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianUtils/FileSystem/FilePair/FileNamePairCollection.cs Thu Feb 11 15:50:58 2010 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +using System; +using System.Collections.Generic; + +namespace SymbianUtils.FileSystem.FilePair +{ + public class FileNamePairCollection : IEnumerable + { + #region Constructor + public FileNamePairCollection() + { + } + #endregion + + #region API + public void Clear() + { + iList.Clear(); + } + + public void Add( IEnumerable aList ) + { + foreach ( FileNamePair entry in aList ) + { + Add( entry ); + } + } + + public void Add( FileNamePair aItem ) + { + iList.Add( aItem ); + } + + public void RemoveAt( int aIndex ) + { + iList.RemoveAt( aIndex ); + } + + public bool Contains( FileNamePair aItem ) + { + bool exists = false; + // + foreach ( FileNamePair entry in iList ) + { + if ( entry.Source.ToLower() == aItem.Source.ToLower() ) + { + exists = true; + break; + } + else if ( entry.Destination.ToLower() == aItem.Destination.ToLower() ) + { + exists = true; + break; + } + } + // + return exists; + } + #endregion + + #region Properties + public int Count + { + get { return iList.Count; } + } + + public FileNamePair this[ int aIndex ] + { + get + { + FileNamePair item = (FileNamePair) iList[ aIndex ]; + return item; + } + } + #endregion + + #region From IEnumerable + IEnumerator IEnumerable.GetEnumerator() + { + foreach ( FileNamePair entry in iList ) + { + yield return entry; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + foreach ( FileNamePair entry in iList ) + { + yield return entry; + } + } + #endregion + + #region Data members + private List iList = new List(); + #endregion + } +}