|
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; |
|
20 using System.Collections.Specialized; |
|
21 using System.Text; |
|
22 using SymbianUtils; |
|
23 using CrashItemLib; |
|
24 |
|
25 namespace CrashItemLib.PluginAPI |
|
26 { |
|
27 public abstract class CFFSourceAndConfidence : CFFSource, IComparable<CFFSourceAndConfidence> |
|
28 { |
|
29 #region Constructors |
|
30 protected CFFSourceAndConfidence( FileInfo aFile ) |
|
31 : base( aFile ) |
|
32 { |
|
33 Level = int.MinValue; |
|
34 } |
|
35 #endregion |
|
36 |
|
37 #region API |
|
38 public void SetCertain() |
|
39 { |
|
40 Level = int.MaxValue; |
|
41 } |
|
42 #endregion |
|
43 |
|
44 #region Properties |
|
45 public int Level |
|
46 { |
|
47 get { return iLevel; } |
|
48 set { iLevel = value; } |
|
49 } |
|
50 |
|
51 public bool IsSupported |
|
52 { |
|
53 get { return !IsUnsupported && MasterFileName != string.Empty && Reader != null; } |
|
54 } |
|
55 |
|
56 public bool IsCertain |
|
57 { |
|
58 get { return Level == int.MaxValue; } |
|
59 } |
|
60 |
|
61 public bool IsUnsupported |
|
62 { |
|
63 get |
|
64 { |
|
65 bool ret = false; |
|
66 |
|
67 // The source cannot be processed if: |
|
68 // |
|
69 // a) Type is not supported |
|
70 // b) The confidence level is "no confidence whatsoever" or |
|
71 // c) There is no reader |
|
72 // |
|
73 if ( Level == int.MinValue ) |
|
74 { |
|
75 ret = true; // (b) |
|
76 } |
|
77 else if ( Reader == null ) |
|
78 { |
|
79 ret = true; // (c) |
|
80 } |
|
81 else if ( OpType == TReaderOperationType.EReaderOpTypeNotSupported ) |
|
82 { |
|
83 ret = true; // (a) |
|
84 } |
|
85 |
|
86 return ret; |
|
87 } |
|
88 } |
|
89 #endregion |
|
90 |
|
91 #region From IComparable<CFFConfidenceLevel> |
|
92 public int CompareTo( CFFSourceAndConfidence aOther ) |
|
93 { |
|
94 int ret = 1; |
|
95 // |
|
96 if ( aOther != null ) |
|
97 { |
|
98 ret = Level.CompareTo( aOther.Level ); |
|
99 } |
|
100 // |
|
101 return ret; |
|
102 } |
|
103 #endregion |
|
104 |
|
105 #region Data members |
|
106 private int iLevel = int.MinValue; |
|
107 #endregion |
|
108 } |
|
109 } |