Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

CmdLineOptions Class Reference

Options passed by the command line. More...

#include <cmdlnopt.hpp>

List of all members.

Public Types

enum  Actions {
  aNone = 0, aOpen, aVerify, aCreate,
  aAppend
}
 Action to do at the startup. More...

enum  CkSumsFileTypes { cftNone = 0, cftSFV, cftMD5 }
 Type of checksums' files that the application know. More...


Static Public Member Functions

void cleanup ()
 Cleans up the structures that take memory.

CkSumsFileTypes getchecksumsFileType ()
 Get the type of the checksums' file to create.

bool init (const wxCmdLineParser &parser)
 Initializes the options.


Static Public Attributes

Actions action
 Action to do at the startup of the application.

wxString checksumsFileName
 Name of the checksums' file to create or where the files will be added.

CkSumsFileTypes createType
 Type of the checksums' file.

wxArrayString files
 List of the files given on the command line.


Private Member Functions

 CmdLineOptions ()
 Default constructor.


Static Private Member Functions

bool checkAppendOption (const wxCmdLineParser &parser)
 Checks the compatibility of the append option with other options or switchs.

bool checkCreateOption (const wxCmdLineParser &parser)
 Checks the compatibility of the create option with other options or switchs.

bool checkCreateTypeOption (const wxCmdLineParser &parser)
 Checks the compatibility of the create type option with other options or switchs.

bool checkOpenChecksumsFile (const wxCmdLineParser &parser)
 If no action has been set, checks if a checksums' file must be opened.

bool checkVerifySwitch (const wxCmdLineParser &parser)
 Checks the compatibility of the verify switch with other options or switchs.

void expandFilesList (const wxCmdLineParser &parser)
 Loads the list(s) of files, delete the file that contains the list if the deleteTempLists switch is activated.

void makeFilesListAbsolute (const wxString &cwd)
 Make all the names of the files in the array of files absolute.


Static Private Attributes

bool deleteTempLists
 Delete temporary lists of files.


Detailed Description

Options passed by the command line.

Definition at line 48 of file cmdlnopt.hpp.


Member Enumeration Documentation

enum CmdLineOptions::Actions
 

Action to do at the startup.

Definition at line 64 of file cmdlnopt.hpp.

enum CmdLineOptions::CkSumsFileTypes
 

Type of checksums' files that the application know.

Definition at line 74 of file cmdlnopt.hpp.

Referenced by getchecksumsFileType().


Constructor & Destructor Documentation

CmdLineOptions::CmdLineOptions  )  [private]
 

Default constructor.

Don't allow to create an instance out this of this class.

Definition at line 78 of file cmdlnopt.cpp.


Member Function Documentation

bool CmdLineOptions::checkAppendOption const wxCmdLineParser &  parser  )  [static, private]
 

Checks the compatibility of the append option with other options or switchs.

Parameters:
parser Command line parser.
Returns:
true if the append option is compatible with other options or switchs, false otherwise.

Definition at line 337 of file cmdlnopt.cpp.

References action, checkAppendOption(), checksumsFileName, makeFilesListAbsolute(), and msgOut.

Referenced by checkAppendOption(), and init().

bool CmdLineOptions::checkCreateOption const wxCmdLineParser &  parser  )  [static, private]
 

Checks the compatibility of the create option with other options or switchs.

Parameters:
parser Command line parser.
Returns:
true if the create option is compatible with other options or switchs, false otherwise.

Definition at line 403 of file cmdlnopt.cpp.

References action, checkCreateOption(), checksumsFileName, makeFilesListAbsolute(), and msgOut.

Referenced by checkCreateOption(), and init().

bool CmdLineOptions::checkCreateTypeOption const wxCmdLineParser &  parser  )  [static, private]
 

Checks the compatibility of the create type option with other options or switchs.

Parameters:
parser Command line parser.
Returns:
true if the create type option is compatible with other options or switchs, false otherwise.

Definition at line 470 of file cmdlnopt.cpp.

References checkCreateTypeOption(), createType, and msgOut.

Referenced by checkCreateTypeOption(), and init().

bool CmdLineOptions::checkOpenChecksumsFile const wxCmdLineParser &  parser  )  [static, private]
 

If no action has been set, checks if a checksums' file must be opened.

param parser Command line parser.

Returns:
true if no error or incompatibility has been detected, false otherwise.

