GNU Octave
4.2.1
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. More... | |
QString | node_text_to_html (const QString &text, int anchorPos=-1, const QString &anchor=QString()) |
Translates text of node to Html. More... | |
QString | search_node (const QString &node) |
bool | 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. More... | |
void | parse_info_map () |
Parses info files and gets map of node positions. More... | |
void | real_position (int pos, QFileInfo &file_info, int &real_pos) |
Calculates real position of nodes. More... | |
QString | search_node (const QString &node, QIODevice *io) |
void | seek (QIODevice *io, int pos) |
Seeks to position pos. More... | |
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 89 of file parser.cc.
References _info_path.
|
private |
Definition at line 209 of file parser.cc.
Referenced by global_search(), parse_info_map(), and search_node().
|
private |
Definition at line 281 of file parser.cc.
References parser_node().
Referenced by global_search(), node_text_to_html(), and search_node().
|
private |
Definition at line 293 of file parser.cc.
References parser_node().
Referenced by node_text_to_html().
|
private |
Definition at line 299 of file parser.cc.
References parser_node().
Referenced by node_text_to_html().
|
private |
Definition at line 287 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 577 of file parser.cc.
References _info_files, get_first_line(), get_next_node(), get_node_name(), open_file(), replace(), and words.
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 136 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 390 of file parser.cc.
References get_node_name(), get_node_next(), get_node_prev(), get_node_up(), info_to_html(), and text.
Referenced by webinfo::load_node().
|
private |
Open info files and uncompress them.
Definition at line 95 of file parser.cc.
References _compressors_map, arg, command, and result.
Referenced by global_search(), parse_info_map(), and search_node().
|
private |
Parses info files and gets map of node positions.
Definition at line 442 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, parser::info_file_item::real_size, and type.
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 525 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 152 of file parser.cc.
References _node_map, _ref_map, get_next_node(), open_file(), real_position(), seek(), and text.
Referenced by webinfo::load_node().
|
private |
Definition at line 194 of file parser.cc.
References get_next_node(), get_node_name(), and text.
|
private |
bool parser::set_info_path | ( | const QString & | _info_path | ) |
Definition at line 51 of file parser.cc.
References _compressors_map, _info_files, _info_path, filter(), and parse_info_map().
Referenced by webinfo::set_info_path().
|
private |
Definition at line 123 of file parser.h.
Referenced by open_file(), parser(), and set_info_path().
|
private |
Definition at line 122 of file parser.h.
Referenced by parse_info_map(), and real_position().
|
private |
Definition at line 119 of file parser.h.
Referenced by global_search(), parse_info_map(), and set_info_path().
|
private |
Definition at line 118 of file parser.h.
Referenced by get_info_path(), and set_info_path().
|
private |
Definition at line 120 of file parser.h.
Referenced by find_ref(), is_ref(), parse_info_map(), and search_node().
|
private |
Definition at line 121 of file parser.h.
Referenced by find_ref(), is_ref(), parse_info_map(), and search_node().