GNU Octave  3.8.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.
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

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 642 of file parser.cc.

References _ref_map.

Referenced by webinfo::load_ref().

QString parser::get_info_path ( )

Definition at line 71 of file parser.cc.

References _info_path.

QString parser::get_next_node ( QIODevice *  io)
private

Definition at line 179 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 251 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 263 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 269 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 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().

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

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

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

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

Referenced by search_node().

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

Member Data Documentation

QHash<QString, QString> parser::_compressors_map
private

Definition at line 121 of file parser.h.

Referenced by open_file(), and parser().

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 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: