|
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 @file |
|
18 @internalTechnology |
|
19 @released |
|
20 */ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32debug.h> |
|
24 |
|
25 #include "symbianelfstringinfo.h" |
|
26 #include "symbianelfstringinfov2.h" |
|
27 |
|
28 /** |
|
29 1st stage construction |
|
30 @return pointer to the newly created object, caller takes ownership of the object. |
|
31 */ |
|
32 CStringInfoTableV2 *CStringInfoTableV2::NewLC() |
|
33 { |
|
34 CStringInfoTableV2 *self = new(ELeave) CStringInfoTableV2(); |
|
35 CleanupStack::PushL(self); |
|
36 self->ConstructL(); |
|
37 return self; |
|
38 } |
|
39 |
|
40 /** |
|
41 1st stage construction |
|
42 @return pointer to the newly created object, caller takes ownership of the object. |
|
43 */ |
|
44 CStringInfoTableV2 *CStringInfoTableV2::NewL() |
|
45 { |
|
46 CStringInfoTableV2 *self = CStringInfoTableV2::NewLC(); |
|
47 CleanupStack::Pop(self); |
|
48 return self; |
|
49 } |
|
50 |
|
51 /** |
|
52 1st stage construction |
|
53 @return pointer to new object |
|
54 @param aStrings Buffer containing existing set of NULL terminated strings |
|
55 @leave One of the system wide codes |
|
56 */ |
|
57 CStringInfoTableV2* CStringInfoTableV2::NewL(const TDesC8& aStrings) |
|
58 { |
|
59 CStringInfoTableV2 *self = CStringInfoTableV2::NewLC(aStrings); |
|
60 CleanupStack::Pop(self); |
|
61 return self; |
|
62 } |
|
63 |
|
64 /** |
|
65 1st stage construction |
|
66 @return pointer to new object |
|
67 @param aStrings Buffer containing existing set of NULL terminated strings |
|
68 @leave One of the system wide codes |
|
69 */ |
|
70 CStringInfoTableV2* CStringInfoTableV2::NewLC(const TDesC8& aStrings) |
|
71 { |
|
72 CStringInfoTableV2 *self = new(ELeave) CStringInfoTableV2(); |
|
73 CleanupStack::PushL(self); |
|
74 self->ConstructL(aStrings); |
|
75 return self; |
|
76 } |
|
77 |
|
78 /** |
|
79 dtor closes string buffer |
|
80 */ |
|
81 CStringInfoTableV2::~CStringInfoTableV2() |
|
82 { |
|
83 iBuffer.Close(); |
|
84 } |
|
85 |
|
86 /** |
|
87 ctor nothing really |
|
88 */ |
|
89 CStringInfoTableV2::CStringInfoTableV2() |
|
90 { |
|
91 } |
|
92 |
|
93 /** |
|
94 2nd stage construction. |
|
95 Creates string buffer and populates it with strings present in every ELF dump file. |
|
96 @leave one of the system wide error codes |
|
97 */ |
|
98 void CStringInfoTableV2::ConstructL() |
|
99 { |
|
100 //LOG_MSG("->CStringInfoTable::ConstructL()\n"); |
|
101 iBuffer.CreateL(KEmpty, KEmpty().Length()+1); |
|
102 iBuffer.AppendFill((TChar)0, 1); |
|
103 iBuffer.ReAllocL(iBuffer.Length()+KSymbian().Length()+1); |
|
104 iBuffer.Append(KSymbian); |
|
105 iBuffer.AppendFill((TChar)0, 1); |
|
106 iBuffer.ReAllocL(iBuffer.Length()+KThread().Length()+1); |
|
107 iBuffer.Append(KThread); |
|
108 iBuffer.AppendFill((TChar)0, 1); |
|
109 iBuffer.ReAllocL(iBuffer.Length()+KProcess().Length()+1); |
|
110 iBuffer.Append(KProcess); |
|
111 iBuffer.AppendFill((TChar)0, 1); |
|
112 iBuffer.ReAllocL(iBuffer.Length()+KExecutable().Length()+1); |
|
113 iBuffer.Append(KExecutable); |
|
114 iBuffer.AppendFill((TChar)0, 1); |
|
115 iBuffer.ReAllocL(iBuffer.Length()+KStr().Length()+1); |
|
116 iBuffer.Append(KStr); |
|
117 iBuffer.AppendFill((TChar)0, 1); |
|
118 iBuffer.ReAllocL(iBuffer.Length()+KSymbianElfCoreDumpVersion().Length()+1); |
|
119 iBuffer.Append(KSymbianElfCoreDumpVersion); |
|
120 iBuffer.AppendFill((TChar)0, 1); |
|
121 } |
|
122 |
|
123 /** |
|
124 2nd stage construction. |
|
125 Creates string buffer and populates it with param |
|
126 @param aStrings initial buffer |
|
127 @leave one of the system wide error codes |
|
128 */ |
|
129 void CStringInfoTableV2::ConstructL(const TDesC8& aStrings) |
|
130 { |
|
131 iBuffer.CreateL(aStrings); |
|
132 } |
|
133 |
|
134 /** |
|
135 |
|
136 @param aItem: The string to be added to internal buffer |
|
137 @return offset at which the aItem was added to internal buffer |
|
138 @leave one of the system wide error codes |
|
139 */ |
|
140 TUint CStringInfoTableV2::AddStringL(const TDesC8 &aItem) |
|
141 { |
|
142 //LOG_MSG("->CStringInfoTable::AddStringL()\n"); |
|
143 TUint index = iBuffer.Length(); |
|
144 iBuffer.ReAllocL(iBuffer.Length() + aItem.Length() + 1); |
|
145 iBuffer.Append(aItem); |
|
146 iBuffer.AppendFill((TChar)0, 1); |
|
147 return index; |
|
148 } |