Definition at line 502 of file cmdlnopt.cpp.

References action, checkOpenChecksumsFile(), files, and msgOut.

Referenced by checkOpenChecksumsFile(), and init().

bool CmdLineOptions::checkVerifySwitch const wxCmdLineParser &  parser  )  [static, private]
 

Checks the compatibility of the verify switch with other options or switchs.

param parser Command line parser.

Returns:
true if the verify switch is compatible with other options or switchs, false otherwise.

Definition at line 277 of file cmdlnopt.cpp.

References action, checkVerifySwitch(), files, and msgOut.

Referenced by checkVerifySwitch(), and init().

void CmdLineOptions::cleanup  )  [static]
 

Cleans up the structures that take memory.

Call this function when you do not need the command line options.

Definition at line 139 of file cmdlnopt.cpp.

References checksumsFileName, and files.

Referenced by CkSumsApp::OnInit().

void CmdLineOptions::expandFilesList const wxCmdLineParser &  parser  )  [static, private]
 

Loads the list(s) of files, delete the file that contains the list if the deleteTempLists switch is activated.

Parameters:
parser Command line parser.

Definition at line 182 of file cmdlnopt.cpp.

References deleteTempLists, expandFilesList(), and files.

Referenced by expandFilesList(), and init().

CmdLineOptions::CkSumsFileTypes CmdLineOptions::getchecksumsFileType  )  [static]
 

Get the type of the checksums' file to create.

If the ct parameter has been specified, return the given type, otherwise try to get the type with the extension of the checksums' file.

Returns:
The type of the checksums' file to create or cftNone if the type of the checksums' file cannot be determined.

Definition at line 156 of file cmdlnopt.cpp.

References checksumsFileName, CkSumsFileTypes, and createType.

Referenced by frmSums::initializeFromCmdLine().

bool CmdLineOptions::init const wxCmdLineParser &  parser  )  [static]
 

Initializes the options.

Should be called at the application startup.

param parser Command line parser.

Returns:
true if the passed commands are corrects, false otherwise.

Definition at line 93 of file cmdlnopt.cpp.

References action, checkAppendOption(), checkCreateOption(), checkCreateTypeOption(), checkOpenChecksumsFile(), checksumsFileName, checkVerifySwitch(), createType, deleteTempLists, expandFilesList(), files, getAppName(), init(), and msgOut.

Referenced by init().

void CmdLineOptions::makeFilesListAbsolute const wxString &  cwd  )  [static, private]
 

Make all the names of the files in the array of files absolute.

You should call expandFilesList before to be sure that the list of names of files doesn't contain pointer to list of files.

Parameters:
cwd Reference path to make the paths absolute. Must be an absolute path (if not, nothing is done) and don't contains a name of file.

Definition at line 248 of file cmdlnopt.cpp.

References files, and makeFilesListAbsolute().

Referenced by checkAppendOption(), checkCreateOption(), and makeFilesListAbsolute().


Member Data Documentation

CmdLineOptions::Actions CmdLineOptions::action [static]
 

Action to do at the startup of the application.

Definition at line 60 of file cmdlnopt.cpp.

Referenced by checkAppendOption(), checkCreateOption(), checkOpenChecksumsFile(), checkVerifySwitch(), and init().

wxString CmdLineOptions::checksumsFileName [static]
 

Name of the checksums' file to create or where the files will be added.

Definition at line 63 of file cmdlnopt.cpp.

Referenced by checkAppendOption(), checkCreateOption(), cleanup(), getchecksumsFileType(), and init().

CmdLineOptions::CkSumsFileTypes CmdLineOptions::createType [static]
 

Type of the checksums' file.

Definition at line 61 of file cmdlnopt.cpp.

Referenced by checkCreateTypeOption(), getchecksumsFileType(), and init().

bool CmdLineOptions::deleteTempLists [static, private]
 

Delete temporary lists of files.

Definition at line 64 of file cmdlnopt.cpp.

Referenced by expandFilesList(), and init().

wxArrayString CmdLineOptions::files [static]
 

List of the files given on the command line.

Definition at line 62 of file cmdlnopt.cpp.

Referenced by checkOpenChecksumsFile(), checkVerifySwitch(), cleanup(), expandFilesList(), init(), and makeFilesListAbsolute().


The documentation for this class was generated from the following files:
Generated on Sun May 30 13:38:03 2004 for wxChecksums by doxygen 1.3.7