Source-highlight Library
srchilite::SourceFileHighlighter Class Reference

Highlights the contents of a file relying on a SourceHighlighter. More...

#include <sourcefilehighlighter.h>

Collaboration diagram for srchilite::SourceFileHighlighter:

Public Member Functions

 SourceFileHighlighter (const std::string &file, SourceHighlighter *sourceHighlighter, BufferedOutput *output)
void setDebugPolicy (FileHighlighterDebug p)
void setPreformatter (PreFormatter *pf)
void setContextFormatter (Formatter *cf)
void setLineNumGenerator (LineNumGenerator *lG)
void setLinePrefix (const std::string &prefix)
void setRangeSeparator (const std::string &rangeSep)
 The range separator will be automatically preformatted to deal with the specific output format.
const LineRanges * getLineRanges () const
void setLineRanges (LineRanges *lr)
void setRegexRanges (RegexRanges *rr)
void highlight ()
 Performs the highlighting; Once the highlighting is finished, this object can be re-used.
void highlight (std::istream &is)
 Performs the highlighting of the contents of the given input stream; Once the highlighting is finished, this object can be re-used.
void highlight (const std::string &is)
 Performs the highlighting of the contents of the given string; Once the highlighting is finished, this object can be re-used.

Private Attributes

const std::string fileName
 the name of the file to highlight
SourceHighlighter * sourceHighlighter
 the initial regexp state
BufferedOutput * output
 the output object
FileHighlighterDebug debugPolicy
 debugging policy
PreFormatter * preformatter
 the preformatter for characters, e.g., for

LineNumGenerator * lineNumGenerator
 for generation of line numbers (if not null)
LineRanges * lineRanges
 if not null, it detects whether a line is in the stored ranges
RegexRanges * regexRanges
 if not null, it detects whether a line is in the stored ranges
Formatter * contextFormatter
 the formatter for possible context lines
std::string linePrefix
 a prefix to be generated in front of each formatted code line
std::string rangeSeparator
 if specified, a string to be printed between two ranges

Detailed Description

Highlights the contents of a file relying on a SourceHighlighter.

Constructor & Destructor Documentation

◆ SourceFileHighlighter()

srchilite::SourceFileHighlighter::SourceFileHighlighter ( const std::string & file,
SourceHighlighter * sourceHighlighter,
BufferedOutput * output )
Parameters
filethe name of the file to highlight; if the filename is empty then we will process the standard input
sourceHighlighterthe highlighter to highlight paragraphs
outputthe output object used to write

Member Function Documentation

◆ highlight() [1/2]

void srchilite::SourceFileHighlighter::highlight ( const std::string & is)

Performs the highlighting of the contents of the given string; Once the highlighting is finished, this object can be re-used.

Parameters
is

◆ highlight() [2/2]

void srchilite::SourceFileHighlighter::highlight ( std::istream & is)

Performs the highlighting of the contents of the given input stream; Once the highlighting is finished, this object can be re-used.

Parameters
is

◆ setRangeSeparator()

void srchilite::SourceFileHighlighter::setRangeSeparator ( const std::string & rangeSep)

The range separator will be automatically preformatted to deal with the specific output format.

Parameters
rangeSep

The documentation for this class was generated from the following files:
  • /cygdrive/d/a/scallywag/source-highlight/source-highlight-3.1.9-1.x86_64/src/source-highlight-3.1.9/lib/srchilite/sourcefilehighlighter.h
  • /cygdrive/d/a/scallywag/source-highlight/source-highlight-3.1.9-1.x86_64/src/source-highlight-3.1.9/lib/srchilite/sourcefilehighlighter.cpp