Source Documentation

C++ Builder 5.0 Project

TFAbout 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.
TCpp2Html Class which encapsulates the conversions routines. You provide the keywords as a TKeyword object and the syntax-highlighting style as a TItemStyle object in the constructor. Additionally you’ve got to pass parameters like the tab stop position or the language as a TBasicSettings object.
ThreadFunc TThread derivate: does the conversion process in its Execute-function using TCpp2Html::convert()
fileutils A few utility functions to read values and strings from an ifstream tracking the current line number. You can realize format sensitive reading without the “always read a whoole line” concept.
TItemStyles The two classes TItemStyle which represents a syntax-highlightning style and TItemStyles which encapsulates several TItemStyle objects and holds them in a list.
TKeywords Simple class which loads the keywords from a text file and stores them in a keyword array (char**).
TFMain Application main form: Manages the user interface and creates the overview file.

TFAbout

top header source

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 are two TLabel‘s which open an URL in your browser when they are clicked with the mouse.

TCpp2Html

top header source

You provide the keywords as a TKeyword object and the syntax-highlighting style as a TItemStyle object in the constructor. Additionally you’ve got to pass parameters like the tab stop position or the language as a TBasicSettings object. Then you just call the function

Convert(ifstream& inFile, ofstream& outFile, bool& stop, int& progress, const char* filename)

The two io-streams are the opended in- and output files. The stop-flag is checked periodically and the conversion process is breaked when it is set. progress is a counter which count’s the processed bytes of the input file. Note: The programm executes the conversion process in an additionally thread. Therefore it doesn’t calls convert() directly but uses the class ThreadFunc which calls convert() in its Execute() function.

ThreadFunc

top header source

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

fileutils

top header source

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.

TItemStyle / TItemStyles

top header source

The class TItemStyle is rather a struct than a class. It keeps the information about color, bold and italic style of the different item types in three public arrays. The known item types are: comment, keyword, identifier, symbol, string, number, character, preprocessor, illegal_char, bkgnd. Color, bold and italic styles should be defined for each item except for identifier and bkgnd for which only the color should be set. These restrictions are fullfilled in the main program in which the functionality to edit a style is implemented.

The class TItemStyles provides functionality to load, save, insert, delete and retrieve an TItemStyle object from the style list.

TKeywords

top header source

The name of the keyword file is passed in the constructor. This file has got to contain the keywords in ASCII-format one word each line. Maximum length of a keyword is defined in MAX_KEYWORD_LEN in the header file and is actually set to 32. Hard coded default keywords are used if the specified keyword file cannot be opened. Use the function bool IsKeyword(const char* word) to determine if a string is a keyword or not.

TFMain

top header source

This class manages the user interface. It contains a TPageControl with the three TTabSheet objects named “Options”, “Convert” and “About”. The class loads the keyword-objects (TKeyword) and the syntax-highlighting styles (TItemStyles). It provides the functionality to select, display, edit, save and delete the current style and it manages the file selection and conversion process.

Quality Web Design

When you begin creating a webpage, you’ll want to think about your web design. This is because the moment someone logs onto a site they begin judging that site based on the design. This is similar to the way we judge each other. Someone walks into a room and we automatically start making assumptions about that person based on his looks. We look at his hair, his clothes, his shoes, and his posture. We also pay attention to the way he talks, the words he uses, and we are even guessing things about him based on his body language. We then make a judgment (based on all these things and more) about him. We decide whether he is intelligent, whether he is trustworthy, whether he is interesting, whether he is a “good” or “bad” person. These judgments may or may not be right or be fair, but they happen nonetheless.

When you create a webpage, you want to keep this in mind. You may have great writing and great content on your page, but if it isn’t user friendly and attractive to the eye, you will find that you won’t get as much traffic to your site. Some of the things to keep in mind when designing a web page are as follows:

First, keep it simple. If your viewers see a lot of clutter or information from the beginning, they will feel overwhelmed or vaguely disturbed, and they may immediately start clicking on another webpage. Next, think about color. The eyes don’t like to be overwhelmed by bright or excessive color. Keep your colors soft and neutral and use bright colors very sparingly. In addition to using color, you can use a lot of white space, because it is more pleasing to the eye. You can also use icons, but they should have a real purpose and you should use them sparingly. Also, make sure to keep everything tasteful and welcoming.