direcs  2012-09-30
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Inifile Class Reference

Handles the access to the global ini-file. More...

#include <inifile.h>

List of all members.

Public Member Functions

bool checkFiles ()
QString checkPath ()
QString getInifileName ()
 Inifile ()
float readFloat (QString group, QString name)
int readSetting (QString group, QString name)
QString readString (QString group, QString name)
void setFilename (QString filename)
void sync (void)
void writeSetting (QString group, QString name, int value)
void writeSetting (QString group, QString name, QString value)
 ~Inifile ()

Private Attributes

QString mainIniFilename
QString programPath
QSettings * settings

Detailed Description

Handles the access to the global ini-file.

Author:
Markus Knapp This class handles the access to the global ini-file where all settings are stored.

Definition at line 37 of file inifile.h.


Constructor & Destructor Documentation

Inifile::Inifile ( )

Definition at line 23 of file inifile.cpp.

Inifile::~Inifile ( )

Definition at line 50 of file inifile.cpp.


Member Function Documentation

bool Inifile::checkFiles ( )

Checks if the needed ini-file exists in the current path.

Returns:
True, when the file was found.

Definition at line 68 of file inifile.cpp.

Here is the caller graph for this function:

QString Inifile::checkPath ( )

Checks the current path from which the program started.

Returns:
The path as a string.

Definition at line 55 of file inifile.cpp.

Here is the caller graph for this function:

QString Inifile::getInifileName ( )
Returns:
The current ini-file.

Definition at line 102 of file inifile.cpp.

Here is the caller graph for this function:

float Inifile::readFloat ( QString  group,
QString  name 
)

Reads a float value from an ini-file. The settings are read in the typical ini-file-format.
Example ini-file:

[Config]
laserscannerResolutionFront=0.1

Parameters:
groupis the group area in the file (e.g. Config).
nameis the object to read (e.g. laserscannerResolutionFront).
Returns:
The setting as a float

Definition at line 163 of file inifile.cpp.

Here is the caller graph for this function:

int Inifile::readSetting ( QString  group,
QString  name 
)

Reads an integer setting from an ini-file. The settings are read in the typical ini-file-format.
Example ini-file:

[Config]
motor1Speed=23

Parameters:
groupis the group area in the file (e.g. Config).
nameis the object to read (e.g. motor1speed).
Returns:
The setting as an integer value.

Definition at line 130 of file inifile.cpp.

Here is the caller graph for this function:

QString Inifile::readString ( QString  group,
QString  name 
)

Reads a string from an ini-file. The settings are read in the typical ini-file-format.
Example ini-file:

[Config]
serialPortMicrocontroller=/dev/ttyUSB1

Parameters:
groupis the group area in the file (e.g. Config).
nameis the object to read (e.g. serialPortMicrocontroller).
Returns:
The setting as a string.

Definition at line 141 of file inifile.cpp.

Here is the caller graph for this function:

void Inifile::setFilename ( QString  filename)

Seta the name of the ini-file where all the settings are stored.

Parameters:
filename

Definition at line 486 of file inifile.cpp.

Here is the caller graph for this function:

void Inifile::sync ( void  )

Forces the ini.file to be written immediately. For example at program end.

Definition at line 480 of file inifile.cpp.

Here is the caller graph for this function:

void Inifile::writeSetting ( QString  group,
QString  name,
int  value 
)

Stores a settings in an ini-file. The settings are stored in the typical ini-file-format.
Example ini-file:

[Config]
motor1Speed=23

Parameters:
groupis the group area in the file (e.g. Config).
nameis the name of the parameter (e.g. motor1speed).
valueis the (int) value of the parameter (e.g. 23).

Definition at line 108 of file inifile.cpp.

Here is the caller graph for this function:

void Inifile::writeSetting ( QString  group,
QString  name,
QString  value 
)

Stores a settings in an ini-file. The settings are stored in the typical ini-file-format.
Example ini-file:

[Config]
setting23=hello

Parameters:
groupis the group area in the file (e.g. Config).
nameis the name of the parameter (e.g. setting23).
valueis the (string) value of the parameter (e.g. "hello").

Definition at line 119 of file inifile.cpp.


Member Data Documentation

QString Inifile::mainIniFilename
private

Definition at line 141 of file inifile.h.

QString Inifile::programPath
private

Definition at line 140 of file inifile.h.

QSettings* Inifile::settings
private

Definition at line 139 of file inifile.h.


The documentation for this class was generated from the following files: