The main class performing the highlighting of a single line.
More...
#include <sourcehighlighter.h>
Inheritance diagram for srchilite::SourceHighlighter:
Collaboration diagram for srchilite::SourceHighlighter:
Public Member Functions
Highlights a paragraph (a line actually)
More...
HighlightStateStackPtr getStateStack ()
void setStateStack (HighlightStateStackPtr state)
Clears the statck of states.
bool getOptimize () const
void setOptimize (bool b=true)
bool isSuspended () const
void setSuspended (bool b=true)
bool hasListeners () const
Notifies all listeners of a specific event.
More...
Private Member Functions
Enters a new state (using the stack)
More...
Exits level states (-1 means exit all states)
More...
Exits all states in the stack (and thus go back to the initial main state)
Computes the (possible) next state for the given rule (if required, also performs reference replacement)
More...
void
format (const std::string &elem, const std::string &s)
Formats the given string as the specified element.
More...
Makes sure to flush the possible buffer of the current element (e.g., during optimizations)
Private Attributes
the main (and initial) highlight state
the current highlight state
the stack for the highlight states
the formatter manager, used to format element strings
Whether to optimize output (e.g., adjacent text parts belonging to the same element will be buffered and generated as a single text part)
Whether formatting is currently suspended.
More...
Additional parameters for the formatters.
The current element being formatted (used for optmization and buffering)
The buffer for the text for the current element.
Detailed Description
The main class performing the highlighting of a single line.
It relies on a HighlightState (and its HighlightRule objects).
It provides the method highlightParagraph() to highlight a single line.
The current highlighting state can be retrieved with getCurrentState().
The highlighting state is not reset after highlighting a line, thus, the same object can be used to highlight, for instance, an entire file, by calling highlightParagraph on each line.
An example of use of this class is in infoformatter-main.cpp
Constructor & Destructor Documentation
- Parameters
-
mainState the main and initial state for highlighting
Member Function Documentation
Enters a new state (using the stack)
- Parameters
-
state
void srchilite::SourceHighlighter::exitState
(
int
level )
private
Exits level states (-1 means exit all states)
- Parameters
-
level
void srchilite::SourceHighlighter::format
(
const std::string &
elem,
const std::string &
s
)
private
Formats the given string as the specified element.
- Parameters
-
elem
s
Computes the (possible) next state for the given rule (if required, also performs reference replacement)
- Parameters
-
token
void srchilite::SourceHighlighter::highlightParagraph
(
const std::string &
paragraph )
Highlights a paragraph (a line actually)
- Parameters
-
paragraph
Notifies all listeners of a specific event.
- Parameters
-
event the event
Member Data Documentation
bool srchilite::SourceHighlighter::suspended
private
Whether formatting is currently suspended.
Note that matching for regular expressions is not suspended: only the actual output of formatted code is suspended.
The documentation for this class was generated from the following files:
- /home/bettini/work/source-highlight/src-highlite/lib/srchilite/sourcehighlighter.h
- /home/bettini/work/source-highlight/src-highlite/lib/srchilite/sourcehighlighter.cpp