00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef HTMLGENERATOR_H
00020 #define HTMLGENERATOR_H
00021
00022 #include <fstream>
00023 #include <iostream>
00024 #include <string>
00025 #include <sstream>
00026
00027 #include "codegenerator.h"
00028 #include "version.h"
00029 #include "stylecolour.h"
00030 #include "elementstyle.h"
00031 #include "platform_fs.h"
00032
00033 namespace highlight {
00034
00045 class HtmlGenerator : public highlight::CodeGenerator
00046 {
00047 public:
00048
00049 HtmlGenerator();
00050
00052 virtual ~HtmlGenerator() {};
00053
00056 virtual void insertLineNumber(bool insertNewLine=true);
00057
00061 string getHeader(const string &title);
00062
00064 void printBody();
00065
00067 string getFooter();
00068
00072 bool printExternalStyle(const string &outFile);
00073
00078 bool printIndexFile(const vector<string> & fileList, const string &outPath);
00079
00083 void setAttachAnchors(bool b){ attachAnchors = b; }
00084
00088 void setOrderedList(bool b){ orderedList = b; }
00089
00090 protected:
00091
00093 string brTag, hrTag, idAttr, fileSuffix;
00094
00096
00097
00099 string styleDefinitionCache;
00100
00102 bool orderedList;
00103
00105 string getStyleDefinition();
00106
00108 string readUserStyleDef();
00109
00112 virtual string getHeaderStart(const string &title);
00113
00114 string getGeneratorComment();
00115
00116 private:
00117
00121 string getOpenTag(const string& styleName);
00122
00124 virtual string maskCharacter(unsigned char );
00125
00127 bool attachAnchors;
00128
00130 string formatStyleAttributes(const string & elemName, const ElementStyle & elem);
00131
00135 string getMatchingOpenTag(unsigned int styleID);
00136
00140 string getMatchingCloseTag(unsigned int styleID);
00141
00142 string getNewLine();
00143 };
00144
00145 }
00146
00147 #endif