dbgsrv/coredumpserver/plugins/formatters/symbianelf/src/symbianelfstringinfo.cpp
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21  @released
       
    22 */
       
    23 
       
    24 #include <e32base.h>
       
    25 #include "symbianelfstringinfo.h"
       
    26 
       
    27 #include <e32debug.h>
       
    28 
       
    29 /**
       
    30 1st stage construction
       
    31 @return pointer to the newly created object, caller takes ownership of the object.
       
    32 */
       
    33 CStringInfoTable *CStringInfoTable::NewLC()
       
    34 {
       
    35 	CStringInfoTable *self = new(ELeave) CStringInfoTable();
       
    36 	CleanupStack::PushL(self);
       
    37 	self->ConstructL();
       
    38 	return self;
       
    39 }
       
    40 
       
    41 /**
       
    42 1st stage construction
       
    43 @return pointer to the newly created object, caller takes ownership of the object.
       
    44 */
       
    45 CStringInfoTable *CStringInfoTable::NewL()
       
    46 {
       
    47 	CStringInfoTable *self = CStringInfoTable::NewLC();
       
    48 	CleanupStack::Pop(self);
       
    49 	return self;
       
    50 }
       
    51 /**
       
    52 dtor closes string buffer
       
    53 */
       
    54 CStringInfoTable::~CStringInfoTable()
       
    55 {
       
    56 	iBuffer.Close();
       
    57 }
       
    58 
       
    59 /**
       
    60 ctor nothing really
       
    61 */
       
    62 CStringInfoTable::CStringInfoTable()
       
    63 {
       
    64 }
       
    65 
       
    66 /**
       
    67 2nd stage construction.
       
    68 Creates string buffer and populates it with strings present in every ELF dump file.
       
    69 @leave one of the system wide error codes
       
    70 */
       
    71 void CStringInfoTable::ConstructL()
       
    72     {
       
    73     //LOG_MSG("->CStringInfoTable::ConstructL()\n");
       
    74 	iBuffer.CreateL(KEmpty, KEmpty().Length()+1);
       
    75 	iBuffer.AppendFill((TChar)0, 1);
       
    76 	iBuffer.ReAllocL(iBuffer.Length()+KSymbian().Length()+1);
       
    77 	iBuffer.Append(KSymbian);
       
    78 	iBuffer.AppendFill((TChar)0, 1);
       
    79 	iBuffer.ReAllocL(iBuffer.Length()+KThread().Length()+1);
       
    80 	iBuffer.Append(KThread);
       
    81 	iBuffer.AppendFill((TChar)0, 1);
       
    82 	iBuffer.ReAllocL(iBuffer.Length()+KProcess().Length()+1);
       
    83 	iBuffer.Append(KProcess);
       
    84 	iBuffer.AppendFill((TChar)0, 1);
       
    85 	iBuffer.ReAllocL(iBuffer.Length()+KExecutable().Length()+1);	
       
    86 	iBuffer.Append(KExecutable);
       
    87 	iBuffer.AppendFill((TChar)0, 1);
       
    88 	iBuffer.ReAllocL(iBuffer.Length()+KStr().Length()+1);
       
    89 	iBuffer.Append(KStr);
       
    90 	iBuffer.AppendFill((TChar)0, 1);
       
    91 	iBuffer.ReAllocL(iBuffer.Length()+KSymbianElfCoreDumpVersion().Length()+1);
       
    92 	iBuffer.Append(KSymbianElfCoreDumpVersion);
       
    93 	iBuffer.AppendFill((TChar)0, 1);
       
    94 	
       
    95     }
       
    96 
       
    97 /**
       
    98 
       
    99 @param aItem: The string to be added to internal buffer
       
   100 @return offset at which the aItem was added to internal buffer
       
   101 @leave one of the system wide error codes
       
   102 */
       
   103 TUint CStringInfoTable::AddStringL(const TDesC8 &aItem)
       
   104     {
       
   105     //LOG_MSG("->CStringInfoTable::AddStringL()\n");
       
   106 	TUint index = iBuffer.Length();
       
   107 	iBuffer.ReAllocL(iBuffer.Length() + aItem.Length() + 1);
       
   108 	iBuffer.Append(aItem);
       
   109 	iBuffer.AppendFill((TChar)0, 1);
       
   110 	return index;
       
   111     }
       
   112