pdf::PDFSearchTask Class Reference

The search task. More...

#include <pdf_search_task.h>

Inheritance diagram for pdf::PDFSearchTask:
Inheritance graph
[legend]
Collaboration diagram for pdf::PDFSearchTask:
Collaboration graph
[legend]

Public Member Functions

 PDFSearchTask (const PDFSearchCriteria &c, const string &anchor, PDFSearchType t, PDFSearcher *s, unsigned int id)
virtual ~PDFSearchTask ()
void execute ()
 execute the rendering task
void * get_user_data ()
 get the pointer of document instance
unsigned int get_id ()
 get search id

Detailed Description

The search task.

Definition at line 39 of file pdf_search_task.h.


Constructor & Destructor Documentation

pdf::PDFSearchTask::PDFSearchTask ( const PDFSearchCriteria c,
const string anchor,
PDFSearchType  t,
PDFSearcher s,
unsigned int  id 
)

Definition at line 34 of file pdf_search_task.cpp.

References pdf::TASK_SEARCH, and pdf::Task::type.

00039 : search_type(t)
00040 , searcher(s)
00041 , criteria(c)
00042 , from_anchor(anchor)
00043 , search_id(id)
00044 {
00045     type = TASK_SEARCH;
00046 }

pdf::PDFSearchTask::~PDFSearchTask (  )  [virtual]

Definition at line 48 of file pdf_search_task.cpp.

00049 {
00050 }


Member Function Documentation

void pdf::PDFSearchTask::execute ( void   )  [virtual]

execute the rendering task

Implements pdf::Task.

Definition at line 52 of file pdf_search_task.cpp.

References pdf::PDFSearcher::begin_search_all(), pdf::PDFSearcher::begin_search_next(), pdf::PDFSearcher::dump_search_process(), LOGPRINTF, pdf::PDFSearcher::notify(), pdf::PDF_SEARCH_ALL, pdf::PDF_SEARCH_NEXT, pdf::RES_ABORTED, pdf::RES_NOT_FOUND, pdf::RES_PAUSED, pdf::Task::reset(), pdf::PDFSearcher::seach_all(), and pdf::PDFSearcher::search_next().

00053 {
00054     LOGPRINTF("Execute Search Task\n");
00055     reset();
00056     SearchResult res = RES_NOT_FOUND;
00057 
00058     // construct a container to keep all of the search results
00059     PDFSearchDocument results;
00060     
00061     if (search_type == PDF_SEARCH_ALL)
00062     {
00063         if (searcher->begin_search_all(criteria))
00064         {
00065             res = searcher->seach_all(results, this);
00066         }
00067     }
00068     else if (search_type == PDF_SEARCH_NEXT)
00069     {
00070         if (searcher->begin_search_next(criteria, from_anchor))
00071         {
00072             res = searcher->search_next(results, this);
00073         }
00074     }
00075 
00076     if (res == RES_PAUSED)
00077     {
00078         // the search task might restart later, so update the from anchor
00079         searcher->dump_search_process(from_anchor);
00080     }
00081     else if (res != RES_ABORTED)
00082     {
00083         // broadcast
00084         searcher->notify(res, results, search_id);
00085     }
00086 }

Here is the call graph for this function:

unsigned int pdf::PDFSearchTask::get_id (  )  [virtual]

get search id

Implements pdf::Task.

Definition at line 93 of file pdf_search_task.cpp.

00094 {
00095     return search_id;
00096 }

void * pdf::PDFSearchTask::get_user_data (  )  [virtual]

get the pointer of document instance

Implements pdf::Task.

Definition at line 88 of file pdf_search_task.cpp.

References pdf::PDFSearcher::get_doc_ctrl().

00089 {
00090     return searcher->get_doc_ctrl();
00091 }

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208