Lore's Source to HTML Converter

Source Documentation

  Some general notes
  Class overview: Kernels
  Class overview: Gui

Main Index top

Some general notes

The Gui version is written using Borland C++ Builder 5. The DOS command line version uses the compiler Borland C++ 5.02. Actually the Gui v3.4b is covered here.


Main Index top

Class Overview: Kernels

Class Module Description
TConv2HTML Conv2Html.h
Conv2Html.cpp

The conversion object. You provide the syntax highlighting style (TItemStyle), the lanuage of the source (TLanguage) and some options (TOptions) in the constructor. Then you just call the function Convert() passing input and output streams and some additional stuff like back link text.

TLanguage Language.h
Language.cpp

Language definition to be used when converting a file to HTML. Encapsulates TWordList and TRegex objects. Provides a real bunch of functions to check, for example, if a given string matches a keyword, a comment ... Loads and saves from/to a part of the language definition file.

TLanguages Languages.h
Languages.cpp

Simple class encapsulating several TLanguage objects. Loads and saves from/to the language definition file.

TWordList WordList.h
WordList.cpp

Simple class encapsulating a alphabetically sorted keyword list. Provides the function IsInList() to check if a keyword is in the list. Loads and saves from/to a part of the language definition file.

TRegex Regex.h
Regex.cpp

Very simple regular expression parser. You set the regular expression string using SetRegex(). Then you may check with StartsWithRegex() if a given string starts with a sequence that matches the regular expression.

TOptions Options.h
Options.cpp

Encapsulates all the options like the tab stop positions or back link text. Loads and saves from/to the ini file or to a part of a project file.

TProject Project.h
Project.cpp

Derived from TOptions. Adds some additional project settings like the source and destination file lists or the highlighting style name. Loads and saves from/to a project file.

TItemStyles ItemStyle.h
ItemStyle.cpp

A syntax highlightning style. It keeps the information about color, bold and italic style of the different item types in three public arrays. Rather a struct than a class.

TStyleFile StyleFile.h
StyleFile.cpp

Encapsulates several TItemStyle objects. Manages them in a list and allows to delete or add styles. Loads and saves from/to the style file.

Name utilities NameUtil.h
NameUtil.cpp

Several file name utility functions.

fileutils FileUtil.h
FileUtil.cpp
A few utility functions to read values and strings from an ifstream tracking the current line number.

Their are two different kinds of functions. First, the read functions which try to read a string or another streamable type from the ifstream. They throw an exception if an error occurs. The second kind are the skipws functions which can skip whitespaces and comments returning the number of encountered linefeeds ('\n'). The mechanism is simple but however you've got to be careful with your implementation:

  • Skip all whitespaces using one of the skipws functions. Maybe evaluate the information about the encountered linefeeds which is provided as return value.
  • Try to read the value you expect or read a string and interpret it. Then continue with step one.

TStdList StdList.h Simple but efficient single linked list template.

Main Index top

Class Overview: Gui

Class Module Description
TFAbout FAbout.h
FAbout.cpp

About-Dialog with a few lines of text, two hyperlinks and an animated icon playing pinball with the dialog's frame. Shows how to move an icon without flickering and how to open an URL. Derived from TForm.

The class is quite simple. It's a form containing some TLabel objects to display some text and a TPanel in which a TImage with a TIcon inside is displayed. The panel doesn't have any borders and thus you only see the icon inside. This construction prevents flickering cause you can move the panel without causing the icon to be repainted. There is one TLabel's which opens an URL in your browser when you click it with the mouse.

ThreadFunc ThrConvert.h
ThrConvert.cpp

The class is a derivate of TThread. It does the conversion process in its Execute function using TConv2Html::Convert().

TFMain FMain.h
FMain.cpp

This class manages the user interface. It contains a TPageControl with the three TTabSheet named "Highlighting", "Options" and "Convert".

last updated: 06 January 2005   © 2000-2005 by Lars Haendel