HSyntaxHighlighterSettings Class Reference

Highlighting Settings This class holds all Highlighting settings, used by HSyntaxHighlighter It is used to generate formating rules. slFormatingRule mlFormatingRule HSyntaxHighlighterDialog. More...

#include <HSyntaxHighlighterSettings.h>

List of all members.

Public Member Functions

bool changed () const
 Function indicating if settings were changed, so user should opdate any cached info.
void cached ()
 Function that indicates blocks were cached cached after is called changed() will return false until next modification.
void saveConfig (QString _fileName=QCoreApplication::applicationDirPath()+"/default.ini") const
 Functions saves configuration to file This function is used to store all highlighter settings, such as matching patterns and formatting info selected ini file.
void loadConfig (QString _fileName=QCoreApplication::applicationDirPath()+"/default.ini")
 Functions loads configuration from file This function is used to load all highlighter settings, such as matching patterns and formatting form selected ini file.
 HSyntaxHighlighterSettings ()
 Basic constructor of settings class It only calls setupHighlightBlocks().
 ~HSyntaxHighlighterSettings ()
 Destructor We don't use any raw pointers here, so he has no job.
QVector< slFormatingRulegetSingleLineRules () const
 Generates single line rules This function generates single line rules for HSyntaxHighlighter.
QVector< mlFormatingRulegetMultiLinesRules () const
 Generates multiple line rules This function generates multiple line rules for HSyntaxHighlighter.
void addBlock (const QString &_name, HighlightBlock::HighlighType _type=HighlightBlock::sl)
 adds new empty highlighting block to be filled by user.
bool blockExists (const QString &_name) const
 checks if block exists
void removeBlock (const QString &_name)
 Removes block if it exists.
void renameBlock (const QString &_oldName, const QString &_newName)

Private Attributes

QMap< QString,
SingleLineHighlightBlock
singleLine
 Map of single lines block indexed by names.
QMap< QString,
MultiLinesHighlightBlock
multiLines
 Map of multiple lines block indexed by names.
bool modified
 variable indicating if settings were modified since last caching, indicated by call to cached()

Friends

class HSyntaxHighlighterDialog


Detailed Description

Highlighting Settings This class holds all Highlighting settings, used by HSyntaxHighlighter It is used to generate formating rules. slFormatingRule mlFormatingRule HSyntaxHighlighterDialog.

Definition at line 46 of file HSyntaxHighlighterSettings.h.


Constructor & Destructor Documentation

HSyntaxHighlighterSettings::HSyntaxHighlighterSettings (  ) 

Basic constructor of settings class It only calls setupHighlightBlocks().

Definition at line 12 of file HSyntaxHighlighterSettings.cpp.

References modified.

HSyntaxHighlighterSettings::~HSyntaxHighlighterSettings (  )  [inline]

Destructor We don't use any raw pointers here, so he has no job.

Definition at line 107 of file HSyntaxHighlighterSettings.h.


Member Function Documentation

void HSyntaxHighlighterSettings::addBlock ( const QString &  _name,
HighlightBlock::HighlighType  _type = HighlightBlock::sl 
) [inline]

adds new empty highlighting block to be filled by user.

Parameters:
_name name of the new block
_type 

Definition at line 127 of file HSyntaxHighlighterSettings.h.

References blockExists(), HighlightBlock::ml, modified, multiLines, HighlightBlock::setName(), singleLine, and HighlightBlock::sl.

Referenced by HSyntaxHighlighterNewBlock::addName().

bool HSyntaxHighlighterSettings::blockExists ( const QString &  _name  )  const [inline]

checks if block exists

Parameters:
_name name of checked block
Returns:
true if exists, false otherwise

Definition at line 152 of file HSyntaxHighlighterSettings.h.

References multiLines, and singleLine.

Referenced by addBlock(), HSyntaxHighlighterNewBlock::addName(), and HSyntaxHighlighterDialog::renameCurrentItem().

void HSyntaxHighlighterSettings::cached (  )  [inline]

Function that indicates blocks were cached cached after is called changed() will return false until next modification.

Definition at line 78 of file HSyntaxHighlighterSettings.h.

References modified.

Referenced by HSyntaxHighlighter::updateRules().

