|
1 /* |
|
2 * Copyright (c) 2006-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 |
|
18 |
|
19 #include "CmdGlobals.h" |
|
20 #ifdef __WIN__ |
|
21 #pragma warning(disable:4786) |
|
22 #endif |
|
23 |
|
24 #include <xercesc/dom/DOM.hpp> |
|
25 #include <xercesc/framework/LocalFileFormatTarget.hpp> |
|
26 #include <iostream> |
|
27 #include <fstream> |
|
28 #include <vector> |
|
29 #include <algorithm> |
|
30 #include <time.h> |
|
31 |
|
32 #include "ReportGeneratorConstants.h" |
|
33 #include "CmdGlobals.h" |
|
34 #include "ReportIssue.h" |
|
35 #include "XMLModuleErrorHandler.h" |
|
36 #include "HAException.h" |
|
37 #include "Utils.h" |
|
38 #include "Issues.h" |
|
39 #include "BBCFileUtils.h" |
|
40 using namespace std; |
|
41 |
|
42 extern vector<pair<string,pair<string,string> > > HeaderInfoList; // vector<pair< headerfile name, pair<API name, API category>>> |
|
43 |
|
44 XERCES_CPP_NAMESPACE_USE |
|
45 |
|
46 |
|
47 const char* KXMLStyleSheet = "xml-stylesheet"; |
|
48 |
|
49 // Style sheet filename |
|
50 const char* KXMLXSL = "type=\"text/xsl\" href=\"BBCResults.xsl\""; |
|
51 // Base64 coding characters |
|
52 const char* KBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-"; |
|
53 |
|
54 #include "ReportGenerator.h" |
|
55 |
|
56 // ---------------------------------------------------------------------------- |
|
57 // ReportGenerator::ReportGenerator |
|
58 // ---------------------------------------------------------------------------- |
|
59 // |
|
60 ReportGenerator::ReportGenerator(string aOutputFile) |
|
61 : |
|
62 iOutputFile(aOutputFile), |
|
63 iIssueId(0), |
|
64 iDOMDocument(0), |
|
65 iDOMRoot(0) |
|
66 { |
|
67 // START -- Support for file checksum and comments |
|
68 unsigned long crc; |
|
69 iCrcTable = new unsigned long[256]; |
|
70 for ( int i = 0; i <= 255 ; i++ ) |
|
71 { |
|
72 crc = i; |
|
73 for ( int j = 8 ; j > 0; j-- ) |
|
74 { |
|
75 if ( crc & 1 ) |
|
76 crc = ( crc >> 1 ) ^ 0xEDB88320L; |
|
77 else |
|
78 crc >>= 1; |
|
79 } |
|
80 iCrcTable[i] = crc; |
|
81 } |
|
82 // END -- Support for file checksum and comments |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------------------------------- |
|
86 // ReportGenerator::~ReportGenerator |
|
87 // ---------------------------------------------------------------------------- |
|
88 // |
|
89 ReportGenerator::~ReportGenerator() |
|
90 { |
|
91 // START -- Support for file checksum and comments |
|
92 delete iCrcTable; |
|
93 iCrcTable = NULL; |
|
94 // END -- Support for file checksum and comments |
|
95 if( iDOMDocument ) |
|
96 { |
|
97 iDOMDocument->release(); |
|
98 } |
|
99 for( issueMap::iterator i = iIssueMap.begin(); i != iIssueMap.end(); ++i ) |
|
100 { |
|
101 delete i->second; |
|
102 i->second = 0; |
|
103 } |
|
104 } |
|
105 |
|
106 // ---------------------------------------------------------------------------- |
|
107 // ReportGenerator::setXSL |
|
108 // ---------------------------------------------------------------------------- |
|
109 // |
|
110 void ReportGenerator::setXSL(string aXSLFilename, bool aIncludeInXML) |
|
111 { |
|
112 iXSLFile = aXSLFilename; |
|
113 iEmbedXSL = aIncludeInXML; |
|
114 } |
|
115 |
|
116 // ---------------------------------------------------------------------------- |
|
117 // ReportGenerator::setDTD |
|
118 // ---------------------------------------------------------------------------- |
|
119 // |
|
120 void ReportGenerator::setDTD(string aDTDFilename, bool aIncludeInDTD) |
|
121 { |
|
122 iDTDFile = aDTDFilename; |
|
123 iEmbedDTD = aIncludeInDTD; |
|
124 } |
|
125 |
|
126 // ---------------------------------------------------------------------------- |
|
127 // ReportGenerator::startReport |
|
128 // ---------------------------------------------------------------------------- |
|
129 // |
|
130 void ReportGenerator::startReport() |
|
131 { |
|
132 initialiseDOM(); |
|
133 } |
|
134 |
|
135 // ---------------------------------------------------------------------------- |
|
136 // ReportGenerator::finishReport |
|
137 // ---------------------------------------------------------------------------- |
|
138 // |
|
139 void ReportGenerator::finishReport() |
|
140 { |
|
141 DOMElement* issuelist = createIssueListNode(); |
|
142 iDOMRoot->appendChild(issuelist); |
|
143 dumpDOMToFile(); |
|
144 } |
|
145 |
|
146 // ---------------------------------------------------------------------------- |
|
147 // ReportGenerator::loadStringTables |
|
148 // ---------------------------------------------------------------------------- |
|
149 // |
|
150 void ReportGenerator::loadStringTables(string aFilename) |
|
151 { |
|
152 } |
|
153 |
|
154 // ---------------------------------------------------------------------------- |
|
155 // ReportGenerator::setCmdLineParms |
|
156 // ---------------------------------------------------------------------------- |
|
157 // |
|
158 void ReportGenerator::setCmdLineParms(map<string, string> aParms) |
|
159 { |
|
160 map<string, string>::iterator begin = aParms.begin(); |
|
161 map<string, string>::iterator end = aParms.end(); |
|
162 while (begin != end) |
|
163 { |
|
164 iParams.insert(*begin); |
|
165 begin++; |
|
166 } |
|
167 } |
|
168 |
|
169 // ---------------------------------------------------------------------------- |
|
170 // ReportGenerator::getCmdLineParm |
|
171 // ---------------------------------------------------------------------------- |
|
172 // |
|
173 string ReportGenerator::getCmdLineParm(string aParm) |
|
174 { |
|
175 map<string, string>::iterator begin = iParams.find(aParm); |
|
176 if (begin != iParams.end()) |
|
177 { |
|
178 return (*begin).second; |
|
179 } |
|
180 else |
|
181 { |
|
182 return "Not specified"; |
|
183 } |
|
184 } |
|
185 |
|
186 |
|
187 // ---------------------------------------------------------------------------- |
|
188 // ReportGenerator::setVersions |
|
189 // ---------------------------------------------------------------------------- |
|
190 // |
|
191 void ReportGenerator::setVersions(string aBaseline, string aCurrent) |
|
192 { |
|
193 iBaselineVersion = aBaseline; |
|
194 iCurrentVersion = aCurrent; |
|
195 } |
|
196 |
|
197 // ---------------------------------------------------------------------------- |
|
198 // ReportGenerator::addIssue |
|
199 // ---------------------------------------------------------------------------- |
|
200 // |
|
201 int ReportGenerator::addIssue(ReportIssue* aIssue) |
|
202 { |
|
203 aIssue->iId = iIssueId++; |
|
204 |
|
205 string key = "<"; |
|
206 key += aIssue->HeaderFile(); |
|
207 key += "><"; |
|
208 key += aIssue->CompareFileName(); |
|
209 key += ">"; |
|
210 |
|
211 issueMapIterator it = iIssueMap.find(key); |
|
212 if (it != iIssueMap.end()) |
|
213 { |
|
214 bool lineInfoNeed = true; |
|
215 // header entry is present in the report. append the issue to the header issue list |
|
216 issueVector* v = it->second; |
|
217 issueVector::iterator iv_it=v->begin(); |
|
218 bool notAnalysed = false; |
|
219 for (; iv_it != v->end(); ++iv_it) |
|
220 { |
|
221 ReportIssue* issue = iv_it->second; |
|
222 |
|
223 TIssueIdentity id = issue->IdentityId(); |
|
224 TIssueType type = issue->TypeId(); |
|
225 if( id == EIssueIdentityFile && type == EIssueTypeEmpty) |
|
226 { |
|
227 notAnalysed = true; |
|
228 lineInfoNeed = issue->LineInfoNeeded(); |
|
229 break; |
|
230 } |
|
231 } |
|
232 if(lineInfoNeed == false) |
|
233 { |
|
234 aIssue->SetLineNumber(0); |
|
235 } |
|
236 if( v->insert(pair<const ReportIssue*, ReportIssue*>(aIssue,aIssue)).second == false ) |
|
237 { |
|
238 return -1; |
|
239 } |
|
240 } else |
|
241 { |
|
242 // header entry is not present in the report. create an entry for the header with this issue |
|
243 issueVector* v = new issueVector(); |
|
244 v->insert(pair<const ReportIssue*, ReportIssue*>(aIssue,aIssue)); |
|
245 issueEntry entry(key,v); |
|
246 iIssueMap.insert(entry); |
|
247 } |
|
248 |
|
249 return iIssueId-1; |
|
250 } |
|
251 |
|
252 // ---------------------------------------------------------------------------- |
|
253 // ReportGenerator::addIssue |
|
254 // ---------------------------------------------------------------------------- |
|
255 // |
|
256 int ReportGenerator::addIssue(const string& aFile, |
|
257 const string& aFQName, const TIssueIdentity& aIdentityId, |
|
258 const TIssueType& aTypeId, const TBCSeverity& aBCSeverityId, |
|
259 const TSCSeverity& aSCSeverityId, const string& aIgnoreInformation, |
|
260 int aLineNumber, const string& aCompareFileName, const string& aCompilationError, bool alineNoNeeded ) |
|
261 { |
|
262 string fqName = aFQName; |
|
263 int loc = fqName.find(__FUN_MANGLED__); |
|
264 if(loc != -1) |
|
265 { |
|
266 fqName = fqName.substr(0,loc); |
|
267 } |
|
268 ReportIssue* issue = new ReportIssue(0, aFile, fqName, |
|
269 aIdentityId, aTypeId, aBCSeverityId, aSCSeverityId, aIgnoreInformation, |
|
270 aLineNumber, aCompareFileName, aCompilationError, alineNoNeeded ); |
|
271 |
|
272 /*return*/ |
|
273 int ret = addIssue(issue); |
|
274 if( ret == -1) |
|
275 { |
|
276 delete issue; |
|
277 } |
|
278 return ret; |
|
279 } |
|
280 |
|
281 // ---------------------------------------------------------------------------- |
|
282 // ReportGenerator::dumpXSLToFile |
|
283 // ---------------------------------------------------------------------------- |
|
284 // |
|
285 void ReportGenerator::dumpXSLToFile() |
|
286 { |
|
287 } |
|
288 |
|
289 // ---------------------------------------------------------------------------- |
|
290 // ReportGenerator::dumpDTDToFile |
|
291 // ---------------------------------------------------------------------------- |
|
292 // |
|
293 void ReportGenerator::dumpDTDToFile() |
|
294 { |
|
295 } |
|
296 |
|
297 // ---------------------------------------------------------------------------- |
|
298 // ReportGenerator::dumpDOMToFile |
|
299 // ---------------------------------------------------------------------------- |
|
300 // |
|
301 void ReportGenerator::dumpDOMToFile() |
|
302 { |
|
303 XMLCh* features = _X("Core"); |
|
304 DOMImplementation* imp = DOMImplementationRegistry::getDOMImplementation(features); |
|
305 _XX(features); |
|
306 DOMWriter* writer = ((DOMImplementationLS*)imp)->createDOMWriter(); |
|
307 |
|
308 writer->setFeature( XMLUni::fgDOMWRTFormatPrettyPrint,true); |
|
309 DOMErrorHandler* errorHandler = new XMLModuleErrorHandler(); |
|
310 // Set error handler |
|
311 writer->setErrorHandler(errorHandler); |
|
312 XMLCh* tempfilename = XMLString::transcode(iOutputFile.c_str()); |
|
313 XMLFormatTarget* ft = new LocalFileFormatTarget(tempfilename); |
|
314 writer->writeNode(ft, *iDOMDocument); |
|
315 XMLString::release(&tempfilename); |
|
316 delete ft; |
|
317 writer->release(); |
|
318 delete errorHandler; |
|
319 } |
|
320 |
|
321 // ---------------------------------------------------------------------------- |
|
322 // ReportGenerator::generateVersionIdNodes |
|
323 // ---------------------------------------------------------------------------- |
|
324 // |
|
325 void ReportGenerator::generateVersionIdNodes() |
|
326 { |
|
327 } |
|
328 |
|
329 // ---------------------------------------------------------------------------- |
|
330 // ReportGenerator::initialiseDOM |
|
331 // ---------------------------------------------------------------------------- |
|
332 // |
|
333 void ReportGenerator::initialiseDOM() |
|
334 { |
|
335 XMLCh * features = _X("Core"); |
|
336 DOMImplementation* imp = DOMImplementationRegistry::getDOMImplementation(features); |
|
337 _XX(features); |
|
338 if (imp != NULL) |
|
339 { |
|
340 try |
|
341 { |
|
342 XMLCh * repRoot = _X(NODE_REPORTROOT); |
|
343 DOMDocument* doc = imp->createDocument(NULL, repRoot, NULL); |
|
344 _XX(repRoot); |
|
345 if( iDOMDocument ) |
|
346 { |
|
347 iDOMDocument->release(); |
|
348 iDOMDocument = 0; |
|
349 } |
|
350 iDOMDocument = doc; |
|
351 |
|
352 XMLCh * stylesheet = XMLString::transcode(KXMLStyleSheet); |
|
353 XMLCh * xsl = XMLString::transcode(KXMLXSL); |
|
354 |
|
355 // Style sheet is inserted to DOM document |
|
356 iDOMDocument->insertBefore( |
|
357 iDOMDocument->createProcessingInstruction( |
|
358 stylesheet, |
|
359 xsl |
|
360 ), |
|
361 iDOMDocument->getDocumentElement() |
|
362 ); |
|
363 XMLString::release(&stylesheet); |
|
364 XMLString::release(&xsl); |
|
365 |
|
366 iDOMRoot = iDOMDocument->getDocumentElement(); |
|
367 // Header node created |
|
368 DOMElement* header = createHeaderNode(); |
|
369 iDOMRoot->appendChild(header); |
|
370 } catch (const XMLException& /*e*/) |
|
371 { |
|
372 throw HAException("Error initialising the DOM Document"); |
|
373 } |
|
374 } |
|
375 } |
|
376 |
|
377 // ---------------------------------------------------------------------------- |
|
378 // ReportGenerator::uninitialiseDOM |
|
379 // ---------------------------------------------------------------------------- |
|
380 // |
|
381 void ReportGenerator::uninitialiseDOM() |
|
382 { |
|
383 } |
|
384 |
|
385 // ---------------------------------------------------------------------------- |
|
386 // ReportGenerator::createOpenNode |
|
387 // ---------------------------------------------------------------------------- |
|
388 // |
|
389 DOMElement* ReportGenerator::createOpenNode(const char* aNodeName) |
|
390 { |
|
391 DOMElement* ret = NULL; |
|
392 XMLCh* ch = XMLString::transcode(aNodeName); |
|
393 ret = iDOMDocument->createElement(ch); |
|
394 XMLString::release(&ch); |
|
395 return ret; |
|
396 } |
|
397 |
|
398 // ---------------------------------------------------------------------------- |
|
399 // ReportGenerator::createHeaderNode |
|
400 // ---------------------------------------------------------------------------- |
|
401 // |
|
402 DOMElement* ReportGenerator::createHeaderNode() |
|
403 { |
|
404 DOMElement* ret = NULL; |
|
405 ret = createOpenNode(NODE_HEADER); |
|
406 vector<DOMElement*> childvec; |
|
407 |
|
408 childvec.push_back(createSimpleTextNode(NODE_HEADER_BASELINEVERSION, iBaselineVersion.c_str())); |
|
409 childvec.push_back(createSimpleTextNode(NODE_HEADER_CURRENTVERSION, iCurrentVersion.c_str())); |
|
410 childvec.push_back(createTimestampNode()); |
|
411 childvec.push_back(createSimpleTextNode(NODE_HEADER_HAVERSION, HEADER_ANALYSER_VERSION)); |
|
412 childvec.push_back(createSimpleTextNode(NODE_HEADER_FORMATVERSION, HEADER_ANALYSER_REPORT_VERSION)); |
|
413 childvec.push_back(createCmdLineNode()); |
|
414 |
|
415 appendChildrenToNode(ret, childvec); |
|
416 return ret; |
|
417 } |
|
418 |
|
419 // ---------------------------------------------------------------------------- |
|
420 // ReportGenerator::removeRemovedSubClasses |
|
421 // ---------------------------------------------------------------------------- |
|
422 // |
|
423 void ReportGenerator::removeRemovedSubClasses() |
|
424 { |
|
425 issueMapIterator it = iIssueMap.begin(); |
|
426 for (; it != iIssueMap.end();++it) |
|
427 { |
|
428 issueVector* iv = it->second; |
|
429 issueVector::iterator iv_it=iv->begin(); |
|
430 |
|
431 for (; iv_it != iv->end(); ++iv_it) |
|
432 { |
|
433 ReportIssue* issue = iv_it->second; |
|
434 |
|
435 TIssueIdentity id = issue->IdentityId(); |
|
436 TIssueType type = issue->TypeId(); |
|
437 |
|
438 //Do not process macros or other than issues type "removed" |
|
439 if ( EIssueTypeRemoval == type && EIssueIdentityMacro != id ) |
|
440 { |
|
441 string fqname = issue->FQName(); |
|
442 fqname += "::"; |
|
443 |
|
444 issueVector::iterator iv_it2=iv_it; |
|
445 ++iv_it2; |
|
446 |
|
447 for (; iv_it2 != iv->end(); ++iv_it2) |
|
448 { |
|
449 ReportIssue* issue2 = iv_it2->second; |
|
450 string fqname2 = issue2->FQName(); |
|
451 |
|
452 //If the issue is inside removed class it can be removed from list |
|
453 if ( 0 == fqname2.compare(0, fqname.length(), fqname) ) |
|
454 { |
|
455 issueVector::iterator iv_it3 = iv_it2; |
|
456 --iv_it2; |
|
457 iv->erase(iv_it3); |
|
458 } else //No more issues inside removed class so break |
|
459 { |
|
460 break; |
|
461 } |
|
462 } |
|
463 } |
|
464 } |
|
465 |
|
466 } |
|
467 } |
|
468 |
|
469 // ---------------------------------------------------------------------------- |
|
470 // ReportGenerator::functionMapping |
|
471 // ---------------------------------------------------------------------------- |
|
472 // |
|
473 TIssueIdentity ReportGenerator::functionMapping(const vector<TIssueIdentity> & ids) |
|
474 { |
|
475 |
|
476 TIssueIdentity ret = EIssueIdentityExportedFunction; |
|
477 |
|
478 if (ids.size() == 1) |
|
479 { |
|
480 ret = ids[0]; |
|
481 } |
|
482 else if (ids.size() == 3) |
|
483 { |
|
484 ret = EIssueIdentityExportedVirtualInlineFunction; |
|
485 } |
|
486 else |
|
487 { |
|
488 if ( (EIssueIdentityExportedFunction == ids[0] && EIssueIdentityVirtualFunction == ids[1]) || |
|
489 (EIssueIdentityExportedFunction == ids[1] && EIssueIdentityVirtualFunction == ids[0]) ) |
|
490 { |
|
491 ret = EIssueIdentityExportedVirtualFunction; |
|
492 } else if ( (EIssueIdentityExportedFunction == ids[0] && EIssueIdentityInlineFunction == ids[1]) || |
|
493 (EIssueIdentityExportedFunction == ids[1] && EIssueIdentityInlineFunction == ids[0]) ) |
|
494 { |
|
495 ret = EIssueIdentityExportedInlineFunction; |
|
496 } else if ( (EIssueIdentityInlineFunction == ids[0] && EIssueIdentityVirtualFunction == ids[1]) || |
|
497 (EIssueIdentityInlineFunction == ids[1] && EIssueIdentityVirtualFunction == ids[0]) ) |
|
498 { |
|
499 ret = EIssueIdentityVirtualInlineFunction; |
|
500 } |
|
501 } |
|
502 return ret; |
|
503 } |
|
504 |
|
505 // ---------------------------------------------------------------------------- |
|
506 // ReportGenerator::mergeFunctionIssues |
|
507 // ---------------------------------------------------------------------------- |
|
508 // |
|
509 void ReportGenerator::mergeFunctionIssues() |
|
510 { |
|
511 issueMapIterator it = iIssueMap.begin(); |
|
512 for (; it != iIssueMap.end();++it) |
|
513 { |
|
514 issueVector* iv = it->second; |
|
515 issueVector::iterator iv_it=iv->begin(); |
|
516 |
|
517 for (; iv_it != iv->end(); ++iv_it) |
|
518 { |
|
519 ReportIssue* issue = iv_it->second; |
|
520 |
|
521 TIssueIdentity id = issue->IdentityId(); |
|
522 TIssueType type = issue->TypeId(); |
|
523 |
|
524 //Process functions only |
|
525 if ( |
|
526 EIssueIdentityExportedFunction == id || |
|
527 EIssueIdentityInlineFunction == id || |
|
528 EIssueIdentityVirtualFunction == id |
|
529 ) |
|
530 { |
|
531 vector<TIssueIdentity> identities; |
|
532 identities.reserve(3); |
|
533 string fqname = issue->FQName(); |
|
534 identities.push_back(issue->IdentityId()); |
|
535 issueVector::iterator iv_it2=iv_it; |
|
536 ++iv_it2; |
|
537 |
|
538 TBCSeverity bcseverity = issue->BCSeverity(); |
|
539 TSCSeverity scseverity = issue->SCSeverity(); |
|
540 |
|
541 for (; iv_it2 != iv->end(); ++iv_it2) |
|
542 { |
|
543 ReportIssue* issue2 = iv_it2->second; |
|
544 string fqname2 = issue2->FQName(); |
|
545 TIssueType type2 = issue2->TypeId(); |
|
546 |
|
547 //If the issue has same type and it is for the same function |
|
548 if ( (fqname2 == fqname) && (type2 == type) ) |
|
549 { |
|
550 if ( issue2->BCSeverity() < bcseverity ) |
|
551 { |
|
552 bcseverity = issue2->BCSeverity(); |
|
553 } |
|
554 if ( issue2->SCSeverity() < scseverity ) |
|
555 { |
|
556 scseverity = issue2->SCSeverity(); |
|
557 } |
|
558 identities.push_back(issue2->IdentityId()); |
|
559 issueVector::iterator iv_it3 = iv_it2; |
|
560 --iv_it2; |
|
561 iv->erase(iv_it3); |
|
562 } |
|
563 } |
|
564 if (identities.size() > 0) |
|
565 { |
|
566 issue->SetIdentityId( functionMapping(identities) ); |
|
567 issue->SetBCSeverity(bcseverity); |
|
568 issue->SetSCSeverity(scseverity); |
|
569 } |
|
570 } |
|
571 } |
|
572 |
|
573 } |
|
574 } |
|
575 |
|
576 // ---------------------------------------------------------------------------- |
|
577 // ReportGenerator::preprocessIssueList |
|
578 // ---------------------------------------------------------------------------- |
|
579 // |
|
580 void ReportGenerator::preprocessIssueList() |
|
581 { |
|
582 removeRemovedSubClasses(); |
|
583 mergeFunctionIssues(); |
|
584 } |
|
585 |
|
586 |
|
587 // ---------------------------------------------------------------------------- |
|
588 // ReportGenerator::createIssueListNode |
|
589 // ---------------------------------------------------------------------------- |
|
590 // |
|
591 DOMElement* ReportGenerator::createIssueListNode() |
|
592 { |
|
593 preprocessIssueList(); |
|
594 |
|
595 DOMElement* ret = NULL; |
|
596 bool apiFound = false; |
|
597 ret = createOpenNode(NODE_ISSUELIST); |
|
598 issueMapIterator it = iIssueMap.begin(); |
|
599 while (it != iIssueMap.end()) |
|
600 { |
|
601 apiFound = false; |
|
602 issueVector* iv = it->second; |
|
603 issueVector::const_iterator iv_it = iv->begin(); |
|
604 |
|
605 DOMElement* headerfilenode = createOpenNode(NODE_ISSUELIST_HEADERFILE); |
|
606 DOMElement* filenamenode = createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_FILENAME, iv_it->second->HeaderFile().c_str()); |
|
607 headerfilenode->appendChild(filenamenode); |
|
608 |
|
609 // Append compared file here, Check from first Report issue, what was compare file name |
|
610 DOMElement* compareFileNameNode = createSimpleTextNode( |
|
611 NODE_ISSUELIST_HEADERFILE_COMPARE_FILENAME, iv_it->second->CompareFileName().c_str()); |
|
612 |
|
613 headerfilenode->appendChild( compareFileNameNode ); |
|
614 |
|
615 // START -- Support for file checksum and comments |
|
616 DOMElement* statusNode = createSimpleTextNode( NODE_ISSUELIST_HEADERFILE_STATUS, "" ); |
|
617 headerfilenode->appendChild( statusNode ); |
|
618 DOMElement* commentNode = createSimpleTextNode( NODE_ISSUELIST_HEADERFILE_COMMENT, "" ); |
|
619 headerfilenode->appendChild( commentNode ); |
|
620 |
|
621 // If Global header list is found with API info, then fill those in report file. |
|
622 for(unsigned int i = 0; i < HeaderInfoList.size(); i++ ) |
|
623 { |
|
624 if(stricmp (HeaderInfoList.at(i).first.c_str(), iv_it->second->CompareFileName().c_str()) == 0) |
|
625 { |
|
626 DOMElement* apiNode = createAPIAttributeNode( NODE_ISSUELIST_HEADERFILE_ISSUE_APISTRING, |
|
627 HeaderInfoList.at(i).second.first.c_str(), HeaderInfoList.at(i).second.second.c_str() ); |
|
628 headerfilenode->appendChild(apiNode); |
|
629 apiFound = true; |
|
630 } |
|
631 else if (stricmp( HeaderInfoList.at(i).first.c_str(), iv_it->second->HeaderFile().c_str()) == 0) |
|
632 { |
|
633 DOMElement* apiNode = createAPIAttributeNode( NODE_ISSUELIST_HEADERFILE_ISSUE_APISTRING, |
|
634 HeaderInfoList.at(i).second.first.c_str(), HeaderInfoList.at(i).second.second.c_str() ); |
|
635 headerfilenode->appendChild(apiNode); |
|
636 apiFound = true; |
|
637 } |
|
638 if( apiFound == true ) |
|
639 break; |
|
640 } |
|
641 // Global list is present, but the header has not been found from the list, then add api info for the header as "Unknown" |
|
642 if( apiFound == false && HeaderInfoList.size() > 0) |
|
643 { |
|
644 DOMElement* apiNode = createAPIAttributeNode( NODE_ISSUELIST_HEADERFILE_ISSUE_APISTRING, |
|
645 NODE_ISSUELIST_HEADERFILE_APIINFO_UNKNOWN, NODE_ISSUELIST_HEADERFILE_APIINFO_UNKNOWN ); |
|
646 headerfilenode->appendChild(apiNode); |
|
647 } |
|
648 //else no API info will be available for any header. |
|
649 |
|
650 char checksum[14]; |
|
651 if ( strlen( iv_it->second->CompareFileName().c_str() ) > 0) |
|
652 getFileCRC( iv_it->second->CompareFileName().c_str(), checksum ); |
|
653 else |
|
654 getFileCRC( iv_it->second->HeaderFile().c_str(), checksum ); |
|
655 |
|
656 // END -- Support for file checksum and comments |
|
657 |
|
658 //START -- Support for shortname tag |
|
659 string fn; |
|
660 string directory; |
|
661 list<pair<string, string> > dirs; |
|
662 |
|
663 //select current filename to display if it is present, else select base filename |
|
664 if ( strlen( iv_it->second->CompareFileName().c_str() ) > 0) |
|
665 { |
|
666 fn = iv_it->second->CompareFileName().c_str(); |
|
667 dirs = BBCFileUtils::extractFilenames(getCmdLineParm("currentdir")); |
|
668 } |
|
669 else |
|
670 { |
|
671 fn = iv_it->second->HeaderFile().c_str(); |
|
672 dirs = BBCFileUtils::extractFilenames(getCmdLineParm("baselinedir")); |
|
673 } |
|
674 |
|
675 //select appropriate baseline/current dir from the list of baseline/current dirs |
|
676 list<pair<string, string> >::iterator dirbegin = dirs.begin(); |
|
677 int p; |
|
678 for(; dirbegin != dirs.end(); dirbegin++) |
|
679 { |
|
680 p = toLowerCaseWin(fn).find(toLowerCaseWin(dirbegin->first),0); |
|
681 if(p!= string::npos) |
|
682 { |
|
683 directory = dirbegin->first; |
|
684 break; |
|
685 } |
|
686 } |
|
687 |
|
688 // remove baseline/current dir part of the filename |
|
689 string shortfilename; |
|
690 shortfilename.reserve(256); |
|
691 shortfilename = removeBase(fn,directory); |
|
692 |
|
693 // remove any leading directory separators from the filename |
|
694 shortfilename=trimLeadingDirSeparator(shortfilename); |
|
695 shortfilename = toLowerCaseWin(shortfilename); |
|
696 |
|
697 //create the shortname node |
|
698 DOMElement* shortNameNode = createSimpleTextNode( NODE_ISSUELIST_HEADERFILE_SHORTNAME,shortfilename.c_str() ); |
|
699 //END -- Support for shortname tag |
|
700 |
|
701 vector<string> issueids; |
|
702 for (; iv_it != iv->end(); ++iv_it) |
|
703 { |
|
704 ReportIssue* issue = iv_it->second; |
|
705 DOMElement* issuenode = createIssueNode(*issue); |
|
706 headerfilenode->appendChild(issuenode); |
|
707 |
|
708 // START -- Support for file checksum and comments |
|
709 string issueid; |
|
710 char* text; |
|
711 text = _X( issuenode->getElementsByTagName( _X( "typeid" ) )->item(0)->getTextContent() ); |
|
712 issueid = text; |
|
713 _XX( text ); |
|
714 |
|
715 text = _X( issuenode->getElementsByTagName( _X( "identityid" ) )->item(0)->getTextContent() ); |
|
716 issueid += text; |
|
717 _XX( text ); |
|
718 |
|
719 text = _X( issuenode->getElementsByTagName( _X( "cause" ) )->item(0)->getTextContent() ); |
|
720 issueid += text; |
|
721 _XX( text ); |
|
722 |
|
723 issueids.push_back( issueid ); |
|
724 // END -- Support for file checksum and comments |
|
725 } |
|
726 |
|
727 ret->appendChild(headerfilenode); |
|
728 it++; |
|
729 |
|
730 // START -- Support for file checksum and comments |
|
731 sort( issueids.begin(), issueids.end() ); |
|
732 getIssuesCRC( issueids, &checksum[7] ); |
|
733 DOMElement* checksumNode = createSimpleTextNode( NODE_ISSUELIST_HEADERFILE_CHECKSUM, checksum ); |
|
734 headerfilenode->appendChild( checksumNode ); |
|
735 // END -- Support for file checksum and comments |
|
736 |
|
737 //START -- Support for shortname tag |
|
738 // insert the shortname node |
|
739 headerfilenode->appendChild( shortNameNode ); |
|
740 //END -- Support for shortname tag |
|
741 } |
|
742 return ret; |
|
743 } |
|
744 |
|
745 // ---------------------------------------------------------------------------- |
|
746 // ReportGenerator::createHeaderFileNode |
|
747 // ---------------------------------------------------------------------------- |
|
748 // |
|
749 DOMElement* ReportGenerator::createHeaderFileNode() |
|
750 { |
|
751 DOMElement* ret = NULL; |
|
752 ret = createOpenNode(NODE_ISSUELIST_HEADERFILE); |
|
753 return ret; |
|
754 } |
|
755 |
|
756 // START -- Support for file checksum and comments |
|
757 |
|
758 // ---------------------------------------------------------------------------- |
|
759 // ReportGenerator::getIssuesCRC |
|
760 // ---------------------------------------------------------------------------- |
|
761 // |
|
762 void ReportGenerator::getIssuesCRC( const vector<string>& aIssueIdsVector, char* aCrcResult ) |
|
763 { |
|
764 unsigned long crc = 0xFFFFFFFFL; |
|
765 vector<string>::const_iterator iter = aIssueIdsVector.begin(); |
|
766 |
|
767 for ( iter = aIssueIdsVector.begin(); iter != aIssueIdsVector.end(); iter++ ) |
|
768 for ( unsigned char* p = (unsigned char*) (*iter).c_str(); *p != '\0'; p++ ) |
|
769 crc = iCrcTable[ ( crc & 0xff ) ^ *p ] ^ ( crc >> 8 ); |
|
770 crc ^= 0xFFFFFFFFL; |
|
771 |
|
772 // The checksum is base64-encoded into 6 characters before it is returned. |
|
773 for ( int i = 0; i < 6; ++i ) |
|
774 aCrcResult[i] = KBase64[ ( crc >> ( 30 - 6 * i ) ) & 0x3f ]; |
|
775 aCrcResult[6] = '\0'; |
|
776 |
|
777 return; |
|
778 } |
|
779 // END -- Support for file checksum and comments |
|
780 |
|
781 // START -- Support for file checksum and comments |
|
782 |
|
783 // ---------------------------------------------------------------------------- |
|
784 // ReportGenerator::getFileCRC |
|
785 // ---------------------------------------------------------------------------- |
|
786 // |
|
787 void ReportGenerator::getFileCRC( const char* aFilename, char* aCrcResult ) |
|
788 { |
|
789 unsigned long crc; |
|
790 unsigned long previousCrc; |
|
791 unsigned long length = 0; |
|
792 unsigned char* buffer = new unsigned char[512]; |
|
793 unsigned char* p; |
|
794 int count; |
|
795 filebuf file; |
|
796 |
|
797 // Calculate CRC for file; all sequences of whitespace and/or comments |
|
798 // are replaced with _one_ space. |
|
799 // States: |
|
800 // 0 : "within star comment" : starts with "/*" and ends when |
|
801 // the next "*/" is encountered |
|
802 // 1 : "within line comment" : starts with "//" and ends when |
|
803 // the next "/n" or "\r" is encountered |
|
804 // 2 : "normal mode" : "normal" text |
|
805 |
|
806 if ( file.open( aFilename, ios::in ) == NULL ) |
|
807 { |
|
808 strcpy( aCrcResult, "*************"); |
|
809 return; |
|
810 } |
|
811 |
|
812 crc = 0xFFFFFFFFL; |
|
813 previousCrc = 0xFFFFFFFFL; |
|
814 int state = 2; |
|
815 char previousChar = ' '; |
|
816 char slashPreviousChar = ' '; |
|
817 |
|
818 for ( ; ; ) |
|
819 { |
|
820 count = (int) file.sgetn( (char*) buffer, 512 ); |
|
821 if ( count == 0 ) |
|
822 { |
|
823 break; |
|
824 } |
|
825 |
|
826 for ( p = buffer; count-- != 0; p++ ) |
|
827 { |
|
828 if ( state == 0 ) |
|
829 { |
|
830 if ( previousChar == '*' && *p == '/' ) |
|
831 { |
|
832 state = 2; |
|
833 previousChar = slashPreviousChar; |
|
834 *p = ' '; |
|
835 } |
|
836 } |
|
837 else if ( state == 1 ) |
|
838 { |
|
839 if ( *p == '\r' || *p == '\n' ) |
|
840 { |
|
841 state = 2; |
|
842 previousChar = slashPreviousChar; |
|
843 *p = ' '; |
|
844 } |
|
845 } |
|
846 |
|
847 if ( state == 2 ) |
|
848 { |
|
849 if ( *p == '/' && previousChar != '/' ) |
|
850 { |
|
851 slashPreviousChar = previousChar; |
|
852 } |
|
853 |
|
854 if ( previousChar == '/' && *p == '*' ) |
|
855 { |
|
856 state = 0; |
|
857 crc = previousCrc; // previous char should not be included in CRC |
|
858 --length; |
|
859 *p = ' '; // do not allow /*/ to be interpreted as a comment |
|
860 } |
|
861 else if ( previousChar == '/' && *p == '/' ) |
|
862 { |
|
863 state = 1; |
|
864 crc = previousCrc; // previous char should not be included in CRC |
|
865 --length; |
|
866 } |
|
867 else { |
|
868 if ( *p == '\t' || *p == '\r' || *p == '\n' ) |
|
869 { |
|
870 *p = ' '; |
|
871 } |
|
872 if ( *p != ' ' || previousChar != ' ' ) |
|
873 { |
|
874 previousCrc = crc; |
|
875 crc = iCrcTable[ ( crc & 0xff ) ^ *p ] ^ ( crc >> 8 ); |
|
876 ++length; |
|
877 } |
|
878 } |
|
879 } |
|
880 previousChar = *p; |
|
881 } |
|
882 } |
|
883 crc ^= 0xFFFFFFFFL; |
|
884 file.close(); |
|
885 delete buffer; |
|
886 |
|
887 // The 42-bit checksum is made up of |
|
888 // * bits 32-41 : length of file MOD 1024 (10 bits) |
|
889 // * bits 0-31 : the CRC-32 value |
|
890 // This checksum is base64-encoded into 7 characters (42 bits / 6 bits) before it is returned. |
|
891 int val; |
|
892 length &= 0x3ff; |
|
893 |
|
894 for ( int i = 0; i < 7; ++i ) |
|
895 { |
|
896 if ( i == 0 ) |
|
897 val = length >> 4; |
|
898 else if ( i == 1 ) |
|
899 val = ( ( length << 2 ) | ( crc >> 30 ) ) & 0x3f; |
|
900 else |
|
901 val = ( crc >> ( 30 - 6 * ( i - 1 ) ) ) & 0x3f; |
|
902 aCrcResult[i] = KBase64[val]; |
|
903 } |
|
904 aCrcResult[7] = '\0'; |
|
905 |
|
906 return; |
|
907 } |
|
908 // END -- Support for file checksum and comments |
|
909 |
|
910 // ---------------------------------------------------------------------------- |
|
911 // ReportGenerator::createTimestampNode |
|
912 // ---------------------------------------------------------------------------- |
|
913 // |
|
914 DOMElement* ReportGenerator::createTimestampNode() |
|
915 { |
|
916 DOMElement* ret = NULL; |
|
917 int second, minute, hour, day, month, year; |
|
918 |
|
919 time_t ttime; |
|
920 time(&ttime); |
|
921 struct tm* time = localtime(&ttime); |
|
922 second = time->tm_sec; |
|
923 minute = time->tm_min; |
|
924 hour = time->tm_hour; |
|
925 day = time->tm_mday; |
|
926 month = time->tm_mon + 1; |
|
927 year = time->tm_year + 1900; |
|
928 |
|
929 ret = createOpenNode(NODE_HEADER_TIMESTAMP); |
|
930 vector<DOMElement*> childvec; |
|
931 childvec.push_back(createSimpleTextNode(NODE_HEADER_TIMESTAMP_DAY, day)); |
|
932 childvec.push_back(createSimpleTextNode(NODE_HEADER_TIMESTAMP_MONTH, month)); |
|
933 childvec.push_back(createSimpleTextNode(NODE_HEADER_TIMESTAMP_YEAR, year)); |
|
934 childvec.push_back(createSimpleTextNode(NODE_HEADER_TIMESTAMP_HOUR, hour)); |
|
935 childvec.push_back(createSimpleTextNode(NODE_HEADER_TIMESTAMP_MINUTE, minute)); |
|
936 childvec.push_back(createSimpleTextNode(NODE_HEADER_TIMESTAMP_SECOND, second)); |
|
937 |
|
938 appendChildrenToNode(ret, childvec); |
|
939 return ret; |
|
940 } |
|
941 |
|
942 // ---------------------------------------------------------------------------- |
|
943 // ReportGenerator::appendChildrenToNode |
|
944 // ---------------------------------------------------------------------------- |
|
945 // |
|
946 void ReportGenerator::appendChildrenToNode(DOMElement* aParent, const vector<DOMElement*>& aChildren) |
|
947 { |
|
948 size_t count = aChildren.size(); |
|
949 for (unsigned int i = 0; i < count; i++) |
|
950 { |
|
951 aParent->appendChild(aChildren.at(i)); |
|
952 } |
|
953 } |
|
954 |
|
955 // ---------------------------------------------------------------------------- |
|
956 // ReportGenerator::createSimpleTextNode |
|
957 // ---------------------------------------------------------------------------- |
|
958 // |
|
959 DOMElement* ReportGenerator::createSimpleTextNode(const char* aNodeName, const char* aNodeText) |
|
960 { |
|
961 DOMElement* ret = NULL; |
|
962 |
|
963 XMLCh* ch = XMLString::transcode(aNodeName); |
|
964 XMLCh* ch2 = XMLString::transcode(aNodeText); |
|
965 ret = iDOMDocument->createElement(ch); |
|
966 DOMText* tn = iDOMDocument->createTextNode(ch2); |
|
967 ret->appendChild(tn); |
|
968 XMLString::release(&ch); |
|
969 XMLString::release(&ch2); |
|
970 return ret; |
|
971 } |
|
972 |
|
973 // ---------------------------------------------------------------------------- |
|
974 // ReportGenerator::createSimpleTextNode |
|
975 // ---------------------------------------------------------------------------- |
|
976 // |
|
977 DOMElement* ReportGenerator::createSimpleTextNode(const char* aNodeName, const XMLCh* aNodeText) |
|
978 { |
|
979 DOMElement* ret = NULL; |
|
980 XMLCh* ch = XMLString::transcode(aNodeName); |
|
981 ret = iDOMDocument->createElement(ch); |
|
982 DOMText* tn = iDOMDocument->createTextNode(aNodeText); |
|
983 ret->appendChild(tn); |
|
984 XMLString::release(&ch); |
|
985 return ret; |
|
986 } |
|
987 |
|
988 // ---------------------------------------------------------------------------- |
|
989 // ReportGenerator::createSimpleTextNode |
|
990 // ---------------------------------------------------------------------------- |
|
991 // |
|
992 DOMElement* ReportGenerator::createSimpleTextNode(const char* aNodeName, const int aInteger) |
|
993 { |
|
994 DOMElement* ret = NULL; |
|
995 XMLCh* ch = XMLString::transcode(aNodeName); |
|
996 string temp; |
|
997 itoa(aInteger, temp, 10); |
|
998 XMLCh* ch2 = XMLString::transcode(temp.c_str()); |
|
999 ret = iDOMDocument->createElement(ch); |
|
1000 DOMText* tn = iDOMDocument->createTextNode(ch2); |
|
1001 ret->appendChild(tn); |
|
1002 XMLString::release(&ch); |
|
1003 XMLString::release(&ch2); |
|
1004 return ret; |
|
1005 } |
|
1006 // ---------------------------------------------------------------------------- |
|
1007 // ReportGenerator::createAttributeNode |
|
1008 // ---------------------------------------------------------------------------- |
|
1009 // |
|
1010 DOMElement* ReportGenerator::createAPIAttributeNode(const char* aNodeName, const char* aNodeAPI,const char* aNodeCategory) |
|
1011 { |
|
1012 DOMElement* ret = NULL; |
|
1013 |
|
1014 XMLCh* ch = XMLString::transcode(aNodeName); |
|
1015 XMLCh* apivalue = XMLString::transcode(aNodeAPI); |
|
1016 XMLCh* apiName = XMLString::transcode(NODE_ISSUELIST_HEADERFILE_ISSUE_APINAME); |
|
1017 XMLCh* apicategoryvalue = XMLString::transcode(aNodeCategory); |
|
1018 XMLCh* apicategoryname = XMLString::transcode(NODE_ISSUELIST_HEADERFILE_ISSUE_APICATEGORY); |
|
1019 |
|
1020 ret = iDOMDocument->createElement(ch); |
|
1021 ret->setAttribute(apiName,apivalue); |
|
1022 ret->setAttribute(apicategoryname,apicategoryvalue); |
|
1023 |
|
1024 |
|
1025 XMLString::release(&ch); |
|
1026 XMLString::release(&apivalue); |
|
1027 XMLString::release(&apiName); |
|
1028 XMLString::release(&apicategoryvalue); |
|
1029 XMLString::release(&apicategoryname); |
|
1030 return ret; |
|
1031 } |
|
1032 |
|
1033 // ---------------------------------------------------------------------------- |
|
1034 // ReportGenerator::createCmdLineNode |
|
1035 // ---------------------------------------------------------------------------- |
|
1036 // |
|
1037 DOMElement* ReportGenerator::createCmdLineNode() |
|
1038 { |
|
1039 DOMElement* ret = NULL; |
|
1040 ret = createOpenNode(NODE_HEADER_CMDLINE); |
|
1041 map<string, string>::iterator begin = iParams.begin(); |
|
1042 while (begin != iParams.end()) |
|
1043 { |
|
1044 DOMElement* ParamNode = createParmNode((*begin).first.c_str(),(*begin).second.c_str()); |
|
1045 ret->appendChild(ParamNode); |
|
1046 begin++; |
|
1047 } |
|
1048 return ret; |
|
1049 } |
|
1050 |
|
1051 // ---------------------------------------------------------------------------- |
|
1052 // ReportGenerator::createParmNode |
|
1053 // ---------------------------------------------------------------------------- |
|
1054 // |
|
1055 DOMElement* ReportGenerator::createParmNode(const char* aKey, const char* aValue) |
|
1056 { |
|
1057 DOMElement* ret = NULL; |
|
1058 |
|
1059 // value <parm> ** </parm> |
|
1060 ret = createOpenNode(NODE_HEADER_CMDLINE_PARM); |
|
1061 |
|
1062 // <pname> |
|
1063 ret->appendChild(createSimpleTextNode(NODE_HEADER_CMDLINE_PARM_PNAME, aKey)); |
|
1064 // <pvalue> |
|
1065 ret->appendChild(createSimpleTextNode(NODE_HEADER_CMDLINE_PARM_PVALUE, aValue)); |
|
1066 |
|
1067 return ret; |
|
1068 } |
|
1069 |
|
1070 // ---------------------------------------------------------------------------- |
|
1071 // ReportGenerator::createDocumentationUrlString |
|
1072 // ---------------------------------------------------------------------------- |
|
1073 // |
|
1074 string ReportGenerator::createDocumentationUrlString(string element) |
|
1075 { |
|
1076 string ret; |
|
1077 if (getCmdLineParm(DOCURL) != "Not speciefied") |
|
1078 { |
|
1079 ret = getCmdLineParm(DOCURL) + element; |
|
1080 } |
|
1081 else |
|
1082 { |
|
1083 ret = ""; |
|
1084 } |
|
1085 return ret; |
|
1086 } |
|
1087 |
|
1088 // ---------------------------------------------------------------------------- |
|
1089 // ReportGenerator::createIssueNode |
|
1090 // ---------------------------------------------------------------------------- |
|
1091 // |
|
1092 DOMElement* ReportGenerator::createIssueNode(ReportIssue& aIssue) |
|
1093 { |
|
1094 // IssueNode field element to report file |
|
1095 DOMElement* ret = NULL; |
|
1096 |
|
1097 // create file name here |
|
1098 ret = createOpenNode(NODE_ISSUELIST_HEADERFILE_ISSUE); |
|
1099 |
|
1100 vector<DOMElement*> childvec; |
|
1101 |
|
1102 // issue identifier field |
|
1103 childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_ISSUEID, aIssue.Id())); |
|
1104 |
|
1105 // issue type identifier field |
|
1106 childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_TYPEID, aIssue.TypeId())); |
|
1107 |
|
1108 // issue identify ( entity ) identifier field |
|
1109 childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_IDENTITYID, aIssue.IdentityId())); |
|
1110 |
|
1111 // identity description |
|
1112 childvec.push_back(createSimpleTextNode( NODE_ISSUELIST_HEADERFILE_ISSUE_IDENTITYDESCRIPTION, aIssue.IdentityDescription())); |
|
1113 |
|
1114 // issue description field |
|
1115 childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_TYPESTRING, aIssue.TypeDescription())); |
|
1116 |
|
1117 // issue cause description a.k.a FQName |
|
1118 childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_CAUSE, aIssue.FQName().c_str())); |
|
1119 |
|
1120 // issue documentation finder field |
|
1121 childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_DOCUMENTATION, createDocumentationUrlString(aIssue.FQName()).c_str())); |
|
1122 |
|
1123 // issue ignore finder field |
|
1124 childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_IGNOREINFORMATION, aIssue.IgnoreInformationDescription().c_str())); |
|
1125 |
|
1126 // issue linenumber field |
|
1127 childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_LINENUMBER, aIssue.LineNumber())); |
|
1128 |
|
1129 // issue extrainformation field |
|
1130 //childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_EXTRAINFORMATION, aIssue.ExtraInformationDescription().c_str())); |
|
1131 |
|
1132 // binary compatibility severity sub field for issue |
|
1133 DOMElement* bcseverity = createOpenNode(NODE_ISSUELIST_HEADERFILE_ISSUE_SEVERITY); |
|
1134 bcseverity->appendChild(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_SEVERITY_TYPEID, aIssue.BCSeverity())); |
|
1135 bcseverity->appendChild(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_SEVERITY_TYPESTRING, aIssue.BCSeverityDescription())); |
|
1136 |
|
1137 // source compatibility severity sub field for issue |
|
1138 DOMElement* scseverity = createOpenNode(NODE_ISSUELIST_HEADERFILE_ISSUE_SCSEVERITY); |
|
1139 scseverity->appendChild(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_SEVERITY_TYPEID, aIssue.SCSeverity())); |
|
1140 scseverity->appendChild(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_SEVERITY_TYPESTRING, aIssue.SCSeverityDescription())); |
|
1141 |
|
1142 // if iisue type is compilation error, description of compilation error |
|
1143 if(aIssue.TypeId() == EIssueTypeCompilationError) |
|
1144 childvec.push_back(createSimpleTextNode(NODE_ISSUELIST_HEADERFILE_ISSUE_COMPILATION_ERROR, aIssue.CompilationError().c_str())); |
|
1145 |
|
1146 |
|
1147 appendChildrenToNode(ret, childvec); |
|
1148 ret->appendChild(bcseverity); |
|
1149 ret->appendChild(scseverity); |
|
1150 return ret; |
|
1151 } |
|
1152 |
|
1153 // ---------------------------------------------------------------------------- |
|
1154 // ReportGenerator::createSeverityNode |
|
1155 // ---------------------------------------------------------------------------- |
|
1156 // |
|
1157 //DOMElement* ReportGenerator::createSeverityNode(const int aId) |
|
1158 DOMElement* ReportGenerator::createSeverityNode() |
|
1159 { |
|
1160 DOMElement* ret = NULL; |
|
1161 ret = createOpenNode(NODE_ISSUELIST_HEADERFILE_ISSUE_SEVERITY); |
|
1162 return ret; |
|
1163 } |
|
1164 |