|
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.Generic; |
|
20 using System.Text; |
|
21 using SymbianUtils.Streams; |
|
22 |
|
23 namespace SymbianStructuresLib.Uids |
|
24 { |
|
25 public class UidType |
|
26 { |
|
27 #region Constructors |
|
28 public UidType() |
|
29 { |
|
30 iUids.Add( 0 ); |
|
31 iUids.Add( 0 ); |
|
32 iUids.Add( 0 ); |
|
33 } |
|
34 |
|
35 public UidType( SymbianStreamReaderLE aReader ) |
|
36 { |
|
37 iUids.Add( aReader.ReadUInt32() ); |
|
38 iUids.Add( aReader.ReadUInt32() ); |
|
39 iUids.Add( aReader.ReadUInt32() ); |
|
40 } |
|
41 #endregion |
|
42 |
|
43 #region API |
|
44 #endregion |
|
45 |
|
46 #region Properties |
|
47 public int Count |
|
48 { |
|
49 get { return iUids.Count; } |
|
50 } |
|
51 |
|
52 public uint this[ int aIndex ] |
|
53 { |
|
54 get |
|
55 { |
|
56 return iUids[ aIndex ]; |
|
57 } |
|
58 set |
|
59 { |
|
60 iUids[ aIndex ] = value; |
|
61 } |
|
62 } |
|
63 |
|
64 public uint MostSignificant |
|
65 { |
|
66 get |
|
67 { |
|
68 uint ret = 0; |
|
69 // |
|
70 if ( Count > 0 ) |
|
71 { |
|
72 ret = this[ Count - 1 ]; |
|
73 } |
|
74 // |
|
75 return ret; |
|
76 } |
|
77 set |
|
78 { |
|
79 iUids[ iUids.Count - 1 ] = value; |
|
80 } |
|
81 } |
|
82 #endregion |
|
83 |
|
84 #region Internal methods |
|
85 #endregion |
|
86 |
|
87 #region From System.Object |
|
88 public override string ToString() |
|
89 { |
|
90 StringBuilder ret = new StringBuilder(); |
|
91 // |
|
92 for( int i=0; i<iUids.Count; i++ ) |
|
93 { |
|
94 uint val = iUids[ i ]; |
|
95 // |
|
96 { |
|
97 ret.AppendFormat( "{0:x8}", val ); |
|
98 if ( i < 2 ) |
|
99 { |
|
100 ret.Append( ", " ); |
|
101 } |
|
102 } |
|
103 } |
|
104 // |
|
105 return ret.ToString(); |
|
106 } |
|
107 #endregion |
|
108 |
|
109 #region Data members |
|
110 private List<uint> iUids = new List<uint>(); |
|
111 #endregion |
|
112 } |
|
113 } |