Source-highlight Library
|
00001 /* 00002 ** Copyright (C) 1999-2007 Lorenzo Bettini <http://www.lorenzobettini.it> 00003 ** 00004 ** This program is free software; you can redistribute it and/or modify 00005 ** it under the terms of the GNU General Public License as published by 00006 ** the Free Software Foundation; either version 3 of the License, or 00007 ** (at your option) any later version. 00008 ** 00009 ** This program is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 ** GNU General Public License for more details. 00013 ** 00014 ** You should have received a copy of the GNU General Public License 00015 ** along with this program; if not, write to the Free Software 00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 ** 00018 */ 00019 00020 // docgenerator.h : Document generator class 00021 00022 // for preable, header, footer, etc. 00023 00024 #ifndef DOCGENERATOR_H 00025 #define DOCGENERATOR_H 00026 00027 #include <string> 00028 #include <iostream> 00029 00030 #include "doctemplate.h" 00031 00032 using std::string; 00033 00034 namespace srchilite { 00035 00040 class DocGenerator { 00041 protected: 00042 string title; 00043 bool gen_source_highlight_version; 00044 string input_file_name; 00045 string doc_header; 00046 string doc_footer; 00047 string css_url; 00048 string doc_background; 00049 bool entire_doc; 00050 string input_lang; 00051 00052 DocTemplate docTemplate; 00053 00054 public: 00055 DocGenerator(const string &s, const string &i, const string &h, 00056 const string &f, const string &c, const string &back, bool entire, 00057 const string &inputlang, 00058 const string &start_tmpl, const string &end_tmpl) : 00059 title(s), gen_source_highlight_version(true), input_file_name(i), 00060 doc_header(h), doc_footer(f), css_url(c), doc_background(back), 00061 entire_doc(entire), input_lang(inputlang), docTemplate(DocTemplate(start_tmpl, 00062 end_tmpl)) { 00063 } 00064 DocGenerator(const string &start_tmpl, const string &end_tmpl) : 00065 gen_source_highlight_version(true), docTemplate(DocTemplate(start_tmpl, 00066 end_tmpl)) { 00067 } 00068 DocGenerator() { 00069 } 00070 ~DocGenerator() { 00071 } 00072 00078 void generate_start_doc(std::ostream *sout); 00079 00085 void generate_end_doc(std::ostream *sout); 00086 00090 void set_gen_version(bool b) { 00091 gen_source_highlight_version = b; 00092 } 00093 00094 void setInputFileName(const std::string &filename) { 00095 input_file_name = filename; 00096 } 00097 00098 void setTitle(const std::string &_title) { 00099 title = _title; 00100 } 00101 00102 void setInputLang(const std::string &_input_lang) { 00103 input_lang = _input_lang; 00104 } 00105 00106 void setBackgroundColor(const std::string &bg) { 00107 doc_background = bg; 00108 } 00109 00110 void setCss(const std::string &css) { 00111 css_url = css; 00112 } 00113 00114 void setHeader(const std::string &_header) { 00115 doc_header = _header; 00116 } 00117 00118 void setFooter(const std::string &_footer) { 00119 doc_footer = _footer; 00120 } 00121 }; 00122 00123 } 00124 00125 #endif // DOCGENERATOR_H