GNU Octave  4.2.1
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 52 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 666 of file parser.cc.

References _node_map, _ref_map, k, p, and text.

Referenced by webinfo::load_ref().

QString parser::get_info_path ( )

Definition at line 89 of file parser.cc.

References _info_path.

QString parser::get_next_node ( QIODevice *  io)
private

Definition at line 209 of file parser.cc.

References c, and text.

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

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

Definition at line 281 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 293 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 299 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 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().

QIODevice * parser::open_file ( QFileInfo &  fileInfo)
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().

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

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

Definition at line 194 of file parser.cc.

References get_next_node(), get_node_name(), and text.

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

Seeks to position pos.

Definition at line 550 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 123 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 122 of file parser.h.

Referenced by parse_info_map(), and real_position().

QFileInfoList parser::_info_files
private

Definition at line 119 of file parser.h.

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

QString parser::_info_path
private

Definition at line 118 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 120 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 121 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: