308 |
313 |
309 OstTraceFunctionExit0( RSEARCHSERVERSUBSESSION_GETDOCUMENTOBJECTL_EXIT ); |
314 OstTraceFunctionExit0( RSEARCHSERVERSUBSESSION_GETDOCUMENTOBJECTL_EXIT ); |
310 return document; |
315 return document; |
311 } |
316 } |
312 |
317 |
|
318 // RSearchServerSubSession::GetBatchDocumentL() |
|
319 EXPORT_C CSearchDocument** RSearchServerSubSession::GetBatchDocumentL(TInt aIndex, TInt& aReturnDoc, TInt aCount) |
|
320 { |
|
321 PERFORMANCE_LOG_START("RSearchServerSubSession::GetBatchDocumentL"); |
|
322 |
|
323 if (!aCount) return NULL; |
|
324 |
|
325 iDocumentSize = 0; |
|
326 iReqCount = aCount; |
|
327 |
|
328 if (iSizeList) |
|
329 { |
|
330 delete iSizeList; |
|
331 iSizeList = NULL; |
|
332 } |
|
333 iSizeList = STATIC_CAST(TInt *, User::AllocZL(iReqCount * sizeof(TInt))); |
|
334 TPtr8 blob((TUint8*)iSizeList, iReqCount * sizeof(TInt)); |
|
335 // Message arguments for the server |
|
336 TIpcArgs args(aIndex, iReqCount, &blob); |
|
337 iDocSizeArray.Reset(); |
|
338 User::LeaveIfError( SendReceive(ESearchServerGetBatchDocument, args ) ); |
|
339 |
|
340 return GetBatchDocumentObjectL( aReturnDoc ); |
|
341 } |
|
342 |
|
343 EXPORT_C void RSearchServerSubSession::GetBatchDocument(TInt aIndex, TRequestStatus& aStatus, TInt aCount) |
|
344 { |
|
345 PERFORMANCE_LOG_START("RSearchServerSubSession::GetBatchDocument"); |
|
346 |
|
347 iDocumentSize = 0; |
|
348 iReqCount = aCount; |
|
349 |
|
350 if (iSizeList) |
|
351 { |
|
352 delete iSizeList; |
|
353 iSizeList = NULL; |
|
354 } |
|
355 iSizeList = STATIC_CAST(TInt *, User::AllocZL(iReqCount * sizeof(TInt))); |
|
356 //iDocSizeArray |
|
357 TPtr8 blob((TUint8*)iSizeList, iReqCount * sizeof(TInt)); |
|
358 |
|
359 // Message arguments for the server |
|
360 TIpcArgs args(aIndex, aCount, &blob); |
|
361 |
|
362 SendReceive(ESearchServerGetBatchDocument, args, aStatus ); |
|
363 } |
|
364 |
|
365 EXPORT_C CSearchDocument** RSearchServerSubSession::GetBatchDocumentObjectL( TInt& aRetCount ) |
|
366 { |
|
367 PERFORMANCE_LOG_START("CCPixSearcher::GetBatchDocumentObjectL"); |
|
368 CSearchDocument** document = NULL; |
|
369 TInt i ,totalsize = 0; |
|
370 for ( i = 0; i< iReqCount; i++ ) |
|
371 { |
|
372 if( *(iSizeList+i) ) |
|
373 { |
|
374 totalsize += *(iSizeList+i); |
|
375 } |
|
376 else break; |
|
377 } |
|
378 aRetCount = i; |
|
379 |
|
380 if ( aRetCount> 0 && totalsize ) |
|
381 { |
|
382 //document = (CSearchDocument**)malloc ( sizeof(CSearchDocument*) * (i-1)); |
|
383 document = STATIC_CAST(CSearchDocument**, User::AllocL( aRetCount * sizeof(CSearchDocument*))); |
|
384 HBufC8* buf = HBufC8::NewLC(totalsize +2 ); |
|
385 TPtr8 ptr = buf->Des(); |
|
386 User::LeaveIfError(SendReceive(ESearchServerGetBatchDocumentObject, TIpcArgs(&ptr))); |
|
387 TInt startpos = 0; |
|
388 TInt endpos = 0; |
|
389 for ( TInt arrCount= 0; arrCount < aRetCount ; arrCount++) |
|
390 { |
|
391 endpos = *(iSizeList + arrCount) -4; |
|
392 //endpos = startpos + iDocSizeArray[arrCount]; |
|
393 TPtrC8 tempptr = ptr.Mid( startpos , endpos ); |
|
394 startpos += endpos; |
|
395 RDesReadStream stream; |
|
396 stream.Open(tempptr); |
|
397 stream.PushL(); |
|
398 document[arrCount] = CSearchDocument::NewL(stream); |
|
399 CleanupStack::PopAndDestroy(&stream); |
|
400 } |
|
401 CleanupStack::PopAndDestroy(buf); |
|
402 } |
|
403 return document; |
|
404 } |
|
405 |
313 // RSearchServerSubSession::CancelSearch() |
406 // RSearchServerSubSession::CancelSearch() |
314 // Cancels outstanding search from server |
407 // Cancels outstanding search from server |
315 EXPORT_C void RSearchServerSubSession::CancelAll() const |
408 EXPORT_C void RSearchServerSubSession::CancelAll() const |
316 { |
409 { |
317 SendReceive(ESearchServerCancelAll, TIpcArgs()); |
410 SendReceive(ESearchServerCancelAll, TIpcArgs()); |