From 51ad2b83c489a98f7d7ede03735c64ed85890b27 Mon Sep 17 00:00:00 2001 From: Marc Cromme Date: Wed, 20 Sep 2006 15:09:45 +0000 Subject: [PATCH] added output formatting for SRW response object --- src/gduutil.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/gduutil.cpp b/src/gduutil.cpp index 7ef3f03..ad2a07c 100644 --- a/src/gduutil.cpp +++ b/src/gduutil.cpp @@ -1,4 +1,4 @@ -/* $Id: gduutil.cpp,v 1.9 2006-09-19 13:50:17 marc Exp $ +/* $Id: gduutil.cpp,v 1.10 2006-09-20 15:09:45 marc Exp $ Copyright (c) 2005-2006, Index Data. See the LICENSE file for details @@ -563,7 +563,7 @@ std::ostream& std::operator<<(std::ostream& os, Z_SRW_PDU& srw_pdu) else os << " -"; if (sr->recordPacking) - os << " " << *(sr->recordPacking); + os << " " << (sr->recordPacking); else os << " -"; @@ -583,6 +583,46 @@ std::ostream& std::operator<<(std::ostream& os, Z_SRW_PDU& srw_pdu) break; case Z_SRW_searchRetrieve_response: os << " " << "searchRetrieveResponse"; + { + Z_SRW_searchRetrieveResponse *sr = srw_pdu.u.response; + if (sr) + { + if (! (sr->num_diagnostics)) + { + os << " OK"; + if (sr->numberOfRecords) + os << " " << *(sr->numberOfRecords); + else + os << " -"; + //if (sr->num_records) + os << " " << (sr->num_records); + //else + //os << " -"; + if (sr->nextRecordPosition) + os << " " << *(sr->nextRecordPosition); + else + os << " -"; + } + else + { + os << " DIAG"; + if (sr->diagnostics && sr->diagnostics->uri) + os << " " << *(sr->diagnostics->uri); + else + os << " -"; + if (sr->diagnostics && sr->diagnostics->message) + os << " " << *(sr->diagnostics->message); + else + os << " -"; + if (sr->diagnostics && sr->diagnostics->details) + os << " " << *(sr->diagnostics->details); + else + os << " -"; + } + + + } + } break; case Z_SRW_explain_request: os << " " << "explainRequest"; -- 1.7.10.4