|
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.Collections.Generic; |
|
20 using System.Text; |
|
21 using System.Reflection; |
|
22 |
|
23 namespace CrashDebuggerLib.Attributes |
|
24 { |
|
25 public class PropCat : Attribute |
|
26 { |
|
27 #region Enumerations |
|
28 public enum TFormatType |
|
29 { |
|
30 EFormatAsString = 0, |
|
31 EFormatAsDecimal, |
|
32 EFormatAsHex, |
|
33 EFormatAsHexWithoutPrefix, |
|
34 EFormatAsYesNo, |
|
35 EFormatRecurseInto |
|
36 } |
|
37 #endregion |
|
38 |
|
39 #region Constructors |
|
40 public PropCat( string aCategory ) |
|
41 : this( aCategory, string.Empty ) |
|
42 { |
|
43 } |
|
44 |
|
45 public PropCat( string aCategory, string aTitle ) |
|
46 : this( aCategory, aTitle, TFormatType.EFormatAsString ) |
|
47 { |
|
48 } |
|
49 |
|
50 public PropCat( string aCategory, TFormatType aFormatType ) |
|
51 : this( aCategory, string.Empty, aFormatType ) |
|
52 { |
|
53 } |
|
54 |
|
55 public PropCat( string aCategory, string aTitle, TFormatType aFormatType ) |
|
56 : this( aCategory, aTitle, aFormatType, string.Empty ) |
|
57 { |
|
58 } |
|
59 |
|
60 public PropCat( string aCategory, string aTitle, TFormatType aFormatType, string aNumericalFormat ) |
|
61 { |
|
62 iCategory = aCategory; |
|
63 iTitle = aTitle; |
|
64 iFormatType = aFormatType; |
|
65 iNumericalFormat = aNumericalFormat; |
|
66 } |
|
67 #endregion |
|
68 |
|
69 #region Properties |
|
70 public string Category |
|
71 { |
|
72 get { return iCategory; } |
|
73 } |
|
74 |
|
75 public string Title |
|
76 { |
|
77 get { return iTitle; } |
|
78 } |
|
79 |
|
80 public string NumericalFormat |
|
81 { |
|
82 get |
|
83 { |
|
84 string ret = iNumericalFormat; |
|
85 // |
|
86 if ( String.IsNullOrEmpty( ret ) ) |
|
87 { |
|
88 switch ( FormatType ) |
|
89 { |
|
90 case TFormatType.EFormatAsDecimal: |
|
91 ret = "d"; |
|
92 break; |
|
93 case TFormatType.EFormatAsHex: |
|
94 ret = "x"; |
|
95 break; |
|
96 } |
|
97 } |
|
98 // |
|
99 return ret; |
|
100 } |
|
101 } |
|
102 |
|
103 public TFormatType FormatType |
|
104 { |
|
105 get { return iFormatType; } |
|
106 } |
|
107 #endregion |
|
108 |
|
109 #region Internal methods |
|
110 #endregion |
|
111 |
|
112 #region Data members |
|
113 private readonly string iCategory; |
|
114 private readonly string iTitle; |
|
115 private readonly string iNumericalFormat; |
|
116 private readonly TFormatType iFormatType; |
|
117 #endregion |
|
118 } |
|
119 } |