//================================================================================================== // T e x t _ f o r m a t Interface // H t m l // By Bruno Bachelet //================================================================================================== // Copyright (c) 1999-2016 // Bruno Bachelet - bruno@nawouak.net - http://www.nawouak.net // // This file is part of the B++ Library. This library is free software; you can redistribute it // and/or modify it under the terms of the GNU Library General Public License as published by the // Free Software Foundation; either version 2 of the License, or (at your option) any later // version. // // This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See // the GNU Library General Public License for more details (http://www.gnu.org).
/*DESCRIPTION*/ /* This module provides facilities to generate text documents in the HTML format. */
// File Name //------------------------------------------------------------------------------------- #line __LINE__ "text_format/html.hpp"
// Guardian //-------------------------------------------------------------------------------------- #ifndef guTextFormatHtml #define guTextFormatHtml
// Headers //--------------------------------------------------------------------------------------- #include <bpp/standard.hpp> /*INCLUDE*/
namespace bpp {
// Importation/Exportation //----------------------------------------------------------------------- #ifdef TEXT_FORMAT_DLL #define dll_export DLL_EXPORT #else #define dll_export DLL_IMPORT #endif
// Namespaces //------------------------------------------------------------------------------------ #define public_area textFormatHtml #define private_area textFormatHtml_private
namespace public_area { /*NAMESPACE*/ using namespace standard; } namespace private_area { using namespace public_area; }
extern_module_name;
// Initialization //-------------------------------------------------------------------------------- #define iniTextFormatHtml has_initializer;
// Macrocommands //---------------------------------------------------------------------------------
// Types //----------------------------------------------------------------------------------------- namespace public_area { //------------------------------------------------------------------------------------------Classes class clHtmlFile; class clHtmlTemplate; //-----------------------------------------------------------------------------------Constant Types typedef const clHtmlFile ctHtmlFile; typedef const clHtmlTemplate ctHtmlTemplate; }
namespace private_area {}
// Functions Interface //--------------------------------------------------------------------------- namespace public_area { function clHtmlFile & operator << (clHtmlFile &,ctString &); function clHtmlFile & operator << (clHtmlFile &,tcString); function clHtmlFile & operator << (clHtmlFile &,tyCardinal);
function void getHtmlFormat(clInStream &,clString &); }
namespace private_area { testing_mode ( function void test(void); ) }
// Errors //---------------------------------------------------------------------------------------- namespace public_area { /*ERROR*/ extern_error erDefaultHtmlTemplateParameterMissing; /* The <CODE>default_html_template</CODE> parameter is missing in the initialization file. */
/*ERROR*/ extern_error erHtmlFileClosed; /* The file is closed. */ /*ERROR*/ extern_error erHtmlFormat; /* The format is not correct. */ /*ERROR*/ extern_error erNoMoreHole; /* There is no more hole in the HTML format. */ }
// Constants & Variables //------------------------------------------------------------------------- /*CONSTANT*/ /* Symbol that represents a hole in an HTML format string. */ extern_static_constant(public,tyCharacter,goHoleSymbol,holeSymbol);
extern_static_constant(private,tcString,goBulletFlag,?); extern_static_constant(private,tcString,goCharacterWidthFlag,?); extern_static_constant(private,tcString,goCodePageFlag,?); extern_static_constant(private,tcString,goCopyrightFlag,?); extern_static_constant(private,tcString,goEndFileFlag,?); extern_static_constant(private,tcString,goEndSequenceFlag,?); extern_static_constant(private,tcString,goFrameFlag,?); extern_static_constant(private,tcString,goFramePageFlag,?); extern_static_constant(private,tcString,goHomeFrameNameFlag,?); extern_static_constant(private,tcString,goHorizontalSpaceFlag,?); extern_static_constant(private,tcString,goImage,?); extern_static_constant(private,tcString,goMainFrameNameFlag,?); extern_static_constant(private,tcString,goMenuPageFlag,?); extern_static_constant(private,tcString,goNormalPageFlag,?); extern_static_constant(private,tcString,goSeparatorTableTableFlag,?); extern_static_constant(private,tcString,goSeparatorTableTextFlag,?); extern_static_constant(private,tcString,goSeparatorTableTitleFlag,?); extern_static_constant(private,tcString,goSeparatorTableTitle1Flag,?); extern_static_constant(private,tcString,goSeparatorTextTableFlag,?); extern_static_constant(private,tcString,goSeparatorTextTextFlag,?); extern_static_constant(private,tcString,goSeparatorTextTitleFlag,?); extern_static_constant(private,tcString,goSeparatorTextTitle1Flag,?); extern_static_constant(private,tcString,goSeparatorTitleTableFlag,?); extern_static_constant(private,tcString,goSeparatorTitleTextFlag,?); extern_static_constant(private,tcString,goSeparatorTitleTitleFlag,?); extern_static_constant(private,tcString,goSeparatorTitleTitle1Flag,?); extern_static_constant(private,tcString,goSeparatorTitle1TableFlag,?); extern_static_constant(private,tcString,goSeparatorTitle1TextFlag,?); extern_static_constant(private,tcString,goSeparatorTitle1TitleFlag,?); extern_static_constant(private,tcString,goSeparatorTitle1Title1Flag,?); extern_static_constant(private,tcString,goTableFlag,?); extern_static_constant(private,tcString,goTitle1Flag,?); extern_static_constant(private,tcString,goTitle2Flag,?); extern_static_constant(private,tcString,goTitle3Flag,?); extern_static_constant(private,tcString,goTitle4Flag,?);
extern_static_constant(private,tcString,goNormalIndicatorFlag,?); extern_static_constant(private,tcString,goTableIndicatorFlag,?); extern_static_constant(private,tcString,goTextIndicatorFlag,?); extern_static_constant(private,tcString,goTitleIndicatorFlag,?); extern_static_constant(private,tcString,goTitle1IndicatorFlag,?);
/*VARIABLE*/ /* Default template of HTML document. */ extern_dynamic_constant(public,clHtmlTemplate,goDefaultHtmlTemplate,defaultHtmlTemplate);
extern_dynamic_constant(private,clString,goDataLocation,?);
// H t m l F i l e Interface //-------------------------------------------------------------------- namespace public_area { /*CLASS clHtmlFile */ /* Represents an input file in which HTML code will be written. */ class clHtmlFile { //-----------------------------------------------------------------------------------------Friends friend clHtmlFile & operator << (clHtmlFile &,ctString &); friend clHtmlFile & operator << (clHtmlFile &,tcString); friend clHtmlFile & operator << (clHtmlFile &,tyCardinal); //-------------------------------------------------------------------------------------------Types private_property enumeration { tableEnd, textEnd, titleEnd, title1End, normalEnd } tyEndIndicator; //-----------------------------------------------------------------------------------------Private private_property ctHtmlTemplate & atTemplate; private_property clOutFile * atFile; private_property tyBoolean atOwner; private_property std_vector(clString) atFormatS; private_property tyEndIndicator atEndIndicator;
private_property constructor clHtmlFile(const clHtmlFile &); private_property clHtmlFile & operator = (const clHtmlFile &);
private_property clHtmlFile & nextHole(void);
private_property void tableSeparation(void); private_property void textSeparation(void); private_property void titleSeparation(void); private_property void title1Separation(void); //------------------------------------------------------------------------------------------Public public_property constructor clHtmlFile(ctHtmlTemplate &); public_property constructor clHtmlFile(ctHtmlTemplate &,tcString); public_property constructor clHtmlFile(ctHtmlTemplate &,clOutFile &); public_property destructor clHtmlFile(void);
public_property clHtmlFile & operator = (clOutFile &); public_property clHtmlFile & operator = (tcString);
public_property ctHtmlTemplate & model(void) const;
public_property clHtmlFile & big(void); public_property clHtmlFile & bold(void); public_property clHtmlFile & bookmark(tcString); public_property clHtmlFile & breakLine(void); public_property clHtmlFile & bullet(void); public_property clHtmlFile & cell(tcString="left",tcString="MIDDLE",tcString=""); public_property clHtmlFile & center(void); public_property clHtmlFile & cite(void); public_property clHtmlFile & code(void); public_property clHtmlFile & codePage(tcString); public_property clHtmlFile & convert(tcString); public_property clHtmlFile & copyright(void); public_property clHtmlFile & emptySymbol(void); public_property clHtmlFile & fontSize(tcString); public_property clHtmlFile & frame(tcString,tcString); public_property clHtmlFile & framePage(tcString); public_property clHtmlFile & greaterSymbol(void); public_property clHtmlFile & horizontalSpace(tyCardinal); public_property clHtmlFile & image(tcString); public_property clHtmlFile & indentation(void); public_property clHtmlFile & italic(void); public_property clHtmlFile & lesserSymbol(void); public_property clHtmlFile & link(tcString,tcString); public_property clHtmlFile & listItem(void); public_property clHtmlFile & little(void); public_property clHtmlFile & menuPage(tcString); public_property clHtmlFile & newLine(void); public_property clHtmlFile & normalPage(tcString); public_property clHtmlFile & orderedList(void); public_property clHtmlFile & paragraph(void); public_property clHtmlFile & quotesSymbol(void); public_property clHtmlFile & remark(void); public_property clHtmlFile & row(void); public_property clHtmlFile & sansSerif(void); public_property clHtmlFile & serif(void); public_property clHtmlFile & signature(void); public_property clHtmlFile & table(tcString="",tcString="1",tcString="0"); public_property clHtmlFile & title1(void); public_property clHtmlFile & title2(void); public_property clHtmlFile & title3(void); public_property clHtmlFile & title4(void); public_property clHtmlFile & unorderedList(void);
public_property tcString homeFrameName(void); public_property tcString mainFrameName(void);
public_property clHtmlFile & next(tyCardinal); public_property void terminate(void); }; }
// H t m l T e m p l a t e Interface //------------------------------------------------------------ namespace public_area { /*CLASS clHtmlTemplate */ /* Represents a template of HTML document. */ class clHtmlTemplate { //-----------------------------------------------------------------------------------------Private private_property constructor clHtmlTemplate(const clHtmlTemplate &); private_property clHtmlTemplate & operator = (const clHtmlTemplate &); //------------------------------------------------------------------------------------------Public /*ATTRIBUTE clHtmlTemplate */ /* Format of a normal page. */ read_write_attribute(clString,atNormalPage,normalPage);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a menu page. */ read_write_attribute(clString,atMenuPage,menuPage);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a framed page. */ read_write_attribute(clString,atFramePage,framePage);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a page for the display of source code. */ read_write_attribute(clString,atCodePage,codePage);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a frame. */ read_write_attribute(clString,atFrame,frame);
/*ATTRIBUTE clHtmlTemplate */ /* Name of the home frame (frame that contains the framed page). */ read_write_attribute(clString,atHomeFrameName,homeFrameName);
/*ATTRIBUTE clHtmlTemplate */ /* Name of the main frame (main frame of the framed page). */ read_write_attribute(clString,atMainFrameName,mainFrameName);
/*ATTRIBUTE clHtmlTemplate */ /* Format 1 of a title (the biggest). */ read_write_attribute(clString,atTitle1,title1);
/*ATTRIBUTE clHtmlTemplate */ /* Format 2 of a title. */ read_write_attribute(clString,atTitle2,title2);
/*ATTRIBUTE clHtmlTemplate */ /* Format 3 of a title. */ read_write_attribute(clString,atTitle3,title3);
/*ATTRIBUTE clHtmlTemplate */ /* Format 4 of a title (the smallest). */ read_write_attribute(clString,atTitle4,title4);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a paragraph. */ read_only_attribute(clString,atParagraph,paragraph);
/*ATTRIBUTE clHtmlTemplate */ /* Format of an indentation. */ read_only_attribute(clString,atIndentation,indentation);
/*ATTRIBUTE clHtmlTemplate */ /* Format and content of the copyright. */ read_write_attribute(clString,atCopyright,copyright);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a bullet. */ read_write_attribute(clString,atBullet,bullet);
/*ATTRIBUTE clHtmlTemplate */ /* Format of an image. */ read_write_attribute(clString,atImage,image);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a table. */ read_write_attribute(clString,atTable,table);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a row of a table. */ read_only_attribute(clString,atRow,row);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a cell of a row. */ read_only_attribute(clString,atCell,cell);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code for the symbol <CODE>></CODE>. */ read_only_attribute(clString,atGreaterSymbol,greaterSymbol);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code for the symbol <CODE><</CODE>. */ read_only_attribute(clString,atLesserSymbol,lesserSymbol);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code for the symbol <CODE>"</CODE>. */ read_only_attribute(clString,atQuotesSymbol,quotesSymbol);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code for a break line. */ read_only_attribute(clString,atBreakLine,breakLine);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code for the empty symbol. */ read_only_attribute(clString,atEmptySymbol,emptySymbol);
/*ATTRIBUTE clHtmlTemplate */ /* Format of an ordered list. */ read_write_attribute(clString,atOrderedList,orderedList);
/*ATTRIBUTE clHtmlTemplate */ /* Format of an unordered list. */ read_write_attribute(clString,atUnorderedList,unorderedList);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a list item. */ read_write_attribute(clString,atListItem,listItem);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a link. */ read_write_attribute(clString,atLink,link);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a bookmark. */ read_write_attribute(clString,atBookmark,bookmark);
/*ATTRIBUTE clHtmlTemplate */ /* Format for font size. */ read_write_attribute(clString,atFontSize,fontSize);
/*ATTRIBUTE clHtmlTemplate */ /* Format for big text. */ read_write_attribute(clString,atBig,big);
/*ATTRIBUTE clHtmlTemplate */ /* Format for bold text. */ read_write_attribute(clString,atBold,bold);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a center alignment. */ read_write_attribute(clString,atCenter,center);
/*ATTRIBUTE clHtmlTemplate */ /* Format for code text. */ read_write_attribute(clString,atCode,code);
/*ATTRIBUTE clHtmlTemplate */ /* Format for italic text. */ read_write_attribute(clString,atItalic,italic);
/*ATTRIBUTE clHtmlTemplate */ /* Format for sans-serif text. */ read_write_attribute(clString,atSansSerif,sansSerif);
/*ATTRIBUTE clHtmlTemplate */ /* Format for serif text. */ read_write_attribute(clString,atSerif,serif);
/*ATTRIBUTE clHtmlTemplate */ /* Format for cite text. */ read_write_attribute(clString,atCite,cite);
/*ATTRIBUTE clHtmlTemplate */ /* Format for small text. */ read_write_attribute(clString,atLittle,little);
/*ATTRIBUTE clHtmlTemplate */ /* Format of a remark. */ read_write_attribute(clString,atRemark,remark);
/*ATTRIBUTE clHtmlTemplate */ /* Format of an horizontal space. */ read_write_attribute(clString,atHorizontalSpace,horizontalSpace);
/*ATTRIBUTE clHtmlTemplate */ /* Width of a code character. */ read_write_attribute(tyCardinal,atCharacterWidth,characterWidth);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a table from another one. */ read_write_attribute(clString,atSeparatorTableTable,separatorTableTable);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a table from text. */ read_write_attribute(clString,atSeparatorTableText,separatorTableText);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a table from a title 2 to 4. */ read_write_attribute(clString,atSeparatorTableTitle,separatorTableTitle);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a table from a title 1. */ read_write_attribute(clString,atSeparatorTableTitle1,separatorTableTitle1);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate text from a table. */ read_write_attribute(clString,atSeparatorTextTable,separatorTextTable);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate text from text. */ read_write_attribute(clString,atSeparatorTextText,separatorTextText);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate text from a title 2 to 4. */ read_write_attribute(clString,atSeparatorTextTitle,separatorTextTitle);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate text from a title 1. */ read_write_attribute(clString,atSeparatorTextTitle1,separatorTextTitle1);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a title 2 to 4 from a table. */ read_write_attribute(clString,atSeparatorTitleTable,separatorTitleTable);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a title 2 to 4 from a table. */ read_write_attribute(clString,atSeparatorTitleText,separatorTitleText);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a title 2 to 4 from another one. */ read_write_attribute(clString,atSeparatorTitleTitle,separatorTitleTitle);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a title 2 to 4 from a title 1. */ read_write_attribute(clString,atSeparatorTitleTitle1,separatorTitleTitle1);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a title 1 from a table. */ read_write_attribute(clString,atSeparatorTitle1Table,separatorTitle1Table);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a title 1 from text. */ read_write_attribute(clString,atSeparatorTitle1Text,separatorTitle1Text);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a title 1 from a title 2 to 4. */ read_write_attribute(clString,atSeparatorTitle1Title,separatorTitle1Title);
/*ATTRIBUTE clHtmlTemplate */ /* HTML code to separate a title 1 from another one. */ read_write_attribute(clString,atSeparatorTitle1Title1,separatorTitle1Title1);
public_property constructor clHtmlTemplate(void); public_property constructor clHtmlTemplate(clInStream &); public_property destructor clHtmlTemplate(void); }; }
// Functions Inline //------------------------------------------------------------------------------ namespace public_area {} namespace private_area {}
// H t m l F i l e Inline //----------------------------------------------------------------------- namespace public_area { //---------------------------------------------------------------------------------------Destructor /*METHOD clHtmlFile */ /* Destructs the object. Closes all the remaining holes and the file. */ inline clHtmlFile::~clHtmlFile(void) { terminate(); } //--------------------------------------------------------------------------------------------Model /*METHOD clHtmlFile */ /* Returns the template of HTML document used. */ inline ctHtmlTemplate & clHtmlFile::model(void) const { return (atTemplate); } //----------------------------------------------------------------------------------------------Big /*METHOD clHtmlFile */ /* Adds a big font. */ inline clHtmlFile & clHtmlFile::big(void) { (*this) << atTemplate.big(); return (*this); } //---------------------------------------------------------------------------------------------Bold /*METHOD clHtmlFile */ /* Adds a bold font. */ inline clHtmlFile & clHtmlFile::bold(void) { (*this) << atTemplate.bold(); return (*this); } //-----------------------------------------------------------------------------------------Bookmark /*METHOD clHtmlFile */ /* Adds a bookmark. */ inline clHtmlFile & clHtmlFile::bookmark(tcString agName) { (*this) << atTemplate.bookmark() << agName << 1; return (*this); } //----------------------------------------------------------------------------------------BreakLine /*METHOD clHtmlFile */ /* Adds a break line. */ inline clHtmlFile & clHtmlFile::breakLine(void) { (*this) << atTemplate.breakLine(); return (*this); } //-------------------------------------------------------------------------------------------Bullet /*METHOD clHtmlFile */ /* Adds a bullet. */ inline clHtmlFile & clHtmlFile::bullet(void) { (*this) << atTemplate.bullet(); return (*this); } //---------------------------------------------------------------------------------------------Cell /*METHOD clHtmlFile */ /* Adds a cell. */ inline clHtmlFile & clHtmlFile::cell(tcString agHorizontalAlignment,tcString agVerticalAlignment, tcString agWidth) { (*this) << atTemplate.cell() << agHorizontalAlignment << 1 << agVerticalAlignment << 1; (*this) << agWidth << 1; return (*this); } //-------------------------------------------------------------------------------------------Center /*METHOD clHtmlFile */ /* Adds a center alignment. */ inline clHtmlFile & clHtmlFile::center(void) { (*this) << atTemplate.center(); return (*this); } //---------------------------------------------------------------------------------------------Cite /*METHOD clHtmlFile */ /* Adds a cite font. */ inline clHtmlFile & clHtmlFile::cite(void) { (*this) << atTemplate.cite(); return (*this); } //---------------------------------------------------------------------------------------------Code /*METHOD clHtmlFile */ /* Adds a code font. */ inline clHtmlFile & clHtmlFile::code(void) { (*this) << atTemplate.code(); return (*this); } //-----------------------------------------------------------------------------------------MenuPage /*METHOD clHtmlFile */ /* Adds a code page. */ inline clHtmlFile & clHtmlFile::codePage(tcString agTitle) { (*this) << atTemplate.codePage() << agTitle << 1; return (*this); } //----------------------------------------------------------------------------------------Copyright /*METHOD clHtmlFile */ /* Adds a copyright. */ inline clHtmlFile & clHtmlFile::copyright(void) { title1Separation(); (*this) << atTemplate.copyright(); return (*this); } //--------------------------------------------------------------------------------------EmptySymbol /*METHOD clHtmlFile */ /* Adds an empty symbol. */ inline clHtmlFile & clHtmlFile::emptySymbol(void) { (*this) << atTemplate.emptySymbol(); return (*this); } //-----------------------------------------------------------------------------------------FontSize /*METHOD clHtmlFile */ /* Adds a font size. */ inline clHtmlFile & clHtmlFile::fontSize(tcString agSize) { (*this) << atTemplate.fontSize() << agSize << 1; return (*this); } //--------------------------------------------------------------------------------------------Frame /*METHOD clHtmlFile */ /* Adds a frame. */ inline clHtmlFile & clHtmlFile::frame(tcString agName,tcString agFileName) { (*this) << atTemplate.frame() << agFileName << 1 << agName << 1; return (*this); } //----------------------------------------------------------------------------------------FramePage /*METHOD clHtmlFile */ /* Adds a framed page. */ inline clHtmlFile & clHtmlFile::framePage(tcString agTitle) { (*this) << atTemplate.framePage() << agTitle << 1; return (*this); } //------------------------------------------------------------------------------------GreaterSymbol /*METHOD clHtmlFile */ /* Adds the <CODE>></CODE> symbol. */ inline clHtmlFile & clHtmlFile::greaterSymbol(void) { (*this) << atTemplate.greaterSymbol(); return (*this); } //--------------------------------------------------------------------------------------------Image /*METHOD clHtmlFile */ /* Adds an image. */ inline clHtmlFile & clHtmlFile::image(tcString agFileName) { tableSeparation(); (*this) << atTemplate.image() << agFileName << 1; return (*this); } //--------------------------------------------------------------------------------------Indentation /*METHOD clHtmlFile */ /* Adds an indentation. */ inline clHtmlFile & clHtmlFile::indentation(void) { textSeparation(); (*this) << atTemplate.indentation(); return (*this); } //-------------------------------------------------------------------------------------------Italic /*METHOD clHtmlFile */ /* Adds an italic font. */ inline clHtmlFile & clHtmlFile::italic(void) { (*this) << atTemplate.italic(); return (*this); } //-------------------------------------------------------------------------------------LesserSymbol /*METHOD clHtmlFile */ /* Adds the <CODE><</CODE> symbol. */ inline clHtmlFile & clHtmlFile::lesserSymbol(void) { (*this) << atTemplate.lesserSymbol(); return (*this); } //---------------------------------------------------------------------------------------------Link /*METHOD clHtmlFile */ /* Adds a link. */ inline clHtmlFile & clHtmlFile::link(tcString agTargetFrame,tcString agFileName) { (*this) << atTemplate.link() << agTargetFrame << 1 << agFileName << 1; return (*this); } //-----------------------------------------------------------------------------------------ListItem /*METHOD clHtmlFile */ /* Adds a list item. */ inline clHtmlFile & clHtmlFile::listItem(void) { (*this) << atTemplate.listItem(); return (*this); } //-------------------------------------------------------------------------------------------Little /*METHOD clHtmlFile */ /* Adds a small font. */ inline clHtmlFile & clHtmlFile::little(void) { (*this) << atTemplate.little(); return (*this); } //-----------------------------------------------------------------------------------------MenuPage /*METHOD clHtmlFile */ /* Adds a menu page. */ inline clHtmlFile & clHtmlFile::menuPage(tcString agTitle) { (*this) << atTemplate.menuPage() << agTitle << 1; return (*this); } //------------------------------------------------------------------------------------------NewLine /*METHOD clHtmlFile */ /* Adds a break line. */ inline clHtmlFile & clHtmlFile::newLine(void) { (*atFile) << end_line; return (*this); } //---------------------------------------------------------------------------------------NormalPage /*METHOD clHtmlFile */ /* Adds a normal page. */ inline clHtmlFile & clHtmlFile::normalPage(tcString agTitle) { (*this) << atTemplate.normalPage() << agTitle << 1; return (*this); } //--------------------------------------------------------------------------------------OrderedList /*METHOD clHtmlFile */ /* Adds an ordered list. */ inline clHtmlFile & clHtmlFile::orderedList(void) { textSeparation(); (*this) << atTemplate.orderedList(); return (*this); } //----------------------------------------------------------------------------------------Paragraph /*METHOD clHtmlFile */ /* Adds a paragraph. */ inline clHtmlFile & clHtmlFile::paragraph(void) { textSeparation(); (*this) << atTemplate.paragraph(); return (*this); } //-------------------------------------------------------------------------------------QuotesSymbol /*METHOD clHtmlFile */ /* Adds the <CODE>"</CODE> symbol. */ inline clHtmlFile & clHtmlFile::quotesSymbol(void) { (*this) << atTemplate.quotesSymbol(); return (*this); } //-------------------------------------------------------------------------------------------Remark /*METHOD clHtmlFile */ /* Adds a remark. */ inline clHtmlFile & clHtmlFile::remark(void) { (*this) << atTemplate.remark(); return (*this); } //----------------------------------------------------------------------------------------------Row /*METHOD clHtmlFile */ /* Adds a row. */ inline clHtmlFile & clHtmlFile::row(void) { (*this) << atTemplate.row(); return (*this); } //----------------------------------------------------------------------------------------SansSerif /*METHOD clHtmlFile */ /* Adds a sans-serif font. */ inline clHtmlFile & clHtmlFile::sansSerif(void) { (*this) << atTemplate.sansSerif(); return (*this); } //--------------------------------------------------------------------------------------------Serif /*METHOD clHtmlFile */ /* Adds a serif font. */ inline clHtmlFile & clHtmlFile::serif(void) { (*this) << atTemplate.serif(); return (*this); } //--------------------------------------------------------------------------------------------Table /*METHOD clHtmlFile */ /* Adds a table. */ inline clHtmlFile & clHtmlFile::table(tcString agWidth,tcString agBorderSize, tcString agCellPadding) { tableSeparation(); (*this) << atTemplate.table() << agWidth << 1 << agBorderSize << 1 << agCellPadding << 1; return (*this); } //-------------------------------------------------------------------------------------------Title1 /*METHOD clHtmlFile */ /* Adds a title 1. */ inline clHtmlFile & clHtmlFile::title1(void) { title1Separation(); (*this) << atTemplate.title1(); return (*this); } //-------------------------------------------------------------------------------------------Title2 /*METHOD clHtmlFile */ /* Adds a title 2. */ inline clHtmlFile & clHtmlFile::title2(void) { titleSeparation(); (*this) << atTemplate.title2(); return (*this); } //-------------------------------------------------------------------------------------------Title3 /*METHOD clHtmlFile */ /* Adds a title 3. */ inline clHtmlFile & clHtmlFile::title3(void) { titleSeparation(); (*this) << atTemplate.title3(); return (*this); } //-------------------------------------------------------------------------------------------Title4 /*METHOD clHtmlFile */ /* Adds a title 4. */ inline clHtmlFile & clHtmlFile::title4(void) { titleSeparation(); (*this) << atTemplate.title4(); return (*this); } //------------------------------------------------------------------------------------UnorderedList /*METHOD clHtmlFile */ /* Adds an unordered list. */ inline clHtmlFile & clHtmlFile::unorderedList(void) { textSeparation(); (*this) << atTemplate.unorderedList(); return (*this); } //------------------------------------------------------------------------------------HomeFrameName /*METHOD clHtmlFile */ /* Returns the home frame name. */ inline tcString clHtmlFile::homeFrameName(void) { return (atTemplate.homeFrameName().data()); } //------------------------------------------------------------------------------------MainFrameName /*METHOD clHtmlFile */ /* Returns the main frame name. */ inline tcString clHtmlFile::mainFrameName(void) { return (atTemplate.mainFrameName().data()); } //---------------------------------------------------------------------------------------------Next /*METHOD clHtmlFile */ /* Moves to the next hole. */ inline clHtmlFile & clHtmlFile::next(tyCardinal agNumber) { (*this) << agNumber; return (*this); } }
// End //------------------------------------------------------------------------------------------- } #undef dll_export #undef public_area #undef private_area #endif |
//================================================================================================== // T e x t _ f o r m a t Implementation // H t m l // By Bruno Bachelet //================================================================================================== // Copyright (c) 1999-2016 // Bruno Bachelet - bruno@nawouak.net - http://www.nawouak.net // // This file is part of the B++ Library. This library is free software; you can redistribute it // and/or modify it under the terms of the GNU Library General Public License as published by the // Free Software Foundation; either version 2 of the License, or (at your option) any later // version. // // This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See // the GNU Library General Public License for more details (http://www.gnu.org).
// File Name //------------------------------------------------------------------------------------- #line __LINE__ "text_format/html.cpp"
// DLL Belonging //--------------------------------------------------------------------------------- #define TEXT_FORMAT_DLL
// Headers //--------------------------------------------------------------------------------------- #include <bpp/text_format/html.hpp> /*INTERFACE*/
namespace bpp {
// Namespaces //------------------------------------------------------------------------------------ #define public_area textFormatHtml #define private_area textFormatHtml_private #define dll_export DLL_EXPORT
namespace public_area {} namespace private_area {}
static_module_name("Text_format/Html");
// Initialization //-------------------------------------------------------------------------------- #undef iniTextFormatHtml static_constant(private_area::clInitializer,goInitializer);
// Errors //---------------------------------------------------------------------------------------- namespace public_area { static_error(erDefaultHtmlTemplateParameterMissing); static_error(erHtmlFileClosed); static_error(erHtmlFormat); static_error(erNoMoreHole); }
// Constants & Variables //------------------------------------------------------------------------- static_constant(tyCharacter,goHoleSymbol); static_constant(tcString,goBulletFlag); static_constant(tcString,goCharacterWidthFlag); static_constant(tcString,goCodePageFlag); static_constant(tcString,goCopyrightFlag); static_constant(tcString,goEndFileFlag); static_constant(tcString,goEndSequenceFlag); static_constant(tcString,goFrameFlag); static_constant(tcString,goFramePageFlag); static_constant(tcString,goHomeFrameNameFlag); static_constant(tcString,goHorizontalSpaceFlag); static_constant(tcString,goImageFlag); static_constant(tcString,goMainFrameNameFlag); static_constant(tcString,goMenuPageFlag); static_constant(tcString,goNormalPageFlag); static_constant(tcString,goSeparatorTableTableFlag); static_constant(tcString,goSeparatorTableTextFlag); static_constant(tcString,goSeparatorTableTitleFlag); static_constant(tcString,goSeparatorTableTitle1Flag); static_constant(tcString,goSeparatorTextTableFlag); static_constant(tcString,goSeparatorTextTextFlag); static_constant(tcString,goSeparatorTextTitleFlag); static_constant(tcString,goSeparatorTextTitle1Flag); static_constant(tcString,goSeparatorTitleTableFlag); static_constant(tcString,goSeparatorTitleTextFlag); static_constant(tcString,goSeparatorTitleTitleFlag); static_constant(tcString,goSeparatorTitleTitle1Flag); static_constant(tcString,goSeparatorTitle1TableFlag); static_constant(tcString,goSeparatorTitle1TextFlag); static_constant(tcString,goSeparatorTitle1TitleFlag); static_constant(tcString,goSeparatorTitle1Title1Flag); static_constant(tcString,goTableFlag); static_constant(tcString,goTitle1Flag); static_constant(tcString,goTitle2Flag); static_constant(tcString,goTitle3Flag); static_constant(tcString,goTitle4Flag);
static_constant(tcString,goNormalIndicatorFlag); static_constant(tcString,goTableIndicatorFlag); static_constant(tcString,goTextIndicatorFlag); static_constant(tcString,goTitleIndicatorFlag); static_constant(tcString,goTitle1IndicatorFlag);
dynamic_constant(clHtmlTemplate,goDefaultHtmlTemplate); dynamic_constant(clString,goDataLocation);
// Static Members //-------------------------------------------------------------------------------- namespace public_area {} namespace private_area {}
// Functions Implementation //---------------------------------------------------------------------- namespace public_area { //--------------------------------------------------------------------------------------Operator << /*FUNCTION*/ /* Writes a string into the HTML file. */ function clHtmlFile & operator << (clHtmlFile & agFile,ctString & agString) { agFile.atFormatS.push_back(agString); agFile.nextHole(); return (agFile); } //--------------------------------------------------------------------------------------Operator << /*FUNCTION*/ /* Writes a string into the HTML file. */ function clHtmlFile & operator << (clHtmlFile & agFile,tcString agString) { agFile.atFormatS.push_back(clString(agString)); agFile.nextHole(); return (agFile); } //--------------------------------------------------------------------------------------Operator << /*FUNCTION*/ /* Closes a given number of holes in the HTML file. */ function clHtmlFile & operator << (clHtmlFile & agFile,tyCardinal agNumber) { while (agNumber>0) { agFile.nextHole(); agNumber--; }
return (agFile); } //------------------------------------------------------------------------------------GetHtmlFormat /*FUNCTION*/ /* Reads an HTML format from a stream. */ function void getHtmlFormat(clInStream & agStream,clString & agString) { method_name("getHtmlFormat"); clString lcString;
agStream >> lcString; agString="";
while (lcString!="" and lcString!=private_area::goEndSequenceFlag) { if (agString=="") agString=lcString; else if (lastCharacter(agString)=='>' or lcString[0]=='<') agString+=lcString; else agString+=" "+lcString; agStream >> lcString; }
if (agStream.fail()) send_error(erStreamReading); } }
namespace private_area {}
// H t m l F i l e Implementation //--------------------------------------------------------------- namespace public_area { //----------------------------------------------------------------------------------TableSeparation property void clHtmlFile::tableSeparation(void) { if (atEndIndicator==tableEnd) *this << atTemplate.separatorTableTable(); if (atEndIndicator==textEnd) *this << atTemplate.separatorTextTable(); else if (atEndIndicator==titleEnd) *this << atTemplate.separatorTitleTable(); else if (atEndIndicator==title1End) *this << atTemplate.separatorTitle1Table(); } //-----------------------------------------------------------------------------------TextSeparation property void clHtmlFile::textSeparation(void) { if (atEndIndicator==tableEnd) *this << atTemplate.separatorTableText(); if (atEndIndicator==textEnd) *this << atTemplate.separatorTextText(); else if (atEndIndicator==titleEnd) *this << atTemplate.separatorTitleText(); else if (atEndIndicator==title1End) *this << atTemplate.separatorTitle1Text(); } //----------------------------------------------------------------------------------TitleSeparation property void clHtmlFile::titleSeparation(void) { if (atEndIndicator==tableEnd) *this << atTemplate.separatorTableTitle(); if (atEndIndicator==textEnd) *this << atTemplate.separatorTextTitle(); else if (atEndIndicator==titleEnd) *this << atTemplate.separatorTitleTitle(); else if (atEndIndicator==title1End) *this << atTemplate.separatorTitle1Title(); } //---------------------------------------------------------------------------------Title1Separation property void clHtmlFile::title1Separation(void) { if (atEndIndicator==tableEnd) *this << atTemplate.separatorTableTitle1(); if (atEndIndicator==textEnd) *this << atTemplate.separatorTextTitle1(); else if (atEndIndicator==titleEnd) *this << atTemplate.separatorTitleTitle1(); else if (atEndIndicator==title1End) *this << atTemplate.separatorTitle1Title1(); } //-----------------------------------------------------------------------------------------NextHole property clHtmlFile & clHtmlFile::nextHole(void) { method_name("htmlFile::nextHole");
tyBoolean lcAgain = true;
tyCardinal lcCounter; tyCardinal lcCounter2; clString lcFormat; clString lcElement;
if (atFile==nil) send_error(erHtmlFileClosed); if (atFormatS.size()==0) send_error(erNoMoreHole); lcFormat=atFormatS.back(); atFormatS.pop_back(); lcCounter=0;
while (lcCounter!=lcFormat.size() and lcAgain) { if (lcFormat[lcCounter]==private_area::goHoleSymbol) { lcCounter2=lcCounter+1;
while (lcCounter2!=lcFormat.size() and lcFormat[lcCounter2]!=private_area::goHoleSymbol) lcCounter2++;
lcElement=lcFormat.part(lcCounter+1,lcCounter2-lcCounter-1); if (lcElement=="") lcAgain=false; else if (lcElement==private_area::goTableIndicatorFlag) atEndIndicator=tableEnd; else if (lcElement==private_area::goTextIndicatorFlag) atEndIndicator=textEnd; else if (lcElement==private_area::goTitleIndicatorFlag) atEndIndicator=titleEnd; else if (lcElement==private_area::goTitle1IndicatorFlag) atEndIndicator=title1End; else if (lcElement==private_area::goNormalIndicatorFlag) atEndIndicator=normalEnd; else send_error(erHtmlFormat); lcCounter=lcCounter2-1; } else (*atFile) << lcFormat[lcCounter];
lcCounter++; }
if (atFile->fail()) send_error(erFileWriting);
if (lcCounter!=lcFormat.size()) atFormatS.push_back(lcFormat.part(lcCounter+1,lcFormat.size()-lcCounter-1));
return (*this); } //--------------------------------------------------------------------------------------Constructor /*METHOD clHtmlFile */ /* Builds an object with no file associated. */ property clHtmlFile::clHtmlFile(ctHtmlTemplate & agTemplate) : atTemplate(agTemplate),atFile(nil),atOwner(false),atFormatS(),atEndIndicator(normalEnd) {} //--------------------------------------------------------------------------------------Constructor /*METHOD clHtmlFile */ /* Builds a new HTML file with a given template. */ property clHtmlFile::clHtmlFile(ctHtmlTemplate & agTemplate,tcString agName) : atTemplate(agTemplate),atFile(),atOwner(true),atFormatS(),atEndIndicator(normalEnd) { atFile=new_object(clOutFile); open(*atFile,agName,ios::out|ios::trunc); if (atFile->fail()) send_inline_error(erFileWriting,"htmlFile::constructor"); } //--------------------------------------------------------------------------------------Constructor /*METHOD clHtmlFile */ /* Builds a new HTML file with a given template. */ property clHtmlFile::clHtmlFile(ctHtmlTemplate & agTemplate,clOutFile & agFile) : atTemplate(agTemplate),atFile(&agFile),atOwner(false),atFormatS(),atEndIndicator(normalEnd) {} //---------------------------------------------------------------------------------------Operator = /*METHOD clHtmlFile */ /* Opens a new HTML file. */ property clHtmlFile & clHtmlFile::operator = (clOutFile & agFile) { terminate(); atFile=&agFile; atOwner=false; atEndIndicator=normalEnd; return (*this); } //---------------------------------------------------------------------------------------Operator = /*METHOD clHtmlFile */ /* Opens a new HTML file. */ property clHtmlFile & clHtmlFile::operator = (tcString agName) { terminate(); atFile=new_object(clOutFile); open(*atFile,agName,ios::out|ios::trunc); if (atFile->fail()) send_inline_error(erFileWriting,"htmlFile::operator ="); atOwner=true; atEndIndicator=normalEnd; return (*this); } //------------------------------------------------------------------------------------------Convert /*METHOD clHtmlFile */ /* Converts a string into HTML code. */ property clHtmlFile & clHtmlFile::convert(tcString agString) { if (agString!=nil) { while (agString[0]!=end_string) { if (agString[0]=='<') (*atFile) << atTemplate.lesserSymbol(); else if (agString[0]=='>') (*atFile) << atTemplate.greaterSymbol(); else if (agString[0]=='\"') (*atFile) << atTemplate.quotesSymbol();
else if (agString[0]==10) { (*atFile) << atTemplate.breakLine(); while (agString[1]==13) agString++; }
else if (agString[0]==13) { (*atFile) << atTemplate.breakLine(); while (agString[1]==10) agString++; }
else (*atFile) << agString[0];
agString++; } }
return (*this); } //----------------------------------------------------------------------------------HorizontalSpace /*METHOD clHtmlFile */ /* Adds an horizontal space of a given number of characters. */ property clHtmlFile & clHtmlFile::horizontalSpace(tyCardinal agNumber) { while (agNumber>0) { *this << atTemplate.horizontalSpace(); agNumber--; } return (*this); } //----------------------------------------------------------------------------------------Signature /*METHOD clHtmlFile */ /* Adds the signature of the program into the file. */ property clHtmlFile & clHtmlFile::signature(void) { remark(); (*atFile) << end_line; (*atFile) << " Automatically generated by" << end_line; (*atFile) << " " << environment::programName() << end_line; (*atFile) << " " << environment::copyright() << end_line; (*atFile) << " " << environment::programmerName() << end_line; (*atFile) << " " << environment::programmerEmail() << end_line; (*atFile) << " " << environment::programmerURL() << end_line; (*this) << 1; (*atFile) << end_line;
return (*this); } //----------------------------------------------------------------------------------------Terminate /*METHOD clHtmlFile */ /* Closes all the remaining holes and the file. */ property void clHtmlFile::terminate(void) { while (atFormatS.size()!=0) nextHole();
if (atOwner and atFile!=nil) { close(*atFile); delete_object(atFile); }
atFile=nil; } }
// H t m l T e m p l a t e Implementation //------------------------------------------------------- namespace public_area { //--------------------------------------------------------------------------------------Constructor /*METHOD clHtmlTemplate */ /* Builds a template of HTML document. */ property clHtmlTemplate::clHtmlTemplate(clInStream & agStream) { method_name("htmlFormat::constructor");
tyCardinal lcCounter = 0; tyBoolean lcError = false; tyBoolean lcFoundS[33] = { false };
clString lcString;
agStream >> lcString;
while (lcString!=private_area::goEndFileFlag and lcString!="") {
if (lcString==private_area::goNormalPageFlag) { getHtmlFormat(agStream,atNormalPage); lcFoundS[0]=true; } else if (lcString==private_area::goMenuPageFlag) { getHtmlFormat(agStream,atMenuPage); lcFoundS[1]=true; } else if (lcString==private_area::goFramePageFlag) { getHtmlFormat(agStream,atFramePage); lcFoundS[2]=true; } else if (lcString==private_area::goFrameFlag) { getHtmlFormat(agStream,atFrame); lcFoundS[3]=true; } else if (lcString==private_area::goTitle1Flag) { getHtmlFormat(agStream,atTitle1); lcFoundS[4]=true; } else if (lcString==private_area::goTitle2Flag) { getHtmlFormat(agStream,atTitle2); lcFoundS[5]=true; } else if (lcString==private_area::goTitle3Flag) { getHtmlFormat(agStream,atTitle3); lcFoundS[6]=true; } else if (lcString==private_area::goTitle4Flag) { getHtmlFormat(agStream,atTitle4); lcFoundS[7]=true; } else if (lcString==private_area::goCopyrightFlag) { getHtmlFormat(agStream,atCopyright); lcFoundS[8]=true; } else if (lcString==private_area::goBulletFlag) { getHtmlFormat(agStream,atBullet); lcFoundS[9]=true; } else if (lcString==private_area::goTableFlag) { getHtmlFormat(agStream,atTable); lcFoundS[10]=true; } else if (lcString==private_area::goImageFlag) { getHtmlFormat(agStream,atImage); lcFoundS[11]=true; } else if (lcString==private_area::goSeparatorTableTableFlag) { getHtmlFormat(agStream,atSeparatorTableTable); lcFoundS[12]=true; } else if (lcString==private_area::goSeparatorTableTextFlag) { getHtmlFormat(agStream,atSeparatorTableText); lcFoundS[13]=true; } else if (lcString==private_area::goSeparatorTableTitleFlag) { getHtmlFormat(agStream,atSeparatorTableTitle); lcFoundS[14]=true; } else if (lcString==private_area::goSeparatorTableTitle1Flag) { getHtmlFormat(agStream,atSeparatorTableTitle1); lcFoundS[15]=true; } else if (lcString==private_area::goSeparatorTextTableFlag) { getHtmlFormat(agStream,atSeparatorTextTable); lcFoundS[16]=true; } else if (lcString==private_area::goSeparatorTextTextFlag) { getHtmlFormat(agStream,atSeparatorTextText); lcFoundS[17]=true; } else if (lcString==private_area::goSeparatorTextTitleFlag) { getHtmlFormat(agStream,atSeparatorTextTitle); lcFoundS[18]=true; } else if (lcString==private_area::goSeparatorTextTitle1Flag) { getHtmlFormat(agStream,atSeparatorTextTitle1); lcFoundS[19]=true; } else if (lcString==private_area::goSeparatorTitleTableFlag) { getHtmlFormat(agStream,atSeparatorTitleTable); lcFoundS[20]=true; } else if (lcString==private_area::goSeparatorTitleTextFlag) { getHtmlFormat(agStream,atSeparatorTitleText); lcFoundS[21]=true; } else if (lcString==private_area::goSeparatorTitleTitleFlag) { getHtmlFormat(agStream,atSeparatorTitleTitle); lcFoundS[22]=true; } else if (lcString==private_area::goSeparatorTitleTitle1Flag) { getHtmlFormat(agStream,atSeparatorTitleTitle1); lcFoundS[23]=true; } else if (lcString==private_area::goSeparatorTitle1TableFlag) { getHtmlFormat(agStream,atSeparatorTitle1Table); lcFoundS[24]=true; } else if (lcString==private_area::goSeparatorTitle1TextFlag) { getHtmlFormat(agStream,atSeparatorTitle1Text); lcFoundS[25]=true; } else if (lcString==private_area::goSeparatorTitle1TitleFlag) { getHtmlFormat(agStream,atSeparatorTitle1Title); lcFoundS[26]=true; } else if (lcString==private_area::goSeparatorTitle1Title1Flag) { getHtmlFormat(agStream,atSeparatorTitle1Title1); lcFoundS[27]=true; } else if (lcString==private_area::goHorizontalSpaceFlag) { getHtmlFormat(agStream,atHorizontalSpace); lcFoundS[28]=true; } else if (lcString==private_area::goCharacterWidthFlag) { agStream >> lcString; if (lcString!="=") send_error(erStreamReading); agStream >> atCharacterWidth; lcFoundS[29]=true; } else if (lcString==private_area::goHomeFrameNameFlag) { agStream >> lcString; if (lcString!="=") send_error(erStreamReading); agStream >> atHomeFrameName; lcFoundS[31]=true; } else if (lcString==private_area::goMainFrameNameFlag) { agStream >> lcString; if (lcString!="=") send_error(erStreamReading); agStream >> atMainFrameName; lcFoundS[30]=true; } else if (lcString==private_area::goCodePageFlag) { getHtmlFormat(agStream,atCodePage); lcFoundS[31]=true; } else { environment::nextLine(); environment::out("[!] Error: Unknown flag '",false,true); environment::out(lcString.data()); environment::out("'.",true); environment::nextLine(); send_error(erStreamReading); }
agStream >> lcString; }
atParagraph="<P CLASS=\"bpp\">$$</P>$text$"; atIndentation="<BLOCKQUOTE>$$</BLOCKQUOTE>$text$"; atRow="<TR>$$</TR>"; atCell="<TD STYLE=\"text-align: $$\" VALIGN=\"$$\" WIDTH=\"$$\">$$</TD>"; atGreaterSymbol=">"; atLesserSymbol="<"; atQuotesSymbol="""; atBreakLine="<BR>"; atEmptySymbol=" "; atOrderedList="<OL>$$</OL>"; atUnorderedList="<UL>$$</UL>"; atListItem="<LI>$$</LI>"; atLink="<A TARGET=\"$$\" HREF=\"$$\">$$</A>"; atBookmark="<A NAME=\"$$\"></A>"; atCenter="<CENTER>$$</CENTER>"; atFontSize="<SPAN STYLE=\"font-size: $$\">$$</SPAN>"; atBig="<BIG>$$</BIG>"; atBold="<B>$$</B>"; atCode="<CODE>$$</CODE>"; atItalic="<I>$$</I>"; atSansSerif="<SPAN STYLE=\"font-family: sans-serif\">$$</SPAN>"; atSerif="<SPAN STYLE=\"font-family: serif\">$$</SPAN>"; atCite="<CITE CLASS=\"bpp\">$$</CITE>"; atLittle="<SMALL>$$</SMALL>"; atRemark="<!-- $$ -->";
if (agStream.fail()) send_error(erStreamReading); while (lcCounter<32 and not lcError) lcError=not lcFoundS[lcCounter++]; if (lcError) send_error(erStreamReading); } //---------------------------------------------------------------------------------------Destructor /*METHOD clHtmlTemplate */ /* Destructs the template. */ property clHtmlTemplate::~clHtmlTemplate(void) {} }
// I n i t i a l i z e r Implementation //--------------------------------------------------------- namespace private_area { //--------------------------------------------------------------------------------------------Start property void clInitializer::start(void) { if (atCounter++ == 0) { try { #include <bpp/modules.hpp> /*NEED*/ registerStop(this); environment::informInitialization(goModuleName);
method_name("initializer::constructor");
clInFile lcFile;
erDefaultHtmlTemplateParameterMissing.create("The 'default_html_template' parameter is missing."); erHtmlFileClosed.create("HTML - The file is closed."); erHtmlFormat.create("HTML - The format isn't correct."); erNoMoreHole.create("HTML - There is no more hole.");
goHoleSymbol = '$'; goBulletFlag = "<bullet>"; goCharacterWidthFlag = "character_width"; goCodePageFlag = "<code_page>"; goCopyrightFlag = "<copyright>"; goEndFileFlag = "<end>"; goEndSequenceFlag = "<end_sequence>"; goFrameFlag = "<frame>"; goFramePageFlag = "<frame_page>"; goHomeFrameNameFlag = "home_frame_name"; goHorizontalSpaceFlag = "<horizontal_space>"; goImageFlag = "<image>"; goMainFrameNameFlag = "main_frame_name"; goMenuPageFlag = "<menu_page>"; goNormalPageFlag = "<normal_page>"; goSeparatorTableTableFlag = "<separator_table_table>"; goSeparatorTableTextFlag = "<separator_table_text>"; goSeparatorTableTitleFlag = "<separator_table_title>"; goSeparatorTableTitle1Flag = "<separator_table_title1>"; goSeparatorTextTableFlag = "<separator_text_table>"; goSeparatorTextTextFlag = "<separator_text_text>"; goSeparatorTextTitleFlag = "<separator_text_title>"; goSeparatorTextTitle1Flag = "<separator_text_title1>"; goSeparatorTitleTableFlag = "<separator_title_table>"; goSeparatorTitleTextFlag = "<separator_title_text>"; goSeparatorTitleTitleFlag = "<separator_title_title>"; goSeparatorTitleTitle1Flag = "<separator_title_title1>"; goSeparatorTitle1TableFlag = "<separator_title1_table>"; goSeparatorTitle1TextFlag = "<separator_title1_text>"; goSeparatorTitle1TitleFlag = "<separator_title1_title>"; goSeparatorTitle1Title1Flag = "<separator_title1_title1>"; goTableFlag = "<table>"; goTitle1Flag = "<title_1>"; goTitle2Flag = "<title_2>"; goTitle3Flag = "<title_3>"; goTitle4Flag = "<title_4>";
goNormalIndicatorFlag = "normal"; goTableIndicatorFlag = "table"; goTextIndicatorFlag = "text"; goTitleIndicatorFlag = "title"; goTitle1IndicatorFlag = "title1";
if (environment::parameters().count(clString("default_html_template"))==0) send_error(erDefaultHtmlTemplateParameterMissing);
open(lcFile,environment::parameter(clString("default_html_template")).data(),ios::in); goDefaultHtmlTemplate=new_object(clHtmlTemplate(lcFile)); if (lcFile.fail()) send_error(erFileReading); close(lcFile);
goDataLocation = new_object(clString(environment::dataLocation()+fileNameSeparator() +"text_format"+fileNameSeparator()+"html")); }
initializer_catch; } } //---------------------------------------------------------------------------------------------Stop property void clInitializer::stop(void) { try { environment::informTermination(goModuleName);
delete_object(goDefaultHtmlTemplate); delete_object(goDataLocation); }
initializer_catch; } }
// End //------------------------------------------------------------------------------------------- } |
|