|
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; |
|
21 using System.Collections.Specialized; |
|
22 |
|
23 namespace SymBuildParsingLib.Utils |
|
24 { |
|
25 public class SymFileNameCollection |
|
26 { |
|
27 #region Constructors & destructor |
|
28 public SymFileNameCollection() |
|
29 { |
|
30 } |
|
31 #endregion |
|
32 |
|
33 #region API |
|
34 public void Add( string aFileName ) |
|
35 { |
|
36 bool exists = File.Exists( aFileName ); |
|
37 if ( exists ) |
|
38 { |
|
39 bool isPresent = IsPresent( aFileName ); |
|
40 if ( isPresent == false ) |
|
41 { |
|
42 iFiles.Add( aFileName.ToLower(), aFileName ); |
|
43 } |
|
44 } |
|
45 |
|
46 } |
|
47 |
|
48 public void Remove( string aFileName ) |
|
49 { |
|
50 bool isPresent = IsPresent( aFileName ); |
|
51 if ( isPresent == false ) |
|
52 { |
|
53 iFiles.Remove( aFileName.ToLower() ); |
|
54 } |
|
55 } |
|
56 |
|
57 public bool IsPresent( string aFileName ) |
|
58 { |
|
59 bool isPresent = iFiles.ContainsKey( aFileName.ToLower() ); |
|
60 return isPresent; |
|
61 } |
|
62 #endregion |
|
63 |
|
64 #region Properties |
|
65 public int Count |
|
66 { |
|
67 get { return iFiles.Count; } |
|
68 } |
|
69 |
|
70 public string this[ int aIndex ] |
|
71 { |
|
72 get |
|
73 { |
|
74 String[] keys = new String[ iFiles.Count ]; |
|
75 iFiles.Keys.CopyTo( keys, 0 ); |
|
76 // |
|
77 string key = keys[ aIndex]; |
|
78 string file = iFiles[ key ]; |
|
79 // |
|
80 return file; |
|
81 } |
|
82 } |
|
83 #endregion |
|
84 |
|
85 #region Internal methods |
|
86 #endregion |
|
87 |
|
88 #region Data members |
|
89 private StringDictionary iFiles = new StringDictionary(); |
|
90 #endregion |
|
91 } |
|
92 } |