class KStartParams

A class for simple command-line argument access. More...

Definition#include <kstartparams.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods


Detailed Description

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 ()
[const]

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 )
[const]

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:
_indexIndex 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:
_indexIndex 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:
_indexIterator 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:
_paramBeginning 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:
_paramThe 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:
_longparamThis string represents the long version that will be compared with all stored arguments stored in the object.
_shortparamThis 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:
_paramString of the param that will be searched for.
_checkWholeStringIf 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.
_itIn 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:
_longparamThis string represents the long version that will be compared with all stored arguments stored in the object.
_shortparamThis string represents the short version that will be compared with all stored arguments stored in the object.
_checkIf 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.
_itIn 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.