Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

iopcSpMain.cpp File Reference

File containing IOPC SP's main() function and functions revolving around command line parsing and options setting. More...

#include "StdString.h"
#include <string.h>
#include "types.h"
#include "mop.h"
#include "iopcStrings.h"
#include "iopcCommon.h"
#include "occCommon.h"
#include "iopcMappingType.h"
#include "iopcDefines.h"
#include "getProcessPath.h"

Include dependency graph for iopcSpMain.cpp:

Include dependency graph

Functions

void showProgramInfo ()
void showHelpHint ()
void showHelp ()
int addSourceFile (char *arg, list< CStdString > &sourceFiles, bool useMissingParameterMsg, bool permitMoreSourceFiles)
void parseCommandLine (int from, int argc, char **argv, list< CStdString > &sourceFiles)
void setOptions (int argc, char **argv, list< CStdString > &sourceFiles)
void guessProjectName (const char *sourceFile)
void cleanupFunction (int)
int main (int argc, char **argv)

Variables

bool saveMetadata
CStdString metadataWriterProjectName
CStdString metadataWriterOutputLocation
IopcMappingType defaultMappingType
CStdString sourceFile

Detailed Description

File containing IOPC SP's main() function and functions revolving around command line parsing and options setting.

Author:
Josef Troch (josef.troch@email.cz)
Date:
2003 - 2004

Function Documentation

void showProgramInfo  )  [static]
 

Shows one-line info about IOPC SP - SP_PROGRAM_INFO.

void showHelpHint  )  [static]
 

Shows hint how to get help on IOPC SP use - SP_HELP_HINT.

void showHelp  )  [static]
 

Shows help on IOPC SP use - SP_HELP.

int addSourceFile char *  arg,
list< CStdString > &  sourceFiles,
bool  useMissingParameterMsg,
bool  permitMoreSourceFiles
 

Adds source file to the list of source files to be processed.

Tests whether arg specifies file. If so and sourceFiles is empty or permitMoreSource files is set, adds the file name to sourceFiles. In the other case prints an error message (useMissingParameterMsg affects which error message is printed).

Note:
permitMoreSourceFiles is set if "linking" MetadataWriter's temporary files together.
Returns:
0 if OK, 1 if some error occured.

void parseCommandLine int  from,
int  argc,
char **  argv,
list< CStdString > &  sourceFiles
 

Parses IOPC SP's command line, sets IOPC SP / OpenC++ options.

Parameters:
from At which argv member the parsing should begin.
argc Number of members in argv array.
argv Array that contains IOPC SP's command line.
sourceFiles One of the function's results - list of source files to be processed.
Returns:
0 if OK, 1 if some error occured.

void setOptions int  argc,
char **  argv,
list< CStdString > &  sourceFiles
 

Sets default values of IOPC SP / OpenC++ options, then calls parseCommandLine().

Parameters:
argc Number of members in argv array.
argv Array that contains IOPC SP's command line.
sourceFiles One of the function's results - list of source files to be processed.
Returns:
0 if OK, 1 if some error occured.

void guessProjectName const char *  sourceFile  ) 
 

If user doesn't supply project name, this function guess one and saves it into metadataWriterProjectName.

  • If sourceFile contains path, last directory in path is used.
  • Otherwise current directory name is used.

void cleanupFunction int   ) 
 

Function that is called before IOPC SP terminates.

See also:
setCleanupFunction()

int main int  argc,
char **  argv
 

Main function of IOPC SP.

  • Parses its command line (argc, argv) and sets IOPC SP / OpenC++ options using setOptions().
  • Initializes metadataWriter.
  • If "linking" MetadataWriter's temporary files together calls MetadataWriter::saveMetadata().
  • In the other case sets OpenC++'s default metaclass to IopcTranslator (see OpenC++'s reference) and then calls ReadFile() to parse and translate given C++ source file.

Returns:
0 if OK, non-zero in case of error.
See also:
saveMetadata


Variable Documentation

bool saveMetadata
 

If this flag is set, no source files are parsed / translated but the MetadataWriter is called to "link" information from its temporary files to create the final form of metadata.

Set by setOptions() / parseCommandLine().

CStdString metadataWriterProjectName
 

Name of the project to which the parsed source file belongs.

Used when saving metadata (MetadataWriter::saveMetadata()) and later in IOPC DBSC when creating project's database schema.

See also:
guessProjectName()

CStdString metadataWriterOutputLocation
 

Location (file) into which the final representation of project's metadata should be saved.

Set by setOptions() / parseCommandLine().

IopcMappingType defaultMappingType
 

Default mapping type - if saving the final representation of project's metadata, mapping type of all classes that have no parents is set to defaultMappingType.

Set by setOptions() / parseCommandLine().

CStdString sourceFile
 

Name of source file that is currently processed by IOPC SP. Used by IopcTranslatingSupport when calling MetadataWriter::addClass().


Generated on Wed Aug 11 22:34:11 2004 for IOPC by Doxygen 1.3.6