CodeView  Version0.4
 All Classes Functions Variables
Public Member Functions | List of all members
cv::Format_HTML Class Reference

An implementation of a formater for HTML. More...

#include <format_html.h>

Inheritance diagram for cv::Format_HTML:
cv::Format

Public Member Functions

uint GetStyleCount ()
 Get the number of different styles supported by this format. More...
 
const os::String & GetStyleName (char)
 Get the name of the given style. More...
 
void SetStyle (char, const CodeViewStyle &)
 Set the color used to display the given style. More...
 
const CodeViewStyleGetStyle (char)
 Get the color used to display the given style. More...
 
CodeViewContext Parse (const os::String &cLine, os::String &cFormat, CodeViewContext cookie)
 Parse a line and assign styles to each character. More...
 
os::String GetIndentString (const os::String &cText, bool bUseTabs, uint nTabSize)
 Get the string used to prefix the next line. More...
 
uint GetPreviousWordLimit (const os::String &, uint nChr)
 Get the character index of the previous word limit. More...
 
uint GetNextWordLimit (const os::String &, uint nChr)
 Get the character index of the next word limit. More...
 
- Public Member Functions inherited from cv::Format
virtual int GetFoldLevel (const os::String &cLine, int nOldFoldLevel)
 Find foldable sections. More...
 

Detailed Description

An implementation of a formater for HTML.

Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

Member Function Documentation

os::String Format_HTML::GetIndentString ( const os::String &  cText,
bool  bUseTabs,
uint  nTabSize 
)
virtual

Get the string used to prefix the next line.

The format will analyze the given line and return a string to be used as prefix to the next line. This may be used to implement auto indenting of code.

As an example, for C++ the line "\t\tFlush();" may return the string "\t\t".

Parameters
cTextThe line to analyze.
bUseTabsUse TABs to indent.
nTabSizeLength of each TAB.
Returns
The string to prefix the next string with.
See Also
CodeView::setTabSize()
CodeView::getTabSize()
CodeView::setUseTab()
CodeView::getUseTab()

Implements cv::Format.

uint Format_HTML::GetNextWordLimit ( const os::String &  cLine,
uint  nChr 
)
virtual

Get the character index of the next word limit.

What is considered a word is up to the format.

Parameters
nLineThe line to analyze.
nChrThe character index to start from.
Returns
The character index of the next word limit, or the length if the string if none are found.

Implements cv::Format.

uint Format_HTML::GetPreviousWordLimit ( const os::String &  cLine,
uint  nChr 
)
virtual

Get the character index of the previous word limit.

What is considered a word is up to the format.

Parameters
nLineThe line to analyze.
nChrThe character index to start from.
Returns
The character index of the previous word limit, or 0 if the string if none are found.

Implements cv::Format.

const CodeViewStyle & Format_HTML::GetStyle ( char  nStyle)
virtual

Get the color used to display the given style.

This method must return a color for each of the styles in the range from 0 through getStyleCount()-1. The method is not defined for methods outside of this range, but implementors are encouraged to handle this gracefully.

Parameters
nStyleThe number of the style to return.
Returns
The color to display the given style with.

Implements cv::Format.

uint Format_HTML::GetStyleCount ( )
virtual

Get the number of different styles supported by this format.

Each format has a maximum number of styles it may use. This number can be in the range 1-255, and should not change during use, but the format is not required to actually use all of them.

Returns
The number of styles supported by this format.

Implements cv::Format.

const os::String & Format_HTML::GetStyleName ( char  nStyle)
virtual

Get the name of the given style.

This method must return a name for each of the styles in the range from 0 through getStyleCount()-1. The method is not defined for styles outside of this range, but implementors are encouraged to handle this gracefully.

The names are intended used in configuration dialogs.

Parameters
styleThe number of the style to return.
Returns
A string containing the display name of the given style.

Implements cv::Format.

CodeViewContext Format_HTML::Parse ( const os::String &  cText,
os::String &  cStyle,
CodeViewContext  nContext 
)
virtual

Parse a line and assign styles to each character.

The method will parse a single line of text and store the correct style to use for each character. After the method returns, character text[n] should be displayed using the style stored in style[n].

The format is responsible for resizing the style string to the correct size.

To correctly parse constructs spanning multiple lines, the format may store per-line context information in a 32-bit value. For the first line this value is defined to be 0, but for all other lines the value returned for the previous line should be passed as the context parameter.

Parameters
textThe line of text to parse.
styleA string to put the styles into.
contextA value representing the current context.
Returns
A value representing the new context.

Implements cv::Format.

void Format_HTML::SetStyle ( char  nStyle,
const CodeViewStyle cStyle 
)
virtual

Set the color used to display the given style.

This method must accept a color for each of the styles in the range from 0 through getStyleCount()-1. The method is not defined for methods outside of this range, but implementors are encouraged to handle this gracefully.

Parameters
nStyleThe number of the style to set.
cStyleThe color to display the given style with.

Implements cv::Format.


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