Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

OptionReader Class Reference

Reads an optionfile including, or command line parameters being, any of these:
      MAINFILE=somefile.cpp
      EXECUTABLE=somefile
Default: MAINFILE without extension
      LINKER=g++ -lm -lxx -lxx -lxx
Default: g++ -lm
      LINKER_TAIL=libRPClort.a
Default: nothing...
      COMPILER=g++ -O2 -g -I/usr/local/lib/mysql
Default: g++ -O2 -g
      MAKESCRIPT=somefile.sh
Default: MAINFILE with .sh-extension
      DOTOUTPUT=somefile.dot
Default: nothing...
      MAKER_ADD_DEPENDENCY="somefile.xxx"
Default: nothing...
Note: The double quotes (") must be used. More...

#include <optionreader.h>

List of all members.

Public Methods

 OptionReader (int argc, char **argv)
 Reads the file fname and sets all values. More...

 ~OptionReader ()
 Deletes all strings.

int getArguments (char **&argv)
 Gets the arguments that was passed to the OptionReader in the constructor. More...

void print (void)
 Dumps the content of this OptionReader object on stdout.

char* getMainfile (void)
char* getExecutable (void)
char* getLinker (void)
char* getLinkerTail (void)
char* getCompiler (void)
char* getMakescript (void)
char* getDotoutput (void)
int getOptionFileIndex (void)
bool performLink (void)
bool isGraphExcluded (int n, const char *fname)
void displayHelp (void)
 Displays a short help.


Private Methods

void parse (FILE *fin)
 Parses the file lilne by line and extracts the variables. More...

void parseLine (char *buf)
 Parses the file lilne by line and extracts the variables. More...

void graphExclude (int n, const char *fname)
 Adds a file to a graph exclude list. More...

void defaults (const char *fname)
 Sets default values in all empty fields. More...

char* expandMacros (const char *input)
 Expands in input: $DATE$ to yyyy-mm-dd
$TIME$ to hh:mm.
More...



Private Attributes

int makFileFound
char* mainfile
char * executable
char * linker
char * linkerTail
char * compiler
char * makescript
char * dotoutput
char** argV
int argC
bool noLink
int excludeCount [MAXGRAPHLISTS]
char* exclude [MAXGRAPHLISTS][MAXEXCLUDELISTLENGTH]


Detailed Description

Reads an optionfile including, or command line parameters being, any of these:
      MAINFILE=somefile.cpp
      EXECUTABLE=somefile
Default: MAINFILE without extension
      LINKER=g++ -lm -lxx -lxx -lxx
Default: g++ -lm
      LINKER_TAIL=libRPClort.a
Default: nothing...
      COMPILER=g++ -O2 -g -I/usr/local/lib/mysql
Default: g++ -O2 -g
      MAKESCRIPT=somefile.sh
Default: MAINFILE with .sh-extension
      DOTOUTPUT=somefile.dot
Default: nothing...
      MAKER_ADD_DEPENDENCY="somefile.xxx"
Default: nothing...
Note: The double quotes (") must be used.

This option works only in source files.

      NOFILE as parameter means no option file is in parameter line.
      NOLINK as parameter means linking stage will be added to the
      makescript.
      G2EXCLUDE=somefile excludes somefile from the .class graph
      preventing it from cluttering it up.
Author(s):
Philip Bergen
Version:
1.0

Definition at line 58 of file optionreader.h.


Constructor & Destructor Documentation

OptionReader::OptionReader ( int argc,
char ** argv ) [inline]
 

Reads the file fname and sets all values.

Parameters:
argc   The number of arguments in argv
argv   All arguments supplied to the program.

Definition at line 67 of file optionreader.h.

OptionReader::~OptionReader ( ) [inline]
 

Deletes all strings.

Definition at line 122 of file optionreader.h.


Member Function Documentation

void OptionReader::defaults ( const char * fname ) [inline, private]
 

Sets default values in all empty fields.

Parameters:
fname   The makescript file name.

Definition at line 434 of file optionreader.h.

Referenced by OptionReader().

void OptionReader::displayHelp ( void ) [inline]
 

Displays a short help.

Definition at line 260 of file optionreader.h.

Referenced by main().

char * OptionReader::expandMacros ( const char * input ) [inline, private]
 

Expands in input: $DATE$ to yyyy-mm-dd
$TIME$ to hh:mm.

Parameters:
input   Any string.
Returns:
A pointer to a new string. CALLER MUST DELETE!

Definition at line 492 of file optionreader.h.

Referenced by parseLine().

int OptionReader::getArguments ( char **& argv ) [inline]
 

Gets the arguments that was passed to the OptionReader in the constructor.

Parameters:
argv   Will be set to point at the arguments.
Returns:
The number of arguments in argv.

Definition at line 146 of file optionreader.h.

Referenced by Maker::addHeaderFiles().

char * OptionReader::getCompiler ( void ) [inline]
 

Returns:
The compiler complete path and flags.

Definition at line 200 of file optionreader.h.

Referenced by Maker::generateMakescript().

char * OptionReader::getDotoutput ( void ) [inline]
 

Returns:
The dotoutput complete path.

Definition at line 216 of file optionreader.h.

Referenced by Maker::generateDotOutput(), and main().

char * OptionReader::getExecutable ( void ) [inline]
 

Returns:
The executable complete path.

Definition at line 176 of file optionreader.h.

Referenced by Maker::generateMakescript().

char * OptionReader::getLinker ( void ) [inline]
 

Returns:
The link flags.

Definition at line 184 of file optionreader.h.

Referenced by Maker::generateMakescript().

char * OptionReader::getLinkerTail ( void ) [inline]
 

Returns:
The link tail flags.

Definition at line 192 of file optionreader.h.

Referenced by Maker::generateMakescript().

char * OptionReader::getMainfile ( void ) [inline]
 

Returns:
The mainfile complete path.

Definition at line 168 of file optionreader.h.

Referenced by Maker::Maker().

char * OptionReader::getMakescript ( void ) [inline]
 

Returns:
The makescript complete path.

Definition at line 208 of file optionreader.h.

Referenced by Maker::generateMakescript(), and main().

int OptionReader::getOptionFileIndex ( void ) [inline]
 

Returns:
The index in the arguments for the options file.

Definition at line 224 of file optionreader.h.

Referenced by Maker::addHeaderFiles().

void OptionReader::graphExclude ( int n,
const char * fname ) [inline, private]
 

Adds a file to a graph exclude list.

Parameters:
n   The list to add to. Currently only list 1 (second list) has any effect.
fname   The file name (WITHOUT path) of the file to exclude.

Definition at line 407 of file optionreader.h.

Referenced by parseLine().

bool OptionReader::isGraphExcluded ( int n,
const char * fname ) [inline]
 

Parameters:
n   Number of list to look in.
fname   Filename without path.
Returns:
True if the fname exists in the graph exclude list n.

Definition at line 242 of file optionreader.h.

Referenced by Maker::generateDotOutput().

void OptionReader::parse ( FILE * fin ) [inline, private]
 

Parses the file lilne by line and extracts the variables.

Parameters:
fin   A stream to read the optionfile from.

Definition at line 289 of file optionreader.h.

Referenced by OptionReader().

void OptionReader::parseLine ( char * buf ) [inline, private]
 

Parses the file lilne by line and extracts the variables.

Parameters:
buf   Any string from a optionsfile or parameter.

Definition at line 305 of file optionreader.h.

Referenced by OptionReader(), and parse().

bool OptionReader::performLink ( void ) [inline]
 

Returns:
True if the NOLINK option was specified.

Definition at line 232 of file optionreader.h.

Referenced by Maker::generateMakescript().

void OptionReader::print ( void ) [inline]
 

Dumps the content of this OptionReader object on stdout.

Definition at line 155 of file optionreader.h.


Member Data Documentation

int OptionReader::argC [private]
 

Definition at line 538 of file optionreader.h.

char** OptionReader::argV [private]
 

Definition at line 537 of file optionreader.h.

char * OptionReader::compiler [private]
 

Definition at line 535 of file optionreader.h.

char * OptionReader::dotoutput [private]
 

Definition at line 535 of file optionreader.h.

char* OptionReader::exclude[MAXGRAPHLISTS][MAXEXCLUDELISTLENGTH] [private]
 

Definition at line 542 of file optionreader.h.

int OptionReader::excludeCount[MAXGRAPHLISTS] [private]
 

Definition at line 541 of file optionreader.h.

char * OptionReader::executable [private]
 

Definition at line 535 of file optionreader.h.

char * OptionReader::linker [private]
 

Definition at line 535 of file optionreader.h.

char * OptionReader::linkerTail [private]
 

Definition at line 535 of file optionreader.h.

char* OptionReader::mainfile [private]
 

Definition at line 535 of file optionreader.h.

int OptionReader::makFileFound [private]
 

Definition at line 534 of file optionreader.h.

char * OptionReader::makescript [private]
 

Definition at line 535 of file optionreader.h.

bool OptionReader::noLink [private]
 

Definition at line 539 of file optionreader.h.


The documentation for this class was generated from the following file:
Generated at Mon May 14 00:45:45 2001 for Maker by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001