Logo Search packages:      
Sourcecode: highlight version File versions  Download package

highlight::CodeGenerator Class Reference

#include <codegenerator.h>

Inheritance diagram for highlight::CodeGenerator:

highlight::AnsiGenerator highlight::HtmlGenerator highlight::LatexGenerator highlight::PreviewGenerator highlight::RtfGenerator highlight::SVGGenerator highlight::TexGenerator highlight::XmlGenerator highlight::Xterm256Generator

List of all members.


Detailed Description

Base class for parsing. Works like a finite state machine.

The virtual class provides source code parsing functionality, based on information stored in language definitions.
The derived classes have to define the output format.
The colour information is stored in a DocumentStyle instance.
Codegenerator is a singleton class.
Use getInstance for a singleton class instance. Then call the init* methods and loadLanguage to initialize the parser. Call generate* methods to get results.

Author:
Andre Simon

Definition at line 111 of file codegenerator.h.


Public Member Functions

void addMarkedLine (int lineNo, string &helpTxt)
bool formattingDisabled ()
bool formattingIsPossible ()
ParseError generateFile (const string &inFileName, const string &outFileName)
string generateString (const string &input)
string generateStringFromFile (const string &inFileName)
const string getBaseFont () const
const string & getBaseFontSize ()
bool getFragmentCode ()
const LanguageDefinitiongetLanguage ()
int getLineNumberWidth ()
bool getPrintLineNumbers ()
bool getPrintZeroes ()
const string & getStyleInputPath ()
const string & getStyleName ()
const string & getStyleOutputPath ()
string getTitle ()
bool getValidateInput ()
bool hasWhiteBGColour ()
bool initIndentationScheme (const string &indentScheme)
LoadResult initLanguage (const string &langDefPath)
bool initTagInformation (const string &ctagsPath)
virtual bool initTheme (const string &themePath)
LoadResult loadLanguage (const string &langDefPath)
bool printExternalStyle (const string &outFile)
virtual bool printIndexFile (const vector< string > &fileList, const string &outPath)
void setBaseFont (const string &s)
void setBaseFontSize (const string &s)
void setEncoding (const string &encodingName)
void setFragmentCode (bool flag)
virtual void setHTMLAnchorPrefix (const string &)
virtual void setHTMLAttachAnchors (bool)
virtual void setHTMLClassName (const string &)
virtual void setHTMLEnclosePreTag (bool)
virtual void setHTMLInlineCSS (bool)
virtual void setHTMLOrderedList (bool)
void setIncludeStyle (bool flag)
void setKeyWordCase (StringTools::KeywordCase keyCase)
virtual void setLATEXNoShorthands (bool)
virtual void setLATEXPrettySymbols (bool)
virtual void setLATEXReplaceQuotes (bool)
void setLineNumberWidth (int w)
void setMaxInputLineCnt (unsigned int cnt)
void setPreformatting (WrapMode lineWrappingStyle, unsigned int lineLength, int numberSpaces)
void setPrintLineNumbers (bool flag, unsigned int startCnt=1)
void setPrintZeroes (bool flag)
virtual void setRTFCharStyles (bool)
virtual void setRTFPageSize (const string &)
void setStyleInputPath (const string &path)
void setStyleOutputPath (const string &path)
virtual void setSVGSize (const string &, const string &)
void setTitle (const string &title)
void setValidateInput (bool flag)
bool styleFound ()

Static Public Member Functions

static void deleteInstance (CodeGenerator *inst)
static CodeGeneratorgetInstance (OutputType type)

Protected Member Functions

 CodeGenerator (highlight::OutputType type)
bool encodingDefined ()
void flushWs ()
unsigned int getLineIndex ()
unsigned int getLineNumber ()
virtual string getNewLine ()
State getState (const string &s, unsigned int searchPos)
virtual string getStyleDefinition ()
unsigned int getStyleID (State s, unsigned int kwClassID=0)
virtual string maskCharacter (unsigned char c)=0
void maskString (ostream &ss, const string &s)
void processRootState ()
string readUserStyleDef ()

Protected Attributes

string baseFont
string baseFontSize
unsigned int currentKeywordClass
State currentState
DocumentStyle docStyle
string docTitle
string encoding
bool excludeWs
bool fragmentOutput
istream * in
bool includeStyleDef
string inFile
 input file name
LanguageDefinition langInfo
string line
unsigned int lineNumber
bool lineNumberFillZeroes
int lineNumberOffset
map< int, string > markLines
bool maskWs
string maskWsBegin
 open whitespace mask
string maskWsEnd
 close whitespace mask
CTagsReader metaInfo
string newLineTag
ostream * out
string outFile
 output file name
PreFormatter preFormatter
bool showLineNumbers
string spacer
string styleCommentClose
 close comment delimiter
string styleCommentOpen
 open comment delimiter
vector< string > styleTagClose
 list of format delimiters (close format descriptions)
vector< string > styleTagOpen
 list of format delimiters (open new format descriptions)
string wsBuffer

Static Protected Attributes

static const unsigned int NUMBER_BUILTIN_STATES = 10
 number of token states (without keyword group IDs)

Private Member Functions

bool checkSpecialCmd ()
void closeKWTag (unsigned int styleID)
void closeTag (unsigned int styleID)
void closeTag (State s)
 CodeGenerator (const CodeGenerator &)
State getCurrentState ()
virtual string getFooter ()=0
virtual string getHeader ()=0
unsigned char getInputChar ()
virtual string getMatchingCloseTag (unsigned int)=0
virtual string getMatchingOpenTag (unsigned int)=0
virtual string getMetaInfoCloseTag ()
virtual string getMetaInfoOpenTag (const TagInfo &info)
virtual void insertLineNumber (bool insertNewLine=true)
void matchRegex (const string &line)
void openKWTag (unsigned int styleID)
void openTag (unsigned int styleID)
void openTag (State s)
CodeGeneratoroperator= (CodeGenerator &)
virtual void printBody ()=0
void printMaskedToken (bool addMetaInfo=false, bool flushWhiteSpace=true, StringTools::KeywordCase tcase=StringTools::CASE_UNCHANGED)
bool processDirectiveState ()
 process directives
bool processEscapeCharState ()
 process escape characters
bool processKeywordState (State myState)
 process keywords
bool processMultiLineCommentState ()
 process multi line comments
bool processNumberState ()
 process numbers
bool processSingleLineCommentState ()
 process single line comments
bool processStringState (State oldState)
 process strings
bool processSymbolState ()
 process symbols
bool processTagState ()
 process tags
void processWsState ()
 process whitespace
bool readNewLine (string &newLine)
void reset ()
bool validateInputStream ()

Private Attributes

astyle::ASFormatter * formatter
bool formattingEnabled
bool formattingPossible
StringTools::KeywordCase keywordCase
unsigned int lineIndex
 contains current position in line
unsigned int lineNumberWidth
 width of line numbering coloumn
unsigned int maxLineCnt
OutputType outputType
map< int, ReGroupregexGroups
string styleInputPath
 style input file path
string styleOutputPath
 style output file path
bool tagsEnabled
unsigned char terminatingChar
string themePath
 path to style definition file
string token
bool validateInput

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

Generated by  Doxygen 1.6.0   Back to index