CBS_CmdLine Class Reference

Implements Command Line Manipulations. More...

List of all members.

Public Member Functions

int ArgVFindIndex (CONST TCHAR *pArg)
 CBS_CmdLine ()
 CBS_CmdLine (const TCHAR **&pArgV, int *pArgC)
const TCHAR ** GetArgV (int *pArgC=NULL)
const TCHAR * GetAt (int iIdx)
BOOL IsArg (CONST TCHAR *pArg)
 ~CBS_CmdLine ()


Detailed Description

Implements Command Line Manipulations.

Author:
Dror Otmi
Date:
12.10.2003
Version:
V 1.0 Initial version
The main reason for developing this class is that parsing the command line arguments when they are saved in an array is much more convenience then parsing them when they are saved in one line.
Since command line arguments might be needed in DLLs that are loaded implicitly, the global variable argv might not be valid at this time (implicitly loaded DLLs are loaded before the main function entered).
This class solves this problem, the argument array is available at any time, even before entering the main function.


Constructor & Destructor Documentation

CBS_CmdLine::CBS_CmdLine const TCHAR **&  pArgV,
int *  pArgC
 

Second constructor, initiate the object and the arguments.

Parameters:
pArgV a string array that will point to the first application argument
pArgC a pointer to an integer that will be initiate with the number of the parameter saved in pArgV

CBS_CmdLine::CBS_CmdLine  ) 
 

Default constructor initiate the object and the arguments.

CBS_CmdLine::~CBS_CmdLine  ) 
 

The destructor.


Member Function Documentation

int CBS_CmdLine::ArgVFindIndex CONST TCHAR *  pArg  ) 
 

Searches the argument list after the argument pArg.

Parameters:
pArg The argument we search in the list.
Returns:
The index in which the argument pArg is saved or -1 if the argument is not found.

const TCHAR ** CBS_CmdLine::GetArgV int *  pArgC = NULL  ) 
 

Return the string array with the application start parameter.

Parameters:
pArgC a pointer to an integer in which the number of element in the array will be saved.
Returns:
A pointer to the argument array. If the function return NULL, the application should have call GetLastError() in order to evaluate the error.

const TCHAR * CBS_CmdLine::GetAt int  iIdx  ) 
 

Retrieves an argument in the given index

Parameters:
iIdx The index of the argument the application wants to retrieve.
Returns:
The argument at the index 'iIdx' of the arguments array or NULL if the index is invalid.

BOOL CBS_CmdLine::IsArg CONST TCHAR *  pArg  ) 
 

! Check if the argument pArg appears in the argument list of the application.

Parameters:
pArg The argument the function should search in the application argument list.
Returns:
TRUE if the argument pArg exists in the application argument list.
Bitspot AG


Bitspot AG
Rietlistrasse 1
CH-6345 Neuheim

Bitspot AG Logo

Phone:

+41 41 755 11 22

Fax:

+41 41 755 11 31

e-mail:

mail@bitspot.com

Web:

www.bitspot.com