|
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.Collections.Generic; |
|
19 using System.Collections.Specialized; |
|
20 using System.Text; |
|
21 |
|
22 namespace SymbianDebugLib.Entity.Configurations |
|
23 { |
|
24 public class DbgEntityConfigIdentifier |
|
25 { |
|
26 #region Constructors |
|
27 public DbgEntityConfigIdentifier() |
|
28 { |
|
29 } |
|
30 |
|
31 public DbgEntityConfigIdentifier( string aId ) |
|
32 { |
|
33 Add( aId ); |
|
34 } |
|
35 |
|
36 public DbgEntityConfigIdentifier( uint aId ) |
|
37 { |
|
38 Add( aId.ToString( "x8" ) ); |
|
39 } |
|
40 #endregion |
|
41 |
|
42 #region API |
|
43 public void Add( string aId ) |
|
44 { |
|
45 if ( iIds.ContainsKey( aId ) == false ) |
|
46 { |
|
47 iIds.Add( aId, aId ); |
|
48 } |
|
49 } |
|
50 |
|
51 public bool Contains( DbgEntityConfigIdentifier aId ) |
|
52 { |
|
53 int matchCount = 0; |
|
54 // |
|
55 foreach ( string key in aId.iIds.Keys ) |
|
56 { |
|
57 if ( Contains( key ) ) |
|
58 { |
|
59 ++matchCount; |
|
60 } |
|
61 } |
|
62 // |
|
63 bool ret = matchCount > 0 && ( matchCount == this.Count ); |
|
64 return ret; |
|
65 } |
|
66 |
|
67 public bool Contains( string aIdText ) |
|
68 { |
|
69 bool ret = iIds.ContainsKey( aIdText ); |
|
70 return ret; |
|
71 } |
|
72 #endregion |
|
73 |
|
74 #region Properties |
|
75 public int Count |
|
76 { |
|
77 get { return iIds.Count; } |
|
78 } |
|
79 #endregion |
|
80 |
|
81 #region From System.Object |
|
82 public override string ToString() |
|
83 { |
|
84 StringBuilder ret = new StringBuilder(); |
|
85 foreach ( string key in iIds.Keys ) |
|
86 { |
|
87 ret.Append( key + ", " ); |
|
88 } |
|
89 |
|
90 if ( ret.Length > 0 ) |
|
91 { |
|
92 ret.Remove( ret.Length - 2, 2 ); |
|
93 } |
|
94 |
|
95 return ret.ToString(); |
|
96 } |
|
97 #endregion |
|
98 |
|
99 #region Data members |
|
100 private StringDictionary iIds = new StringDictionary(); |
|
101 #endregion |
|
102 } |
|
103 } |