bool HSyntaxHighlighterSettings::changed (  )  const [inline]

Function indicating if settings were changed, so user should opdate any cached info.

Returns:
True if settings were modified.

Definition at line 69 of file HSyntaxHighlighterSettings.h.

References modified.

Referenced by HSyntaxHighlighter::highlightBlock().

QVector< mlFormatingRule > HSyntaxHighlighterSettings::getMultiLinesRules (  )  const

QVector< slFormatingRule > HSyntaxHighlighterSettings::getSingleLineRules (  )  const

Generates single line rules This function generates single line rules for HSyntaxHighlighter.

Returns:
QVector of slFormatingRule class rules.

Definition at line 158 of file HSyntaxHighlighterSettings.cpp.

References slFormatingRule::exp, slFormatingRule::format, SingleLineHighlightBlock::getExp(), HighlightBlock::getFormat(), and singleLine.

Referenced by HSyntaxHighlighter::updateRules().

void HSyntaxHighlighterSettings::loadConfig ( QString  _fileName = QCoreApplication::applicationDirPath()+"/default.ini"  ) 

Functions loads configuration from file This function is used to load all highlighter settings, such as matching patterns and formatting form selected ini file.

Parameters:
_fileName complete path to ini file, where settings should be stored. If no specified, Applications directory and name default.ini are assumed.

Definition at line 77 of file HSyntaxHighlighterSettings.cpp.

References HighlightBlock::getName(), modified, multiLines, HighlightBlock::setBackgroundColor(), HighlightBlock::setDescription(), MultiLinesHighlightBlock::setEndingPattern(), HighlightBlock::setFont(), HighlightBlock::setForegroundColor(), HighlightBlock::setName(), SingleLineHighlightBlock::setPattern(), MultiLinesHighlightBlock::setStartingPattern(), and singleLine.

Referenced by HSyntaxHighlighter::HSyntaxHighlighter(), and HSyntaxHighlighter::loadConfig().

void HSyntaxHighlighterSettings::removeBlock ( const QString &  _name  )  [inline]

Removes block if it exists.

Parameters:
_name Name of block to be removed

Definition at line 160 of file HSyntaxHighlighterSettings.h.

References modified, multiLines, and singleLine.

Referenced by HSyntaxHighlighterDialog::removeCurrentItem().

void HSyntaxHighlighterSettings::renameBlock ( const QString &  _oldName,
const QString &  _newName 
) [inline]

void HSyntaxHighlighterSettings::saveConfig ( QString  _fileName = QCoreApplication::applicationDirPath()+"/default.ini"  )  const

Functions saves configuration to file This function is used to store all highlighter settings, such as matching patterns and formatting info selected ini file.

Parameters:
_fileName complete path to ini file, where settings should be stored. If no specified, Applications directory and name default.ini are assumed.

Definition at line 19 of file HSyntaxHighlighterSettings.cpp.

References HighlightBlock::getBackgroundColor(), HighlightBlock::getDescription(), MultiLinesHighlightBlock::getEndingPattern(), HighlightBlock::getFont(), HighlightBlock::getForegroundColor(), HighlightBlock::getName(), SingleLineHighlightBlock::getPattern(), MultiLinesHighlightBlock::getStartingPattern(), multiLines, and singleLine.

Referenced by HSyntaxHighlighter::saveConfig(), and HSyntaxHighlighter::~HSyntaxHighlighter().


Friends And Related Function Documentation

friend class HSyntaxHighlighterDialog [friend]

This class is friend, because HSyntaxHighlighterDialog is a visual interface, and avoiding this friend will cause breaking Settings encapsulation, with getters and setters given to everyone instead of this one class.

Definition at line 53 of file HSyntaxHighlighterSettings.h.


Member Data Documentation

variable indicating if settings were modified since last caching, indicated by call to cached()

Definition at line 62 of file HSyntaxHighlighterSettings.h.

Referenced by addBlock(), cached(), changed(), HSyntaxHighlighterDialog::getSettings(), HSyntaxHighlighterSettings(), loadConfig(), removeBlock(), and renameBlock().


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

Generated on Fri Jan 9 00:50:44 2009 for HSyntaxHighlighter by  doxygen 1.5.8