pdf::PDFAnchor Class Reference

#include <pdf_anchor.h>

Collaboration diagram for pdf::PDFAnchor:
Collaboration graph
[legend]

Public Member Functions

 PDFAnchor ()
 PDFAnchor (const string &anchor)
 ~PDFAnchor ()
bool operator== (const PDFAnchor &right) const
bool is_end_anchor () const
 Estimate whether it is an end anchor.
void set_end_anchor ()
 Set this anchor to be end anchor.
const stringget_string ()
 Get the string of this anchor.
void validate_for_getting_text (void)

Static Public Member Functions

static int compare (const PDFAnchor &a1, const PDFAnchor &a2)

Data Fields

int page_num
 The page number, default as 1.
int word_num
 The word offset, default as -1.
int char_idx
 The index of the charactor, default as -1.
int link_idx
 The link number, default as -1.
int toc_idx
 The index of the toc item.
string file_name
 Name of the file which is pointed by the anchor.

Detailed Description

Definition at line 33 of file pdf_anchor.h.


Constructor & Destructor Documentation

pdf::PDFAnchor::PDFAnchor (  ) 

Definition at line 42 of file pdf_anchor.cpp.

00043 {
00044     reset();
00045 }

pdf::PDFAnchor::PDFAnchor ( const string anchor  ) 

Definition at line 47 of file pdf_anchor.cpp.

00048 {
00049     reset();
00050     parse(anchor);
00051     anchor_str = anchor;
00052 }

pdf::PDFAnchor::~PDFAnchor (  ) 

Definition at line 54 of file pdf_anchor.cpp.

00055 {
00056 }


Member Function Documentation

int pdf::PDFAnchor::compare ( const PDFAnchor a1,
const PDFAnchor a2 
) [static]

return 1 means a1 > a2 return -1 means a1 < a2 return 0 means a1 = a2 return ANCHOR_COMPARE_ERROR means error

Definition at line 145 of file pdf_anchor.cpp.

00146 {
00147     //if (a1.file_name != a2.file_name)
00148     //{
00149     //    // return if they belog to different file
00150     //    return ANCHOR_COMPARE_ERROR;
00151     //}
00152 
00153     if (a1 == a2)
00154     {
00155         return 0;
00156     }
00157 
00158     if (a1 < a2)
00159     {
00160         return -1;
00161     }
00162 
00163     return 1;
00164 }

const string & pdf::PDFAnchor::get_string (  ) 

Get the string of this anchor.

Definition at line 138 of file pdf_anchor.cpp.

Referenced by pdf::PDFSearcher::dump_search_process(), pdf::PDFController::get_anchor_of_page(), pdf::PDFPage::get_goto_anchor_of_link(), pdf::PDFController::get_next_page_anchor(), and pdf::PDFController::get_prev_page_anchor().

00139 {
00140     // TODO. check the validation of anchor string to avoid redundant packing.
00141     pack(anchor_str);
00142     return anchor_str;
00143 }

Here is the caller graph for this function:

bool pdf::PDFAnchor::is_end_anchor (  )  const

Estimate whether it is an end anchor.

Definition at line 319 of file pdf_anchor.cpp.

References page_num.

Referenced by pdf::PDFController::get_hyperlinks_from_range(), pdf::PDFPage::get_text_by_range(), and pdf::PDFController::get_text_from_range().

00320 {
00321     return (page_num <= 0);
00322 }

Here is the caller graph for this function:

bool pdf::PDFAnchor::operator== ( const PDFAnchor right  )  const

Definition at line 68 of file pdf_anchor.cpp.

References char_idx, file_name, link_idx, page_num, toc_idx, and word_num.

00069 {
00070     return ((this->page_num == right.page_num)
00071         &&(this->word_num == right.word_num)
00072         &&(this->char_idx == right.char_idx)
00073         &&(this->link_idx == right.link_idx)
00074         &&(this->toc_idx == right.toc_idx)
00075         &&(this->file_name == right.file_name));
00076 }

void pdf::PDFAnchor::set_end_anchor (  ) 

Set this anchor to be end anchor.

Definition at line 311 of file pdf_anchor.cpp.

References file_name, name, and page_num.

Referenced by pdf::PDFController::get_text_from_range().

00312 {
00313     string name = file_name;
00314     reset();
00315     file_name = name;
00316     page_num  = 0;
00317 }

Here is the caller graph for this function:

void pdf::PDFAnchor::validate_for_getting_text ( void   ) 

Definition at line 347 of file pdf_anchor.cpp.

References char_idx, page_num, and word_num.

00348 {
00349     if (page_num)
00350     {
00351         if (word_num == -1)
00352         {
00353             word_num = 0;
00354         }
00355 
00356         if (char_idx == -1)
00357         {
00358             char_idx = 0;
00359         }
00360     }
00361 }


Field Documentation

Name of the file which is pointed by the anchor.

Definition at line 38 of file pdf_anchor.h.

Referenced by pdf::PDFController::is_anchor_in_current_document(), operator==(), and set_end_anchor().

The index of the toc item.

Definition at line 37 of file pdf_anchor.h.

Referenced by operator==().


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