| author | Mike Kinghan <mikek@symbian.org> |
| Tue, 13 Jul 2010 14:39:25 +0100 | |
| changeset 23 | 0a67eddbe320 |
| parent 2 | 39c28ec933dd |
| permissions | -rwxr-xr-x |
|
2
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
1 |
/* |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
3 |
* All rights reserved. |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
8 |
* |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
9 |
* Initial Contributors: |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
11 |
* |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
12 |
* Contributors: |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
13 |
* |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
14 |
* Description: |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
15 |
* This class is used to receive the enum index of the original |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
16 |
* message with some more variable arguments. These variable |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
17 |
* arguments are split and put into the original message. |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
18 |
* |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
19 |
*/ |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
20 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
21 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
22 |
/** |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
23 |
@file |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
24 |
@internalComponent |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
25 |
@released |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
26 |
*/ |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
27 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
28 |
#include "exceptionreporter.h" |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
29 |
#include "utils.h" |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
30 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
31 |
/** |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
32 |
Constructor receives the variable arguements and gets the instance |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
33 |
of MessageImplementation class. Invokes GetMessage to get the |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
34 |
original message. Find %d and %s inside the original message and |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
35 |
replace these specifiers with the received variable argument value. |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
36 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
37 |
@internalComponent |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
38 |
@released |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
39 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
40 |
@param aMsgIndex - an enum index to get original message from |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
41 |
MessageImplementation class |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
42 |
@param ... - variable arguments. |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
43 |
*/ |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
44 |
ExceptionReporter::ExceptionReporter(int aMsgIndex, ...) |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
45 |
{
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
46 |
iExcepImplPtr = ExceptionImplementation::Instance(0); |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
47 |
iMessage = iExcepImplPtr->Message(aMsgIndex); |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
48 |
int fileNameIndex = 0; |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
49 |
if(iMessage.length() > 0) |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
50 |
{
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
51 |
va_list argList; |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
52 |
va_start(argList,aMsgIndex); |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
53 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
54 |
int intVal; |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
55 |
String strVal; |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
56 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
57 |
unsigned int index = iMessage.find("%");
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
58 |
String subStr = iMessage.substr(index + 1);//skip '%' |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
59 |
while( index != String::npos ) |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
60 |
{
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
61 |
switch(iMessage.at(index + 1)) |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
62 |
{
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
63 |
case 'd': |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
64 |
intVal = va_arg(argList, int); |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
65 |
iMessage.erase(index, 2);//delete two characters "%d" |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
66 |
iMessage.insert(index, ReaderUtil::IntToAscii(intVal, EBase10)); |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
67 |
break; |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
68 |
case 's': |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
69 |
strVal.assign(va_arg(argList, char*)); |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
70 |
#ifdef __TOOLS2__ |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
71 |
fileNameIndex = strVal.find_last_of('\\');
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
72 |
++fileNameIndex; |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
73 |
#endif |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
74 |
#ifdef __LINUX__ |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
75 |
fileNameIndex = strVal.find_last_of('/'); //Remove the
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
76 |
++fileNameIndex; |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
77 |
#endif |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
78 |
strVal = (index != String::npos)? strVal.substr(fileNameIndex) : strVal; |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
79 |
iMessage.erase(index, 2); //delete two characters "%s" |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
80 |
iMessage.insert(index, strVal); |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
81 |
break; |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
82 |
} |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
83 |
index = iMessage.find("%");
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
84 |
} |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
85 |
} |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
86 |
} |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
87 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
88 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
89 |
/** |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
90 |
Destructor. |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
91 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
92 |
@internalComponent |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
93 |
@released |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
94 |
*/ |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
95 |
ExceptionReporter::~ExceptionReporter() |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
96 |
{
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
97 |
} |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
98 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
99 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
100 |
/** |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
101 |
Invokes the Log function of ExceptionImplementation, which puts the |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
102 |
data into logfile directly and takes decision whether to put the same |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
103 |
on standard output or not. |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
104 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
105 |
@internalComponent |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
106 |
@released |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
107 |
*/ |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
108 |
void ExceptionReporter::Log(void) const |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
109 |
{
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
110 |
iExcepImplPtr->Log(iMessage); |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
111 |
} |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
112 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
113 |
/** |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
114 |
Invokes the Report function of ExceptionImplementation to report error or warning. |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
115 |
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
116 |
@internalComponent |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
117 |
@released |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
118 |
*/ |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
119 |
void ExceptionReporter::Report(void) const |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
120 |
{
|
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
121 |
iExcepImplPtr->Report(iMessage); |
|
39c28ec933dd
Removing all prior files. Adding a complete branch of the 'build' package with fixes
mikek
parents:
diff
changeset
|
122 |
} |