Source-highlight Library
srchilite::TextStyleFormatter Class Reference

An implementation of Formatter, based on source-highlight TextStyle. More...

#include <textstyleformatter.h>

Inheritance diagram for srchilite::TextStyleFormatter:
Collaboration diagram for srchilite::TextStyleFormatter:

Public Member Functions

 TextStyleFormatter (const TextStyle &style, BufferedOutput *o=0)
 
 TextStyleFormatter (const std::string &repr="$text", BufferedOutput *o=0)
 
virtual void format (const std::string &s, const FormatterParams *params=0)
 Formats the passed string. More...
 
BufferedOutput * getBufferedOutput () const
 
CTagsFormatter * getCTagsFormatter () const
 
void setBufferedOutput (BufferedOutput *o)
 
void setPreFormatter (PreFormatter *p)
 
void setCTagsFormatter (CTagsFormatter *f)
 
const std::string & toString () const
 

Protected Member Functions

void doFormat (const std::string &s, bool preformat=true)
 Actually performs formatting (no reference formatting); this is used internally. More...
 
bool formatReferences (const std::string &s, const FormatterParams *params)
 Performs reference formatting (by relying on the CTagsFormatter) More...
 

Private Attributes

TextStyle textstyle
 the TextStyle for formatting
 
BufferedOutput * output
 where to output the formatting
 
PreFormatter * preFormatter
 the possible pre formatter for text
 
CTagsFormatter * ctagsFormatter
 the possible formatter for ctags (references and anchors)
 

Detailed Description

An implementation of Formatter, based on source-highlight TextStyle.

Member Function Documentation

◆ doFormat()

void srchilite::TextStyleFormatter::doFormat ( const std::string &  s,
bool  preformat = true 
)
protected

Actually performs formatting (no reference formatting); this is used internally.

Parameters
sthe string to format.
preformatwhether to perform preformatting

◆ format()

void srchilite::TextStyleFormatter::format ( const std::string &  s,
const FormatterParams *  params = 0 
)
virtual

Formats the passed string.

Parameters
thestring to format
paramspossible additional parameters for the formatter

Implements srchilite::Formatter.

◆ formatReferences()

bool srchilite::TextStyleFormatter::formatReferences ( const std::string &  s,
const FormatterParams *  params 
)
protected

Performs reference formatting (by relying on the CTagsFormatter)

Parameters
sthe string to format.
paramsadditional parameters
Returns
true if an anchor or reference was found and formatted

◆ toString()

const std::string& srchilite::TextStyleFormatter::toString ( ) const
inline
Returns
a string representation of this formatter

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