Changeset 670
- Timestamp:
- 1999-10-15T12:01:24+13:00 (25 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/formattools.cpp
r649 r670 28 28 /* 29 29 $Log$ 30 Revision 1.13 1999/10/14 23:01:24 sjboddie 31 changes for new browsing support 32 30 33 Revision 1.12 1999/10/10 08:14:07 sjboddie 31 34 - metadata now returns mp rather than array … … 79 82 // a few function prototypes 80 83 static text_t format_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 81 const text_t &link, const text_t &icon, const text_t &text); 84 const text_t &link, const text_t &icon, 85 const text_t &text, bool highlight); 82 86 83 87 static bool parse_action (text_t::const_iterator &here, const text_t::const_iterator &end, … … 109 113 void formatinfo_t::clear() { 110 114 DocumentImages = false; 111 // note that DocumentTopPages is used in receptionist when translating 112 // OIDs. changing the default here may require changing it there too. 113 DocumentTopPages = true; 114 DocumentHeading = "{Or}{[parent(Top):Title],[Title],untitled}"; 115 DocumentArrowsTop = true; 115 DocumentTitles = true; 116 DocumentHeading = "{Or}{[parent(Top):Title],[Title],untitled}<br>"; 117 DocumentContents = true; 116 118 DocumentArrowsBottom = true; 117 DocumentGoTo = true;118 119 DocumentButtons.erase (DocumentButtons.begin(), DocumentButtons.end()); 119 120 DocumentButtons.push_back ("Detach"); … … 250 251 else if (meta == "Text") 251 252 formatlistptr->command = comDoc; 253 254 else if (meta == "highlight") 255 formatlistptr->command = comHighlight; 256 257 else if (meta == "/highlight") 258 formatlistptr->command = comEndHighlight; 252 259 253 260 else { … … 499 506 500 507 static text_t get_or (ResultDocInfo_t &docinfo, format_t *orptr, 501 const text_t &link, const text_t &icon, const text_t &text) { 508 const text_t &link, const text_t &icon, 509 const text_t &text, bool highlight) { 502 510 503 511 text_t tmp; 504 512 while (orptr != NULL) { 505 513 506 tmp = format_string (docinfo, orptr, link, icon, text );514 tmp = format_string (docinfo, orptr, link, icon, text, highlight); 507 515 if (!tmp.empty()) return tmp; 508 516 … … 514 522 static text_t get_if (ResultDocInfo_t &docinfo, const decision_t &decision, 515 523 format_t *ifptr, format_t *elseptr, const text_t &link, 516 const text_t &icon, const text_t &text ) {524 const text_t &icon, const text_t &text, bool highlight) { 517 525 518 526 // not much of a choice yet ... … … 520 528 if (get_meta (docinfo, decision.meta) != "") { 521 529 if (ifptr != NULL) 522 return get_formatted_string (docinfo, ifptr, link, icon, text );530 return get_formatted_string (docinfo, ifptr, link, icon, text, highlight); 523 531 } 524 532 else { 525 533 if (elseptr != NULL) 526 return get_formatted_string (docinfo, elseptr, link, icon, text );534 return get_formatted_string (docinfo, elseptr, link, icon, text, highlight); 527 535 } 528 536 } … … 531 539 532 540 text_t format_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 533 const text_t &link, const text_t &icon, const text_t &text) { 541 const text_t &link, const text_t &icon, 542 const text_t &text, bool highlight) { 534 543 535 544 if (formatlistptr == NULL) return ""; … … 551 560 case comDoc: 552 561 return text; 562 case comHighlight: 563 if (highlight) return "<b>"; 564 break; 565 case comEndHighlight: 566 if (highlight) return "</b>"; 567 break; 553 568 case comIf: 554 569 return get_if (docinfo, formatlistptr->decision, formatlistptr->ifptr, 555 formatlistptr->elseptr, link, icon, text );570 formatlistptr->elseptr, link, icon, text, highlight); 556 571 case comOr: 557 return get_or (docinfo, formatlistptr->orptr, link, icon, text );572 return get_or (docinfo, formatlistptr->orptr, link, icon, text, highlight); 558 573 } 559 574 return ""; … … 568 583 text_t ft; 569 584 while (formatlistptr != NULL) { 570 ft += format_string (docinfo, formatlistptr, link, icon, text );585 ft += format_string (docinfo, formatlistptr, link, icon, text, false); 571 586 formatlistptr = formatlistptr->nextptr; 572 587 } … … 583 598 text_t ft; 584 599 while (formatlistptr != NULL) { 585 ft += format_string (docinfo, formatlistptr, link, icon, text );600 ft += format_string (docinfo, formatlistptr, link, icon, text, false); 586 601 formatlistptr = formatlistptr->nextptr; 587 602 } … … 598 613 text_t ft; 599 614 while (formatlistptr != NULL) { 600 ft += format_string (docinfo, formatlistptr, link, icon, text );615 ft += format_string (docinfo, formatlistptr, link, icon, text, false); 601 616 formatlistptr = formatlistptr->nextptr; 602 617 } … … 610 625 text_t ft; 611 626 while (formatlistptr != NULL) { 612 ft += format_string (docinfo, formatlistptr, link, icon, text );627 ft += format_string (docinfo, formatlistptr, link, icon, text, false); 613 628 formatlistptr = formatlistptr->nextptr; 614 629 } … … 616 631 } 617 632 618 619 633 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 634 const text_t &link, const text_t &icon, bool highlight) { 635 636 text_t text, ft; 637 while (formatlistptr != NULL) { 638 ft += format_string (docinfo, formatlistptr, link, icon, text, highlight); 639 formatlistptr = formatlistptr->nextptr; 640 } 641 return ft; 642 } 643 644 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 645 const text_t &link, const text_t &icon, 646 const text_t &text, bool highlight) { 647 648 text_t ft; 649 while (formatlistptr != NULL) { 650 ft += format_string (docinfo, formatlistptr, link, icon, text, highlight); 651 formatlistptr = formatlistptr->nextptr; 652 } 653 return ft; 654 } 655 656 -
trunk/gsdl/src/recpt/formattools.h
r649 r670 33 33 #include "comtypes.h" 34 34 35 enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon, comDoc}; 35 enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon, 36 comDoc, comHighlight, comEndHighlight}; 36 37 enum pcommand_t {pNone, pImmediate, pTop, pAll}; 37 38 enum dcommand_t {dMeta}; … … 76 77 77 78 bool DocumentImages; 78 bool DocumentT opPages;79 bool DocumentTitles; 79 80 text_t DocumentHeading; 80 bool Document ArrowsTop;81 bool DocumentContents; 81 82 bool DocumentArrowsBottom; 82 bool DocumentGoTo;83 83 text_tarray DocumentButtons; 84 84 text_t DocumentText; … … 108 108 const text_t &link, const text_t &icon, const text_t &text); 109 109 110 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 111 const text_t &link, const text_t &icon, bool highlight); 112 113 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 114 const text_t &link, const text_t &icon, 115 const text_t &text, bool highlight); 116 110 117 111 118 #endif
Note:
See TracChangeset
for help on using the changeset viewer.