|
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.Text; |
|
20 using SymbianUtils; |
|
21 using SymbianUtils.Tracer; |
|
22 using SymbianDebugLib.Engine; |
|
23 using SymbianDebugLib.Entity; |
|
24 |
|
25 namespace SymbianDebugLib.PluginAPI |
|
26 { |
|
27 public abstract class DbgPluginEngine : DisposableObject, ITracer |
|
28 { |
|
29 #region Constructors |
|
30 protected DbgPluginEngine( DbgEngine aEngine ) |
|
31 { |
|
32 iEngine = aEngine; |
|
33 } |
|
34 #endregion |
|
35 |
|
36 #region API |
|
37 public void Clear() |
|
38 { |
|
39 foreach ( DbgPluginView view in iViews ) |
|
40 { |
|
41 view.Dispose(); |
|
42 } |
|
43 System.Diagnostics.Debug.Assert( iViews.Count == 0 ); |
|
44 iViews.Clear(); |
|
45 // |
|
46 DoClear(); |
|
47 } |
|
48 |
|
49 public bool IsSupported( string aFileName ) |
|
50 { |
|
51 string notNeeded; |
|
52 return IsSupported( aFileName, out notNeeded ); |
|
53 } |
|
54 |
|
55 public DbgPluginView CreateView( string aName ) |
|
56 { |
|
57 DbgPluginView ret = this.DoCreateView( aName ); |
|
58 return ret; |
|
59 } |
|
60 #endregion |
|
61 |
|
62 #region API - framework |
|
63 public abstract bool IsReady |
|
64 { |
|
65 get; |
|
66 } |
|
67 |
|
68 public abstract string Name |
|
69 { |
|
70 get; |
|
71 } |
|
72 |
|
73 public abstract DbgPluginPrimer CreatePrimer(); |
|
74 |
|
75 public abstract bool IsSupported( string aFileName, out string aType ); |
|
76 |
|
77 public virtual object CustomOperation( string aName, object aParam1, object aParam2 ) |
|
78 { |
|
79 throw new NotSupportedException(); |
|
80 } |
|
81 |
|
82 public virtual void PrepareToPrime( DbgEntityList aEntities ) |
|
83 { |
|
84 } |
|
85 |
|
86 protected abstract DbgPluginView DoCreateView( string aName ); |
|
87 |
|
88 protected abstract void DoClear(); |
|
89 #endregion |
|
90 |
|
91 #region API - views |
|
92 internal void CloseView( DbgPluginView aView ) |
|
93 { |
|
94 iViews.Remove( aView ); |
|
95 } |
|
96 #endregion |
|
97 |
|
98 #region Properties |
|
99 public DbgEngine Engine |
|
100 { |
|
101 get { return iEngine; } |
|
102 } |
|
103 #endregion |
|
104 |
|
105 #region Internal methods |
|
106 #endregion |
|
107 |
|
108 #region ITracer Members |
|
109 public void Trace( string aMessage ) |
|
110 { |
|
111 iEngine.Trace( aMessage ); |
|
112 } |
|
113 |
|
114 public void Trace( string aFormat, params object[] aParams ) |
|
115 { |
|
116 iEngine.Trace( aFormat, aParams ); |
|
117 } |
|
118 #endregion |
|
119 |
|
120 #region Data members |
|
121 private readonly DbgEngine iEngine; |
|
122 private List<DbgPluginView> iViews = new List<DbgPluginView>(); |
|
123 #endregion |
|
124 } |
|
125 } |