crashanalysercmd/Libraries/Engine/CrashItemLib/PluginAPI/FW/CFFTraceLine.cs
changeset 0 818e61de6cd1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/crashanalysercmd/Libraries/Engine/CrashItemLib/PluginAPI/FW/CFFTraceLine.cs	Thu Feb 11 15:50:58 2010 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description:
+*
+*/
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Text;
+using SymbianUtils;
+using CrashItemLib;
+
+namespace CrashItemLib.PluginAPI
+{
+    public class CFFTraceLine
+    {
+        #region Constructors
+        public CFFTraceLine( string aLine, long aLineNumber, CFFSource aSource )
+		{
+            iLine = aLine;
+            iLineNumber = aLineNumber;
+            iSource = aSource;
+        }
+        #endregion
+
+        #region API
+        public byte[] ToBinary()
+        {
+            List<byte> ret = new List<byte>();
+
+            // We just want to map the raw unicode character onto a single byte.
+            // ASCII range is probably not sufficient (guess?) so this is why we
+            // do not use System.Text.ASCIIEncoding, but rather roll our own.
+            string line = iLine + System.Environment.NewLine;
+            foreach ( char c in line )
+            {
+                byte b = System.Convert.ToByte( c );
+                ret.Add( b );
+            }
+
+            return ret.ToArray();
+        }
+        #endregion
+
+        #region Properties
+        public string Line
+        {
+            get { return iLine; }
+        }
+
+        public long LineNumber
+        {
+            get { return iLineNumber; }
+        }
+
+        public CFFSource Descriptor
+        {
+            get { return iSource; }
+        }
+        #endregion
+
+        #region Operators
+        public static implicit operator string( CFFTraceLine aLine )
+        {
+            return aLine.Line;
+        }
+        #endregion
+
+		#region Data members
+        private readonly string iLine;
+        private readonly long iLineNumber;
+        private readonly CFFSource iSource;
+        #endregion
+    }
+}