GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
parser Class Reference

This class gets nodes and searchs inside of 'info files'. More...

#include "parser.h"

Inheritance diagram for parser:
Inheritance graph
[legend]
Collaboration diagram for parser:
Collaboration graph
[legend]

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
 

Detailed Description

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.

Definition at line 49 of file parser.h.

Constructor & Destructor Documentation

parser::parser ( QObject parent = 0)

Definition at line 40 of file parser.cc.

References _compressors_map.

Member Function Documentation

QString parser::find_ref ( const QString &  name)

Definition at line 671 of file parser.cc.

References _node_map, and _ref_map.

Referenced by webinfo::load_ref().

QString parser::get_info_path ( )

Definition at line 88 of file parser.cc.

References _info_path.

QString parser::get_next_node ( QIODevice *  io)
private

Definition at line 207 of file parser.cc.

Referenced by global_search(), parse_info_map(), and search_node().

QString parser::get_node_name ( const QString &  text)
private

Definition at line 279 of file parser.cc.

References parser_node().

Referenced by global_search(), node_text_to_html(), and search_node().

QString parser::get_node_next ( const QString &  text)
private

Definition at line 291 of file parser.cc.

References parser_node().

Referenced by node_text_to_html().

QString parser::get_node_prev ( const QString &  text)
private

Definition at line 297 of file parser.cc.

References parser_node().

Referenced by node_text_to_html().

QString parser::get_node_up ( const QString &  text)
private

Definition at line 285 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 582 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 134 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 389 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().

QIODevice * parser::open_file ( QFileInfo &  fileInfo)
private

Open info files and uncompress them.

Definition at line 94 of file parser.cc.

References _compressors_map, and arg().

Referenced by global_search(), parse_info_map(), and search_node().

void parser::parse_info_map ( )
private
void parser::real_position ( int  pos,
QFileInfo &  file_info,
int real_pos 
)
private

Calculates real position of nodes.

Parameters
posposition from info file.
fileInforeturns file what contains that position.
realPosreturns real position inside of fileInfo.

Definition at line 530 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 150 of file parser.cc.

References _node_map, _ref_map, get_next_node(), open_file(), real_position(), and seek().

Referenced by webinfo::load_node().

QString parser::search_node ( const QString &  node,
QIODevice *  io 
)
private

Definition at line 192 of file parser.cc.

References get_next_node(), and get_node_name().

void parser::seek ( QIODevice *  io,
int  pos 
)
private

Seeks to position pos.

Definition at line 555 of file parser.cc.

Referenced by search_node().

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().

Member Data Documentation

QHash<QString, QString> parser::_compressors_map
private

Definition at line 121 of file parser.h.

Referenced by open_file(), parser(), and set_info_path().

QList<info_file_item> parser::_info_file_real_size_list
private

Definition at line 120 of file parser.h.

Referenced by parse_info_map(), and real_position().

QFileInfoList parser::_info_files
private

Definition at line 117 of file parser.h.

Referenced by global_search(), parse_info_map(), and set_info_path().

QString parser::_info_path
private

Definition at line 116 of file parser.h.

Referenced by get_info_path(), and set_info_path().

QHash<QString, node_map_item> parser::_node_map
private

Definition at line 118 of file parser.h.

Referenced by find_ref(), is_ref(), parse_info_map(), and search_node().

QHash<QString, node_position> parser::_ref_map
private

Definition at line 119 of file parser.h.

Referenced by find_ref(), is_ref(), parse_info_map(), and search_node().


The documentation for this class was generated from the following files: