#include <pdf_anchor.h>
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 string & | get_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. |
Definition at line 33 of file pdf_anchor.h.
pdf::PDFAnchor::PDFAnchor | ( | ) |
Definition at line 42 of file pdf_anchor.cpp.
pdf::PDFAnchor::PDFAnchor | ( | const string & | anchor | ) |
Definition at line 47 of file pdf_anchor.cpp.
pdf::PDFAnchor::~PDFAnchor | ( | ) |
Definition at line 54 of file pdf_anchor.cpp.
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 }
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 }
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 }
void pdf::PDFAnchor::validate_for_getting_text | ( | void | ) |
The index of the charactor, default as -1.
Definition at line 35 of file pdf_anchor.h.
Referenced by pdf::PDFSearcher::begin_search_next(), pdf::PDFSearcher::dump_search_process(), pdf::PDFPage::get_anchor_param_from_coordinates(), pdf::PDFPage::get_range_param_by_word_index(), operator==(), and validate_for_getting_text().
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 link number, default as -1.
Definition at line 36 of file pdf_anchor.h.
Referenced by pdf::PDFPage::get_anchor_param_from_coordinates(), pdf::PDFPage::get_bounding_rectangles(), pdf::PDFPage::get_range_param_by_link_index(), and operator==().
The page number, default as 1.
Definition at line 33 of file pdf_anchor.h.
Referenced by pdf::PDFSearcher::begin_search_next(), pdf::PDFSearcher::dump_search_process(), pdf::PDFController::get_anchor_of_page(), pdf::PDFPage::get_anchor_param_from_coordinates(), pdf::PDFPage::get_bounding_rectangles(), pdf::PDFPage::get_goto_anchor_of_link(), pdf::PDFController::get_hyperlinks_from_range(), pdf::PDFController::get_next_page_anchor(), pdf::PDFController::get_page_number_of_anchor(), pdf::PDFController::get_prev_page_anchor(), pdf::PDFPage::get_range_param_by_link_index(), pdf::PDFPage::get_range_param_by_word_index(), pdf::PDFPage::get_text_by_range(), pdf::PDFController::get_text_from_range(), pdf::PDFController::is_anchor_in_current_document(), is_end_anchor(), operator==(), set_end_anchor(), and validate_for_getting_text().
The word offset, default as -1.
Definition at line 34 of file pdf_anchor.h.
Referenced by pdf::PDFSearcher::begin_search_next(), pdf::PDFSearcher::dump_search_process(), pdf::PDFPage::get_anchor_param_from_coordinates(), pdf::PDFPage::get_bounding_rectangles(), pdf::PDFPage::get_range_param_by_word_index(), pdf::PDFPage::get_text_by_range(), pdf::PDFController::get_text_from_range(), operator==(), and validate_for_getting_text().