| 492 | } |
| 493 | |
| 494 | string daeElement::compareResult::format() { |
| 495 | if (!elt1 || !elt2) |
| 496 | return ""; |
| 497 | |
| 498 | // Gather the data we'll be printing |
| 499 | string name1 = formatToken(elt1->getElementName()), |
| 500 | name2 = formatToken(elt2->getElementName()), |
| 501 | type1 = formatToken(elt1->getTypeName()), |
| 502 | type2 = formatToken(elt2->getTypeName()), |
| 503 | id1 = formatToken(elt1->getAttribute("id")), |
| 504 | id2 = formatToken(elt2->getAttribute("id")), |
| 505 | attrName1 = formatToken(attrMismatch), |
| 506 | attrName2 = formatToken(attrMismatch), |
| 507 | attrValue1 = formatToken(elt1->getAttribute(attrMismatch.c_str())), |
| 508 | attrValue2 = formatToken(elt2->getAttribute(attrMismatch.c_str())), |
| 509 | charData1 = formatToken(elt1->getCharData()), |
| 510 | charData2 = formatToken(elt2->getCharData()), |
| 511 | childCount1 = formatToken(cdom::toString(elt1->getChildren().getCount())), |
| 512 | childCount2 = formatToken(cdom::toString(elt2->getChildren().getCount())); |
| 513 | |
| 514 | // Compute formatting information |
| 515 | vector<string> col1Tokens = cdom::makeStringArray("Name", "Type", "ID", |
| 516 | "Attr name", "Attr value", "Char data", "Child count", 0); |
| 517 | vector<string> col2Tokens = cdom::makeStringArray("Element 1", name1.c_str(), |
| 518 | type1.c_str(), id1.c_str(), attrName1.c_str(), attrValue1.c_str(), |
| 519 | charData1.c_str(), childCount1.c_str(), 0); |
| 520 | |
| 521 | int c1w = getNecessaryColumnWidth(col1Tokens), |
| 522 | c2w = getNecessaryColumnWidth(col2Tokens); |
| 523 | ostringstream msg; |
| 524 | msg << setw(c1w) << left << "" << setw(c2w) << left << "Element 1" << "Element 2\n" |
| 525 | << setw(c1w) << left << "" << setw(c2w) << left << "---------" << "---------\n" |
| 526 | << setw(c1w) << left << "Name" << setw(c2w) << left << name1 << name2 << endl |
| 527 | << setw(c1w) << left << "Type" << setw(c2w) << left << type1 << type2 << endl |
| 528 | << setw(c1w) << left << "ID" << setw(c2w) << left << id1 << id2 << endl |
| 529 | << setw(c1w) << left << "Attr name" << setw(c2w) << left << attrName1 << attrName2 << endl |
| 530 | << setw(c1w) << left << "Attr value" << setw(c2w) << left << attrValue1 << attrValue2 << endl |
| 531 | << setw(c1w) << left << "Char data" << setw(c2w) << left << charData1 << charData2 << endl |
| 532 | << setw(c1w) << left << "Child count" << setw(c2w) << left << childCount1 << childCount2; |
| 533 | |
| 534 | return msg.str(); |
| 535 | } |
| 536 | |
| 537 | namespace { |
| 538 | daeElement::compareResult compareMatch() { |