|
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.Text; |
|
19 using System.IO; |
|
20 using System.Collections.Generic; |
|
21 using CrashAnalyserEngine.Plugins; |
|
22 using CrashItemLib.Crash.Messages; |
|
23 using CrashItemLib.Crash.Container; |
|
24 |
|
25 namespace CAPCrashAnalysis.CommandLine |
|
26 { |
|
27 internal class CACmdLineMessage |
|
28 { |
|
29 #region Enumerations |
|
30 public enum TType |
|
31 { |
|
32 ETypeMessage = 0, |
|
33 ETypeWarning, |
|
34 ETypeError, |
|
35 ETypeDiagnostic |
|
36 } |
|
37 #endregion |
|
38 |
|
39 #region Constructors |
|
40 public CACmdLineMessage( TType aType, string aTitle, string aDescription ) |
|
41 { |
|
42 iType = aType; |
|
43 iTitle = aTitle; |
|
44 iDescription = aDescription; |
|
45 } |
|
46 #endregion |
|
47 |
|
48 #region API |
|
49 public void CopyToContainer( CIContainer aContainer ) |
|
50 { |
|
51 // Diagnostics never appear in the crash item itself. |
|
52 if ( Type != TType.ETypeDiagnostic ) |
|
53 { |
|
54 CIMessage msg = null; |
|
55 // |
|
56 if ( Type == TType.ETypeMessage ) |
|
57 { |
|
58 msg = CIMessage.NewMessage( aContainer ); |
|
59 } |
|
60 else if ( Type == TType.ETypeWarning ) |
|
61 { |
|
62 msg = new CIMessageWarning( aContainer ); |
|
63 } |
|
64 else if ( Type == TType.ETypeError ) |
|
65 { |
|
66 msg = new CIMessageError( aContainer ); |
|
67 } |
|
68 |
|
69 // Build details & add to container |
|
70 msg.Title = this.Title; |
|
71 msg.Description = this.Description; |
|
72 aContainer.Messages.Add( msg ); |
|
73 } |
|
74 } |
|
75 #endregion |
|
76 |
|
77 #region Properties |
|
78 public TType Type |
|
79 { |
|
80 get { return iType; } |
|
81 } |
|
82 |
|
83 public string Title |
|
84 { |
|
85 get { return iTitle; } |
|
86 } |
|
87 |
|
88 public string Description |
|
89 { |
|
90 get { return iDescription; } |
|
91 } |
|
92 #endregion |
|
93 |
|
94 #region Data members |
|
95 private readonly TType iType; |
|
96 private readonly string iTitle; |
|
97 private readonly string iDescription; |
|
98 #endregion |
|
99 } |
|
100 } |