Changeset 19046 for gsdl/trunk/runtime-src/src/recpt/formattools.cpp
- Timestamp:
- 2009-04-19T17:41:33+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/runtime-src/src/recpt/formattools.cpp
r16915 r19046 61 61 mqualifier.sibling = sNone; 62 62 mqualifier.child = cNone; 63 pre_tree_traverse.clear(); 63 64 parentoptions.clear(); 64 65 siblingoptions.clear(); … … 470 471 } 471 472 472 if (meta.size() > 7 && (substr (meta.begin(), meta.begin()+6) == "parent")) { 473 getParents = true; 474 metaoption.metacommand |= mParent; 475 get_parent_options (meta, metaoption); 476 } 477 else if (meta.size() > 6 && (substr (meta.begin(), meta.begin()+5) == "child")) { 478 metaoption.metacommand |= mChild; 479 get_child_options (meta, metaoption); 480 metadata.insert("contains"); 481 } 482 // parent and child can have sibling also 473 bool had_parent_or_child = true; 474 bool prev_was_parent = false; 475 bool prev_was_child = false; 476 477 while (had_parent_or_child) { 478 if (meta.size() > 7 479 && (substr (meta.begin(), meta.begin()+6) == "parent")) { 480 481 // clear out sibling and child (cmd and options) 482 metaoption.metacommand &= ~(mChild|mSibling); 483 metaoption.childoptions.clear(); 484 metaoption.siblingoptions.clear(); 485 486 getParents = true; 487 metaoption.metacommand |= mParent; 488 get_parent_options (meta, metaoption); 489 490 if (prev_was_parent) { 491 metaoption.pre_tree_traverse += ".pr"; 492 } 493 else if (prev_was_child) { 494 metaoption.pre_tree_traverse += ".fc"; 495 } 496 497 prev_was_parent = true; 498 prev_was_child = false; 499 } 500 else if (meta.size() > 6 501 && (substr (meta.begin(), meta.begin()+5) == "child")) { 502 503 // clear out sibling and parent (cmd and options) 504 metaoption.metacommand &= ~(mParent|mSibling); 505 metaoption.parentoptions.clear(); 506 metaoption.siblingoptions.clear(); 507 508 metaoption.metacommand |= mChild; 509 get_child_options (meta, metaoption); 510 metadata.insert("contains"); 511 512 if (prev_was_parent) { 513 metaoption.pre_tree_traverse += ".pr"; 514 } 515 else if (prev_was_child) { 516 metaoption.pre_tree_traverse += ".fc"; 517 } 518 519 prev_was_child = true; 520 prev_was_parent = false; 521 } 522 else { 523 prev_was_child = false; 524 prev_was_parent = false; 525 had_parent_or_child = false; 526 } 527 } 528 529 // parent/child can have sibling tacked on end also 483 530 if (meta.size() > 8 && (substr (meta.begin(), meta.begin()+7) == "sibling")) { 484 531 metaoption.metacommand |= mSibling; … … 928 975 if (docinfo.metadata["contains"].values[0].size()==0) return ""; // no children 929 976 977 const text_t& pre_tree_trav = meta.pre_tree_traverse; 930 978 const text_t& child_metaname = meta.metaname; 931 979 const text_t& child_field = meta.childoptions; … … 937 985 // just one child 938 986 //get the information associated with the metadata for child doc 939 if (!get_info (docinfo.OID+child_field, collection, "", child_metadata, 940 false, collectproto, child_response, logout)) return ""; // invalid child number 987 if (!get_info (docinfo.OID+pre_tree_trav+child_field, collection, "", 988 child_metadata, false, collectproto, child_response, 989 logout)) return ""; // invalid child number 941 990 942 991 if (child_response.docInfo.empty()) return false; // no info for the child … … 952 1001 953 1002 if (meta.mqualifier.child != cAll) return false; // invalid qualifier 1003 1004 1005 if (!pre_tree_trav.empty()) { 1006 // need to get relevant "contains" metadata for new (e.g. pre tree trav) node 1007 FilterResponse_t trav_response; 1008 1009 text_tset trav_metadata; 1010 trav_metadata.insert("contains"); 1011 1012 if (!get_info (docinfo.OID+pre_tree_trav, collection, "", 1013 trav_metadata, false, collectproto, trav_response, 1014 logout)) return ""; // invalid pre_tree_trav 1015 1016 if (trav_response.docInfo.empty()) return false; // no info for the pre_tree_trav OID 1017 1018 ResultDocInfo_t& trav_docinfo = trav_response.docInfo[0]; 1019 // use this for rest of routine 1020 docinfo = trav_docinfo; 1021 } 954 1022 955 1023 // we need to get all children … … 965 1033 here++; 966 1034 if (*(oid.begin()) == '"') translate_parent (oid, docinfo.OID); 967 968 1035 969 1036 //get the information associated with the metadata for child doc
Note:
See TracChangeset
for help on using the changeset viewer.