|
|
This is a class for simple access to the command-line arguments.
You have to give two arguments to the constructor, a number and an array of char[]. The first represents the number of strings in the array and the second is the array itself.
KStartParams ( int& argc, char** argv ) |
Constructor.
The given arguments are only copied, not deleted.
~KStartParams () |
Destrcutor.
uint count () |
Retrieves the current number of arguments saved in the object.
Returns: Returns the number of parameters stored in the object.
QString get ( const uint _index ) |
Retrieves a argument that is saved in the object. The index begins with zero und ends with the number of arguments saved in the object minus one.
Parameters:
_index | Index of the argument that will be retrieved. |
Returns: Returns the string that is stored at the position _index. If there is no entry with that index an empty string will be returned.
void del ( const uint _index ) |
Deletes an argument that is saved in the object. The index begins with zero und ends with the number of arguments saved in the object minus one.
Parameters:
_index | Index of the argument that will be deleted. |
void del ( const QStringList::Iterator _it ) |
Deletes an argument that is saved in the object. The iterator represents the param that will be deleted.
Parameters:
_index | Iterator that represents the argument that will be deleted. |
void del ( const QString& _param, bool _check ) |
Deletes the first appearance of an argument that is saved in the object. If it is not present in the list, nothing will be deleted
Parameters:
_param | Beginning of the argument that will be deleted. |
bool check ( const QString& _param, bool _check ) |
Test if an argument is present in the list of arguments.
Parameters:
_param | The string the will be compared with all stored arguments stored in the obejct. |
Returns: Returns true if the paramter is present or false if it is not.
bool check ( const QString& _longparam, const QString& _shortparam, bool _check ) |
Test if an argument is present in the list of arguments, either in the short or the long version of the option.
Parameters:
_longparam | This string represents the long version that will be compared with all stored arguments stored in the object. |
_shortparam | This string represents the short version that will be compared with all stored arguments stored in the object. |
Returns: Returns true if the paramter is present or false if it is not.
bool find ( const QString& _param, bool _check, QStringList::Iterator& _it ) |
Retrieves the index of the first appearance of _param in the argument list.
Parameters:
_param | String of the param that will be searched for. |
_checkWholeString | If this parameter is true the whole command-line argument will be compared with _param. If it is false the beginning of the command-line arguments will be checked. |
_it | In this variable a iterator for later access to the parameter will be stored |
Returns: Returns either true if a parmater of a command-line begins with _param or false no argument meets this.
bool find ( const QString& _longparam, const QString& _shortparam, bool _check, QStringList::Iterator& _it ) |
Retrieves the index of the first appearance of one of the parameters in the argument list.
Parameters:
_longparam | This string represents the long version that will be compared with all stored arguments stored in the object. |
_shortparam | This string represents the short version that will be compared with all stored arguments stored in the object. |
_check | If this parameter is true the whole command-line argument will be compared with _param. If it is false the beginning of the command-line arguments will be checked. |
_it | In this variable a iterator for later access to the parameter will be stored |
Returns: Returns either true if a parmater of a command-line begins with _longparam or _shortparam or false no argument meets this.