|
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.Text; |
|
20 using System.Threading; |
|
21 using System.Collections; |
|
22 using SymbianUtils; |
|
23 using SymbianUtils.Tracer; |
|
24 using SymbolLib.CodeSegDef; |
|
25 using SymbolLib.Generics; |
|
26 |
|
27 namespace SymbolLib.Engines.Common |
|
28 { |
|
29 public abstract class SymbolEngineBase : GenericSymbolEngine |
|
30 { |
|
31 #region Events |
|
32 public delegate void ParsingStarted( SymbolEngineBase aEngine, string aFileName ); |
|
33 public event ParsingStarted ParsingStartedHandler; |
|
34 |
|
35 public delegate void ParsingProgress( SymbolEngineBase aEngine, string aFileName, int aProgress ); |
|
36 public event ParsingProgress ParsingProgressHandler; |
|
37 |
|
38 public delegate void ParsingCompleted( SymbolEngineBase aEngine, string aFileName ); |
|
39 public event ParsingCompleted ParsingCompletedHandler; |
|
40 |
|
41 public delegate void CollectionCreated( SymbolEngineBase aEngine, GenericSymbolCollection aCollection ); |
|
42 public event CollectionCreated CollectionCreatedHandler; |
|
43 #endregion |
|
44 |
|
45 #region Construct & destruct |
|
46 protected internal SymbolEngineBase( ITracer aTracer ) |
|
47 : base( aTracer ) |
|
48 { |
|
49 } |
|
50 #endregion |
|
51 |
|
52 #region API |
|
53 public abstract bool AddressInRange( long aAddress ); |
|
54 |
|
55 public virtual int FileNameCount |
|
56 { |
|
57 get { return 0; } |
|
58 } |
|
59 |
|
60 public virtual string FileName( int aIndex ) |
|
61 { |
|
62 return string.Empty; |
|
63 } |
|
64 |
|
65 public virtual void LoadFromFile( string aFileName, TSynchronicity aSynchronicity ) |
|
66 { |
|
67 throw new NotSupportedException(); |
|
68 } |
|
69 |
|
70 public virtual bool LoadFromDefinition( CodeSegDefinition aDefinition, TSynchronicity aSynchronicity ) |
|
71 { |
|
72 throw new NotSupportedException(); |
|
73 } |
|
74 |
|
75 public virtual void LoadFromDefinitionCollection( CodeSegDefinitionCollection aCollection, TSynchronicity aSynchronicity ) |
|
76 { |
|
77 foreach ( CodeSegDefinition definition in aCollection ) |
|
78 { |
|
79 LoadFromDefinition( definition, aSynchronicity ); |
|
80 } |
|
81 } |
|
82 |
|
83 public virtual void UnloadAll() |
|
84 { |
|
85 } |
|
86 |
|
87 public virtual bool Unload( CodeSegDefinition aDefinition ) |
|
88 { |
|
89 return false; |
|
90 } |
|
91 |
|
92 public virtual bool IsLoaded( CodeSegDefinition aDefinition ) |
|
93 { |
|
94 return false; |
|
95 } |
|
96 #endregion |
|
97 |
|
98 #region Internal event dispatchers |
|
99 protected void OnParsingStarted( string aFileName ) |
|
100 { |
|
101 if ( ParsingStartedHandler != null ) |
|
102 { |
|
103 ParsingStartedHandler( this, aFileName ); |
|
104 } |
|
105 } |
|
106 |
|
107 protected void OnParsingProgress( string aFileName, int aProgress ) |
|
108 { |
|
109 if ( ParsingProgressHandler != null ) |
|
110 { |
|
111 ParsingProgressHandler( this, aFileName, aProgress ); |
|
112 } |
|
113 } |
|
114 |
|
115 protected void OnParsingCompleted( string aFileName ) |
|
116 { |
|
117 if ( ParsingCompletedHandler != null ) |
|
118 { |
|
119 ParsingCompletedHandler( this, aFileName ); |
|
120 } |
|
121 } |
|
122 |
|
123 protected void OnCollectionCreated( GenericSymbolCollection aCollection ) |
|
124 { |
|
125 if ( CollectionCreatedHandler != null ) |
|
126 { |
|
127 CollectionCreatedHandler( this, aCollection ); |
|
128 } |
|
129 } |
|
130 #endregion |
|
131 |
|
132 #region Data members |
|
133 #endregion |
|
134 } |
|
135 } |