00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef XTERM256GENERATOR_H
00029 #define XTERM256GENERATOR_H
00030
00031 #include <string>
00032
00033 #include "codegenerator.h"
00034
00035
00036 namespace highlight
00037 {
00038
00049 class Xterm256Generator : public highlight::CodeGenerator
00050 {
00051 public:
00052 Xterm256Generator();
00053 ~Xterm256Generator();
00054
00055 private:
00056
00059 string getHeader();
00060
00062 string getFooter();
00063
00065 void printBody();
00066
00068 virtual string maskCharacter ( unsigned char );
00069
00071 void initOutputTags();
00072
00075 string getOpenTag (const ElementStyle &style );
00076
00079 string getKeywordOpenTag ( unsigned int styleID );
00080
00083 string getKeywordCloseTag ( unsigned int styleID );
00084
00088 void xterm2rgb ( unsigned char color, unsigned char* rgb );
00089
00091 void maketable();
00092
00095 unsigned char rgb2xterm ( unsigned char* rgb );
00096
00098 static bool initialized;
00099
00101 static unsigned char colortable[254][3];
00102
00104 static const unsigned char valuerange[] ;
00105
00107 static const unsigned char basic16[16][3];
00108 };
00109
00110 }
00111 #endif