Changeset 407 for trunk/gsdl/src/recpt/formattools.cpp
- Timestamp:
- 1999-07-20T15:02:16+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/formattools.cpp
r359 r407 12 12 /* 13 13 $Log$ 14 Revision 1.4 1999/07/20 03:02:15 sjboddie 15 added an [icon] option, added ability to call get_formatted_string 16 with icon and link arguments set 17 14 18 Revision 1.3 1999/07/09 02:44:35 sjboddie 15 19 fixed parent(All) function so it only outputs parents and not current … … 34 38 35 39 // a few function prototypes 36 static text_t format_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr); 40 static text_t format_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr, 41 const text_t &link, const text_t &icon); 37 42 38 43 static bool parse_action (text_t::const_iterator &here, const text_t::const_iterator &end, … … 134 139 else if (meta == "num") 135 140 formatlistptr->command = comNum; 141 142 else if (meta == "icon") 143 formatlistptr->command = comIcon; 136 144 137 145 else { … … 385 393 } 386 394 387 static text_t get_or (const ResultDocInfo_t &docinfo, format_t *orptr) { 395 static text_t get_or (const ResultDocInfo_t &docinfo, format_t *orptr, 396 const text_t &link, const text_t &icon) { 388 397 389 398 text_t tmp; 390 399 while (orptr != NULL) { 391 400 392 tmp = format_string (docinfo, orptr );401 tmp = format_string (docinfo, orptr, link, icon); 393 402 if (!tmp.empty()) return tmp; 394 403 … … 399 408 400 409 static text_t get_if (const ResultDocInfo_t &docinfo, const decision_t &decision, 401 format_t *ifptr, format_t *elseptr) { 410 format_t *ifptr, format_t *elseptr, const text_t &link, 411 const text_t &icon) { 402 412 403 413 // not much of a choice yet ... … … 405 415 if (get_meta (docinfo, decision.meta) != "") { 406 416 if (ifptr != NULL) 407 return get_formatted_string (docinfo, ifptr );417 return get_formatted_string (docinfo, ifptr, link, icon); 408 418 } 409 419 else { 410 420 if (elseptr != NULL) 411 return get_formatted_string (docinfo, elseptr );421 return get_formatted_string (docinfo, elseptr, link, icon); 412 422 } 413 423 } … … 415 425 } 416 426 417 static text_t format_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr) { 427 static text_t format_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr, 428 const text_t &link, const text_t &icon) { 418 429 419 430 if (formatlistptr == NULL) return ""; … … 423 434 return formatlistptr->text; 424 435 case comLink: 425 return "<a href=\"_httpdocument_&cl=search&d=" + docinfo.OID + "\">";436 return link; 426 437 case comEndLink: 427 438 return "</a>"; 439 case comIcon: 440 return icon; 428 441 case comNum: 429 442 return docinfo.result_num; … … 431 444 return get_meta (docinfo, formatlistptr->meta); 432 445 case comIf: 433 return get_if (docinfo, formatlistptr->decision, formatlistptr->ifptr, formatlistptr->elseptr); 446 return get_if (docinfo, formatlistptr->decision, formatlistptr->ifptr, 447 formatlistptr->elseptr, link, icon); 434 448 case comOr: 435 return get_or (docinfo, formatlistptr->orptr );449 return get_or (docinfo, formatlistptr->orptr, link, icon); 436 450 } 437 451 return ""; … … 440 454 441 455 442 text_t get_formatted_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr) { 456 text_t get_formatted_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr, 457 const text_t &link, const text_t &icon) { 443 458 444 459 text_t ft; 445 460 while (formatlistptr != NULL) { 446 ft += format_string (docinfo, formatlistptr );461 ft += format_string (docinfo, formatlistptr, link, icon); 447 462 formatlistptr = formatlistptr->nextptr; 448 463 } … … 451 466 452 467 453 454 468 text_t get_formatted_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr) { 469 470 text_t link = "<a href=\"_httpdocument_&cl=search&d=" + docinfo.OID + "\">"; 471 text_t icon = "_icontext_"; 472 473 text_t ft; 474 while (formatlistptr != NULL) { 475 ft += format_string (docinfo, formatlistptr, link, icon); 476 formatlistptr = formatlistptr->nextptr; 477 } 478 return ft; 479 } 480 481 482 483
Note:
See TracChangeset
for help on using the changeset viewer.