Make your own free website on

CPP2HTM Builder Specification File

#ifndef __SPEC_H
  #define __SPEC_H

     PURPOSE: Contains the following two class specifications for 
             CPP2HTM Builder: Config and HtmBuilder. The 
             Config class contains data and function members
             used during execution of the configuration tool.
             The HtmBuilder class contains data and function 
             members neccessary for the successful coversion 
             of C or C++ source code into HTML source code 
             while also executing the configuration tool.
             Also contains global constant identifiers which 
             serve multiple purposes throughout program


#include <stdlib.h>
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <string.h>

// constant initializations
const int FILENAMELEN = 256;
const int TITLELEN = 80;
const int FONTLENGTH = 20;
const int HEXLENGTH = 11;          // hex color scheme length
const int DEFFONTSIZE = 10;
const int DEFTABSIZE = 6;
const int MENUTITLESPC = 3;          // for formatting menu title
const int MENUOPSPC = 5;          // for formatting menu options
const int LINENUMSPC = 5;          // for formatting web page spacing
const int IGNORELEN = 80;          // input stream flush
const int WHITE_HEX_INDEX = 1;
const int BLACK_HEX_INDEX = 22;

// constant hexadecimal color schemes
const char hexWhite[HEXLENGTH] = "\"#FFFFFF\"";
const char hexPaleRed[HEXLENGTH] = "\"#FF6A6A\"";
const char hexRed[HEXLENGTH] = "\"#FF0000\"";
const char hexDarkRed[HEXLENGTH] = "\"#8B0000\"";      
const char hexLightOrange[HEXLENGTH] = "\"#FFA500\"";
const char hexOrange[HEXLENGTH] = "\"#FF8C00\"";
const char hexDarkOrange[HEXLENGTH] = "\"#FF2400\"";
const char hexLightYellow[HEXLENGTH] = "\"#FFFFE0\"";
const char hexYellow[HEXLENGTH] = "\"#FFFF00\"";
const char hexGold[HEXLENGTH] = "\"#FFD700\"";
const char hexLightGreen[HEXLENGTH] = "\"#90EE90\"";
const char hexGreen[HEXLENGTH] = "\"#00FF00\"";
const char hexDarkGreen[HEXLENGTH] = "\"#008B00\"";
const char hexLightBlue[HEXLENGTH] = "\"#87CEFF\"";
const char hexBlue[HEXLENGTH] = "\"#0000FF\"";
const char hexDarkBlue[HEXLENGTH] = "\"#00008B\"";
const char hexLightMagenta[HEXLENGTH]  = "\"#EE82EE\"";
const char hexMagenta[HEXLENGTH] = "\"#FF00FF\"";
const char hexDarkMagenta[HEXLENGTH] = "\"#8B008B\"";
const char hexLightGray[HEXLENGTH] = "\"#E8E8E8\"";
const char hexDarkGray[HEXLENGTH] = "\"#C0C0C0\"";
const char hexBlack[HEXLENGTH] = "\"#000000\"";

// represent HTML tag brackets
const char _lt = '<';
const char _gt = '>';
const char _sl = '/';

// enumerated types 
enum tProgStatus  { INCOMPLETE, COMPLETE };     // program run status
enum tFileError { FILE_ERROR, FILE_OK };
enum tUserInput { INVALID, VALID };               // input validation
enum tConfigFlag { OFF, ON };     
enum tAlignment { LEFT = 1, CENTER, RIGHT };

// enumerated constants
enum { USERDONE = 2 };
      T_VERDANA };

// configuration class specification
class Config
               tConfigFlag configFlag;          // configuration option
               tConfigFlag pageTitleFlag;     // web page title option
               tConfigFlag lineNumberFlag;     // line number option
               tAlignment titleAlignment;     // title alignment

               // data members to be configured
               char* browserTitle;
               char* bgColor;
               char* textColor;
               char* pageTitle;
               char* fontType;
               int fontSize;
               int tabSize;
               int lineNumber;

               Config();     // constructor
               ~Config();     // destructor
               tConfigFlag getConfigFlag();
               tConfigFlag getPageTitleFlag();
               tAlignment getTitleAlignment();
               tConfigFlag getlineNumberFlag();

               // access methods for assignment
               void setConfigFlag(tConfigFlag inFlag);
               void setPageTitleFlag(tConfigFlag inFlag);
               void setTitleAlignment(tAlignment inAlign);
               void setlineNumberFlag(tConfigFlag inFlag);
               void setBrowserTitle(char* title);
               void setBgColor(char* color);
               void setTextColor(char* color);
               void setPageTitle(char* title);
               void setFontType(char* type);
               void setFontSize(int size);
               void setTabSize(int size);
               void clearLineCount();

               // access methods for retrieval
               char* getBrowserTitle();
               char* getBgColor();
               char* getTextColor();
               char* getPageTitle();
               char* getFontType();
               int getFontSize();
               int getTabSize();
               int getlineNumber();
               void incrementlineNumber();
               void showAlignment();


// main builder class specification 
class HtmBuilder : public Config     // child of Config class
     // *** inherits all public members of Config class *** //

               char cppFile[FILENAMELEN], htmlFile[FILENAMELEN];
               tProgStatus status;
               ifstream inCppFile;
               ofstream outHtmFile;

               HtmBuilder();     // constructor

               tProgStatus getProgramStatus();
               void setProgramStatus(tProgStatus inStatus);

               // main builder methods
               void run();
               void getConfigRequest();
               void runConfigTool();
               int getConfigMenuOption();
               tFileError getDataFiles();
               void interpretSource();
               bool checkCharMeaning(char token);
               void sendHtmHeader();
               void sendPageTitle();
               void sendHtmFooter();
               void clearData();

               // configuration methods
               void configBrowserTitle();
               void configBgColor();
               void configTextColor();
               void configPageTitle();
               void configFontType();
               void configTabSize();
               void configLineNumbers();
               bool executeSelection(int selection, bool status);
               char* getDesiredColor();
               char* getDesiredFontType();
               int getDesiredFontSize();
               tAlignment getDesiredAlignment();
               void restoreDefSettings();

               // display to console methods
               void showPageTitleSettings();
               void showLineNumSettings();
               void showCurSettings();
               void showDefSettings();

//****************** non-member functions ********************//

void divider();
void displayHeader(char str[]);
void displayMessage(char str[]);
void displayPrompt(char str[]);
void displayRunMenu();
void displayConfigMenu();
void displayColorOptions();
void displayAlignOptions();
void displayFontTypes();
void pause(char str[]);

int getRunMenuSelection();
char* getHexColor(int selection);
char* getFontTypeChoice(int selection); 
tAlignment getAlignmentChoice(int selection);


Rendered using: CPP2HTM Builder --