|
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.Generic; |
|
20 using System.Text; |
|
21 using SymbianUtils; |
|
22 using CrashItemLib; |
|
23 |
|
24 namespace CrashItemLib.PluginAPI |
|
25 { |
|
26 public class CFFTraceLine |
|
27 { |
|
28 #region Constructors |
|
29 public CFFTraceLine( string aLine, long aLineNumber, CFFSource aSource ) |
|
30 { |
|
31 iLine = aLine; |
|
32 iLineNumber = aLineNumber; |
|
33 iSource = aSource; |
|
34 } |
|
35 #endregion |
|
36 |
|
37 #region API |
|
38 public byte[] ToBinary() |
|
39 { |
|
40 List<byte> ret = new List<byte>(); |
|
41 |
|
42 // We just want to map the raw unicode character onto a single byte. |
|
43 // ASCII range is probably not sufficient (guess?) so this is why we |
|
44 // do not use System.Text.ASCIIEncoding, but rather roll our own. |
|
45 string line = iLine + System.Environment.NewLine; |
|
46 foreach ( char c in line ) |
|
47 { |
|
48 byte b = System.Convert.ToByte( c ); |
|
49 ret.Add( b ); |
|
50 } |
|
51 |
|
52 return ret.ToArray(); |
|
53 } |
|
54 #endregion |
|
55 |
|
56 #region Properties |
|
57 public string Line |
|
58 { |
|
59 get { return iLine; } |
|
60 } |
|
61 |
|
62 public long LineNumber |
|
63 { |
|
64 get { return iLineNumber; } |
|
65 } |
|
66 |
|
67 public CFFSource Descriptor |
|
68 { |
|
69 get { return iSource; } |
|
70 } |
|
71 #endregion |
|
72 |
|
73 #region Operators |
|
74 public static implicit operator string( CFFTraceLine aLine ) |
|
75 { |
|
76 return aLine.Line; |
|
77 } |
|
78 #endregion |
|
79 |
|
80 #region Data members |
|
81 private readonly string iLine; |
|
82 private readonly long iLineNumber; |
|
83 private readonly CFFSource iSource; |
|
84 #endregion |
|
85 } |
|
86 } |