GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
This class gets nodes and searchs inside of 'info files'. More...
#include "parser.h"
Classes | |
struct | info_file_item |
struct | node_map_item |
struct | node_position |
Public Member Functions | |
parser (QObject *parent=0) | |
QString | find_ref (const QString &name) |
QString | get_info_path () |
QString | global_search (const QString &text, int maxFounds) |
int | is_ref (const QString &node) |
Checks if this node is reference. | |
QString | node_text_to_html (const QString &text, int anchorPos=-1, const QString &anchor=QString()) |
Translates text of node to Html. | |
QString | search_node (const QString &node) |
void | set_info_path (const QString &_info_path) |
Private Member Functions | |
QString | get_next_node (QIODevice *io) |
QString | get_node_name (const QString &text) |
QString | get_node_next (const QString &text) |
QString | get_node_prev (const QString &text) |
QString | get_node_up (const QString &text) |
QIODevice * | open_file (QFileInfo &fileInfo) |
Open info files and uncompress them. | |
void | parse_info_map () |
Parses info files and gets map of node positions. | |
void | real_position (int pos, QFileInfo &file_info, int &real_pos) |
Calculates real position of nodes. | |
QString | search_node (const QString &node, QIODevice *io) |
void | seek (QIODevice *io, int pos) |
Seeks to position pos. |
Private Attributes | |
QHash< QString, QString > | _compressors_map |
QList< info_file_item > | _info_file_real_size_list |
QFileInfoList | _info_files |
QString | _info_path |
QHash< QString, node_map_item > | _node_map |
QHash< QString, node_position > | _ref_map |
This class gets nodes and searchs inside of 'info files'.
Each info file has nodes. Every node has the documentation. Info files contains a map with position of each node.
What is position? There is a simple answer: If you make a queue with info files, position will be the number of bytes from begining to node position.
But is not so easy. There is headers, and qtinfo must not take these headers into account.
This class also translates info files to html.
parser::parser | ( | QObject * | parent = 0 | ) |
Definition at line 40 of file parser.cc.
References _compressors_map.
QString parser::find_ref | ( | const QString & | name | ) |
QString parser::get_info_path | ( | ) |
Definition at line 71 of file parser.cc.
References _info_path.
|
private |
Definition at line 179 of file parser.cc.
Referenced by global_search(), parse_info_map(), and search_node().
|
private |
Definition at line 251 of file parser.cc.
References parser_node().
Referenced by global_search(), node_text_to_html(), and search_node().
|
private |
Definition at line 263 of file parser.cc.
References parser_node().
Referenced by node_text_to_html().
|
private |
Definition at line 269 of file parser.cc.
References parser_node().
Referenced by node_text_to_html().
|
private |
Definition at line 257 of file parser.cc.
References parser_node().
Referenced by node_text_to_html().
QString parser::global_search | ( | const QString & | text, |
int | maxFounds | ||
) |
Definition at line 553 of file parser.cc.
References _info_files, get_first_line(), get_next_node(), get_node_name(), open_file(), and replace().
Referenced by webinfo::search().
int parser::is_ref | ( | const QString & | node | ) |
Checks if this node is reference.
If node is reference, it will be returned its position in text, else it will be returned -1.
Definition at line 110 of file parser.cc.
References _node_map, parser::node_position::_node_name, _ref_map, and parser::node_position::pos.
Referenced by webinfo::load_node().
QString parser::node_text_to_html | ( | const QString & | text, |
int | anchorPos = -1 , |
||
const QString & | anchor = QString () |
||
) |
Translates text of node to Html.
If anchorPos is not -1, then anchor is inserted in that position.
Definition at line 361 of file parser.cc.
References get_node_name(), get_node_next(), get_node_prev(), get_node_up(), and info_to_html().
Referenced by webinfo::load_node().
|
private |
Open info files and uncompress them.
Definition at line 77 of file parser.cc.
References _compressors_map, and arg().
Referenced by global_search(), parse_info_map(), and search_node().
|
private |
Parses info files and gets map of node positions.
Definition at line 419 of file parser.cc.
References _info_file_real_size_list, _info_files, _node_map, parser::node_position::_node_name, _ref_map, parser::info_file_item::file_info, get_first_line(), get_next_node(), open_file(), parser::node_position::pos, parser::node_map_item::pos, and parser::info_file_item::real_size.
Referenced by set_info_path().
Calculates real position of nodes.
pos | position from info file. |
fileInfo | returns file what contains that position. |
realPos | returns real position inside of fileInfo. |
Definition at line 502 of file parser.cc.
References _info_file_real_size_list, parser::info_file_item::file_info, and parser::info_file_item::real_size.
Referenced by search_node().
QString parser::search_node | ( | const QString & | node | ) |
Definition at line 122 of file parser.cc.
References _node_map, _ref_map, get_next_node(), open_file(), real_position(), and seek().
Referenced by webinfo::load_node().
|
private |
Definition at line 164 of file parser.cc.
References get_next_node(), and get_node_name().
void parser::set_info_path | ( | const QString & | _info_path | ) |
Definition at line 51 of file parser.cc.
References _info_files, _info_path, filter(), and parse_info_map().
Referenced by webinfo::set_info_path().
|
private |
Definition at line 121 of file parser.h.
Referenced by open_file(), and parser().
|
private |
Definition at line 120 of file parser.h.
Referenced by parse_info_map(), and real_position().
|
private |
Definition at line 117 of file parser.h.
Referenced by global_search(), parse_info_map(), and set_info_path().
|
private |
Definition at line 116 of file parser.h.
Referenced by get_info_path(), and set_info_path().
|
private |
Definition at line 118 of file parser.h.
Referenced by is_ref(), parse_info_map(), and search_node().
|
private |
Definition at line 119 of file parser.h.
Referenced by find_ref(), is_ref(), parse_info_map(), and search_node().