Changeset 1610 for trunk/gsdl
- Timestamp:
- 2000-10-25T12:25:01+13:00 (24 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/browsetools.cpp
r1606 r1610 116 116 textout << outconvert << disp 117 117 << get_formatted_string (args["c"],collectproto, 118 response.docInfo[0], formatlistptr,118 response.docInfo[0], disp, formatlistptr, 119 119 logout); 120 120 } -
trunk/gsdl/src/recpt/datelistbrowserclass.cpp
r1443 r1610 126 126 textout << outconvert << disp 127 127 << get_formatted_string (collection, collectproto, 128 *thissection, formatlistptr,128 *thissection, disp, formatlistptr, 129 129 link, icon, false, 130 130 logout) << "\n"; -
trunk/gsdl/src/recpt/documentaction.cpp
r1443 r1610 720 720 text_t doctext 721 721 = get_formatted_string (collection, collectproto, 722 docinfo, formatlistptr, docresponse.doc,722 docinfo, disp, formatlistptr, docresponse.doc, 723 723 logout); 724 724 -
trunk/gsdl/src/recpt/formattools.cpp
r1561 r1610 32 32 // a few function prototypes 33 33 static text_t format_string (const text_t& collection, recptproto* collectproto, 34 ResultDocInfo_t &docinfo, format_t *formatlistptr, 34 ResultDocInfo_t &docinfo, displayclass &disp, 35 format_t *formatlistptr, 35 36 const text_t &link, const text_t &icon, 36 37 const text_t &text, bool highlight, ostream& logout); … … 49 50 command = dMeta; 50 51 meta.clear(); 52 text.clear(); 51 53 } 52 54 … … 385 387 text.clear(); 386 388 387 } else { 388 // the {If}{decide,do,else} statement 389 } 390 391 // Parse an {If}{decide,do,else} statement 392 else { 393 394 // Read the decision component. 389 395 if (commacount == 0) { 390 // If decision only supports metadata at present391 392 // remove the surrounding square brackets 396 // Decsion can be a metadata element, or a piece of text. 397 // Originally Stefan's code, updated 25/10/2000 by Gordon. 398 393 399 text_t::const_iterator beginbracket = text.begin(); 394 400 text_t::const_iterator endbracket = (text.end() - 1); 401 402 // Decision is based on a metadata element 395 403 if ((*beginbracket == '[') && (*endbracket == ']')) { 404 // Ignore the surrounding square brackets 396 405 text_t meta = substr (beginbracket+1, endbracket); 397 406 parse_meta (meta, formatlistptr->decision.meta, metadata, getParents); … … 399 408 text.clear(); 400 409 } 401 402 } else { 410 411 // Decision is a piece of text (probably a macro like _cgiargmode_). 412 else { 413 formatlistptr->decision.command = dText; 414 formatlistptr->decision.text = text; 415 commacount ++; 416 text.clear(); 417 } 418 } 419 420 // Read the "then" and "else" components of the {If} statement. 421 else { 403 422 format_t** nextlistptr = NULL; 404 423 if (commacount == 1) { 405 424 nextlistptr = &formatlistptr->ifptr; 406 425 } else if (commacount == 2 ) { 407 426 nextlistptr = &formatlistptr->elseptr; … … 548 567 549 568 static text_t get_or (const text_t& collection, recptproto* collectproto, 550 ResultDocInfo_t &docinfo, format_t *orptr, 569 ResultDocInfo_t &docinfo, displayclass &disp, 570 format_t *orptr, 551 571 const text_t &link, const text_t &icon, 552 572 const text_t &text, bool highlight, … … 556 576 while (orptr != NULL) { 557 577 558 tmp = format_string (collection,collectproto, docinfo, orptr,559 link, icon,text,highlight, logout);578 tmp = format_string (collection,collectproto, docinfo, disp, orptr, 579 link, icon, text, highlight, logout); 560 580 if (!tmp.empty()) return tmp; 561 581 … … 566 586 567 587 static text_t get_if (const text_t& collection, recptproto* collectproto, 568 ResultDocInfo_t &docinfo, const decision_t &decision, 588 ResultDocInfo_t &docinfo, displayclass &disp, 589 const decision_t &decision, 569 590 format_t *ifptr, format_t *elseptr, const text_t &link, 570 591 const text_t &icon, const text_t &text, bool highlight, … … 572 593 { 573 594 574 // not much of a choice yet ... 595 // If the decision component is a metadata element, then evaluate it 596 // to see whether we output the "then" or the "else" clause 575 597 if (decision.command == dMeta) { 576 598 if (get_meta (docinfo, decision.meta) != "") { 577 599 if (ifptr != NULL) 578 return get_formatted_string (collection,collectproto, docinfo, ifptr,579 link, icon,text,highlight, logout);600 return get_formatted_string (collection,collectproto, docinfo, disp, ifptr, 601 link, icon, text, highlight, logout); 580 602 } 581 603 else { 582 604 if (elseptr != NULL) 583 return get_formatted_string (collection,collectproto, docinfo,elseptr, 584 link,icon,text,highlight, logout); 585 } 586 } 605 return get_formatted_string (collection,collectproto, docinfo, disp, elseptr, 606 link, icon, text, highlight, logout); 607 } 608 } 609 610 // If the decision component is text, then evaluate it (it is probably a 611 // macro like _cgiargmode_) to decide what to output. 612 else if (decision.command == dText) { 613 614 text_t outstring; 615 disp.expandstring (decision.text, outstring); 616 617 // This is a tad tricky. When we expand a string like _cgiargmode_, that is 618 // a cgi argument macro that has not been set, it evaluates to itself. 619 // Therefore, were have to say that a piece of text evalautes true if 620 // it is non-empty and if it is a cgi argument evaulating to itself. 621 if ((outstring != "") && !((outstring == decision.text) && (outstring[0] == '_'))) { 622 if (ifptr != NULL) 623 return get_formatted_string (collection, collectproto, docinfo, disp, ifptr, 624 link, icon, text, highlight, logout); 625 } else { 626 if (elseptr != NULL) 627 return get_formatted_string (collection, collectproto, docinfo, disp, elseptr, 628 link, icon, text, highlight, logout); 629 } 630 } 631 587 632 return ""; 588 633 } … … 601 646 602 647 text_t format_string (const text_t& collection, recptproto* collectproto, 603 ResultDocInfo_t &docinfo, format_t *formatlistptr, 648 ResultDocInfo_t &docinfo, displayclass &disp, 649 format_t *formatlistptr, 604 650 const text_t &link, const text_t &icon, 605 651 const text_t &text, bool highlight, … … 644 690 { 645 691 text_t expanded_metavalue 646 = get_formatted_string(collection, collectproto,647 response.docInfo[0], expanded_formatlistptr,692 = get_formatted_string(collection, collectproto, 693 response.docInfo[0], disp, expanded_formatlistptr, 648 694 link,icon,highlight, 649 695 logout); … … 670 716 break; 671 717 case comIf: 672 return get_if (collection, collectproto, 673 docinfo,formatlistptr->decision, formatlistptr->ifptr,718 return get_if (collection, collectproto, docinfo, disp, 719 formatlistptr->decision, formatlistptr->ifptr, 674 720 formatlistptr->elseptr, link, icon, text, highlight, 675 721 logout); 676 722 case comOr: 677 return get_or (collection,collectproto, docinfo, formatlistptr->orptr,678 link, icon,text,highlight, logout);723 return get_or (collection,collectproto, docinfo, disp, formatlistptr->orptr, 724 link, icon, text, highlight, logout); 679 725 } 680 726 return ""; … … 685 731 686 732 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 687 ResultDocInfo_t& docinfo, format_t* formatlistptr, 733 ResultDocInfo_t& docinfo, displayclass &disp, 734 format_t* formatlistptr, 688 735 const text_t& link, const text_t& icon, 689 736 const text_t& text, const bool highlight, … … 693 740 while (formatlistptr != NULL) 694 741 { 695 ft += format_string (collection, collectproto, docinfo, formatlistptr,742 ft += format_string (collection, collectproto, docinfo, disp, formatlistptr, 696 743 link, icon, text, highlight, logout); 697 744 formatlistptr = formatlistptr->nextptr; … … 702 749 703 750 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 704 ResultDocInfo_t &docinfo, format_t *formatlistptr, 751 ResultDocInfo_t &docinfo, displayclass &disp, 752 format_t *formatlistptr, 705 753 const text_t &link, const text_t &icon, 706 754 const bool highlight, … … 709 757 text_t text = ""; 710 758 711 return get_formatted_string(collection, collectproto, docinfo, formatlistptr,759 return get_formatted_string(collection, collectproto, docinfo, disp, formatlistptr, 712 760 link, icon, text, highlight, logout); 713 761 } 714 762 715 763 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 716 ResultDocInfo_t &docinfo, format_t *formatlistptr, 764 ResultDocInfo_t &docinfo, displayclass &disp, 765 format_t *formatlistptr, 717 766 const text_t& text, 718 767 ostream& logout) { … … 722 771 bool highlight = false; 723 772 724 return get_formatted_string(collection, collectproto, docinfo, formatlistptr,773 return get_formatted_string(collection, collectproto, docinfo, disp, formatlistptr, 725 774 link, icon, text, highlight, logout); 726 775 } 727 776 728 777 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 729 ResultDocInfo_t &docinfo, format_t *formatlistptr, 778 ResultDocInfo_t &docinfo, displayclass &disp, 779 format_t *formatlistptr, 730 780 ostream& logout) { 731 781 732 782 text_t text = ""; 733 783 734 return get_formatted_string(collection, collectproto, docinfo, formatlistptr,784 return get_formatted_string(collection, collectproto, docinfo, disp, formatlistptr, 735 785 text, logout); 736 786 } 737 787 788 789 790 791 792 793 -
trunk/gsdl/src/recpt/formattools.h
r1443 r1610 31 31 #include "comtypes.h" 32 32 #include "recptproto.h" 33 #include "display.h" 33 34 34 35 enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon, 35 36 comDoc, comHighlight, comEndHighlight}; 36 37 enum pcommand_t {pNone, pImmediate, pTop, pAll}; 37 enum dcommand_t {dMeta };38 enum dcommand_t {dMeta, dText}; 38 39 enum mcommand_t {mNone, mCgiSafe}; 39 40 … … 48 49 }; 49 50 51 52 // The decision component of an {If}{decision,true-text,false-text} 53 // formatstring. Te decision can be based on metadata or on text; 54 // normally that text would be a macro like _cgiargmode_. --gordon 50 55 struct decision_t { 51 56 void clear(); … … 54 59 dcommand_t command; 55 60 metadata_t meta; 61 text_t text; 56 62 }; 57 63 … … 102 108 103 109 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 104 ResultDocInfo_t &docinfo, format_t *formatlistptr, 110 ResultDocInfo_t &docinfo, displayclass &disp, 111 format_t *formatlistptr, 105 112 const text_t &link, const text_t &icon, 106 113 const text_t& t, const bool highlight, … … 108 115 109 116 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 110 ResultDocInfo_t &docinfo, format_t *formatlistptr, 117 ResultDocInfo_t &docinfo, displayclass &disp, 118 format_t *formatlistptr, 111 119 const text_t &link, const text_t &icon, 112 120 const bool highlight, … … 114 122 115 123 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 116 ResultDocInfo_t &docinfo, format_t *formatlistptr, 124 ResultDocInfo_t &docinfo, displayclass &disp, 125 format_t *formatlistptr, 117 126 const text_t &text, 118 127 ostream& logout); 119 128 120 129 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 121 ResultDocInfo_t &docinfo, format_t *formatlistptr,122 ostream& logout);130 ResultDocInfo_t &docinfo, displayclass &disp, 131 format_t *formatlistptr, ostream& logout); 123 132 124 133 -
trunk/gsdl/src/recpt/hlistbrowserclass.cpp
r1443 r1610 137 137 textout << outconvert << disp 138 138 << get_formatted_string (collection, collectproto, 139 *tsibling, formatlistptr, link, icon, highlight,139 *tsibling, disp, formatlistptr, link, icon, highlight, 140 140 logout); 141 141 -
trunk/gsdl/src/recpt/vlistbrowserclass.cpp
r1443 r1610 82 82 textout << outconvert << disp 83 83 << get_formatted_string (collection, collectproto, 84 section, formatlistptr,84 section, disp, formatlistptr, 85 85 link, icon, highlight, logout); 86 86 … … 133 133 textout << outconvert << disp 134 134 << get_formatted_string (collection, collectproto, 135 *thissection, formatlistptr,135 *thissection, disp, formatlistptr, 136 136 link, icon, highlight, logout); 137 137
Note:
See TracChangeset
for help on using the changeset viewer.