SaX::SaXConfig Class Reference

SaX2 - Configuration class. More...

#include <config.h>

Inheritance diagram for SaX::SaXConfig:

Inheritance graph
[legend]
List of all members.

Public Member Functions

void setParseErrorValue (char *)
void setParseError (char *)
void addImport (SaXImport *)
void setMode (int)
QString getParseErrorValue (void)
QString getParseError (void)
bool createConfiguration (void)
void commitConfiguration (void)
int testConfiguration (void)
bool isChecksumOK (void)
 SaXConfig (int=SAX_MERGE)

Detailed Description

SaX2 - Configuration class.

A SaXConfig object is mainly used as a container for SaXImport objects. Different import objects describing a complete configuration or only parts of it can be added using the addImport() method. A complete new configuration requires the following import ID's to be added:

If not all of these are provided it is necessary to set the config mode to SAX_MERGE using the setMode() method otherwise the configuration will be broken. If merging is used you may recognize problems while trying to remove complete devices. For example you want to remove one mouse out of two but your changes do not have any effect. This is because while merging the currently existing information is still there. As result of that you need to write a complete new configuration using the SAX_NEW mode to prevent existing sections from beeing imported again.

Calling createConfiguration() will create a preliminary configuration file named /var/lib/sax/xorg.conf. libsax will automatically check the syntax of the new created file and the programmer is able to get possible syntax errors using the getParseError* methods

 #include <sax/sax.h>

 int importID[7] = {
     SAX_CARD,
     SAX_DESKTOP,
     SAX_POINTERS,
     SAX_KEYBOARD,
     SAX_LAYOUT,
     SAX_PATH,
     SAX_EXTENSIONS
 };
 SaXConfig* config = new SaXConfig;
 for (int id=0; id < 7; id++) {
     SaXImport* import = new SaXImport ( importID[id] );
     import->doImport();
     config->addImport (import);
 }
 config->setMode (SAX_NEW);
 if ( ! config->createConfiguration() ) {
     printf ("%s\n",config->getParseErrorValue().ascii());
 }

Definition at line 141 of file config.h.


Constructor & Destructor Documentation

SaX::SaXConfig::SaXConfig int  mode = SAX_MERGE  ) 
 

An object of this type is used to create and verify the basic X11 configuration file /etc/X11/xorg.conf

Definition at line 32 of file config.cpp.

References SaX::SaXException::setLock(), and SaX::SaXException::unsetLock().

Here is the call graph for this function:


Member Function Documentation

void SaX::SaXConfig::addImport SaXImport in  )  [virtual]
 

add previously imported data using a SaXImport reference multiple addImport() calls are possible to add all needed sections

Implements SaX::SaXConfigIF.

Definition at line 67 of file config.cpp.

References SaX::SaXException::errorString(), SaX::SaXException::excImportAlreadyAdded(), SaX::SaXException::excUnknownImport(), and SaX::SaXImport::getSectionID().

Here is the call graph for this function:

void SaX::SaXConfig::commitConfiguration void   )  [virtual]
 

install the configuration file as /etc/X11/xorg.conf installing the file should only be done when createConfiguration() returned succesfully

Implements SaX::SaXConfigIF.

Definition at line 245 of file config.cpp.

bool SaX::SaXConfig::createConfiguration void   )  [virtual]
 

create the preliminary configuration file and verify the syntax of the file. If everything is ok the method will return true otherwise false

Implements SaX::SaXConfigIF.

Definition at line 179 of file config.cpp.

References SaX::SaXExport::doExport(), SaX::SaXException::setLock(), and SaX::SaXException::unsetLock().

Referenced by testConfiguration().

Here is the call graph for this function:

QString SaX::SaXConfig::getParseError void   )  [virtual]
 

obtain parse error if there is any. If no error occured an empty string is returned

Implements SaX::SaXConfigIF.

Definition at line 490 of file config.cpp.

QString SaX::SaXConfig::getParseErrorValue void   )  [virtual]
 

obtain parse error value if there is any. If no error occured an empty string is returned

Implements SaX::SaXConfigIF.

Definition at line 476 of file config.cpp.

bool SaX::SaXConfig::isChecksumOK void   )  [virtual]
 

check if the installed configuration has a valid checksum which means there are no manual made changes. if there is no installed config file or the checksum doesn't exist the function will return true. Otherwise the result of the checksum test determines the return value

Implements SaX::SaXConfigIF.

Definition at line 403 of file config.cpp.

void SaX::SaXConfig::setMode int  mode  )  [virtual]
 

set the ISAX mode for creating the configuration file. Possible modes are: SAX_NEW or SAX_MERGE (default). If SAX_NEW is specified a complete set of imports must be added to create a valid configuration file.

Implements SaX::SaXConfigIF.

Definition at line 166 of file config.cpp.

void SaX::SaXConfig::setParseError char *  data  )  [virtual]
 

private member which stores the parse error for later acces in getParseError()

Implements SaX::SaXConfigIF.

Definition at line 464 of file config.cpp.

void SaX::SaXConfig::setParseErrorValue char *  data  )  [virtual]
 

private member which stores the parse error value for later acces in getParseErrorValue()

Implements SaX::SaXConfigIF.

Definition at line 453 of file config.cpp.

int SaX::SaXConfig::testConfiguration void   )  [virtual]
 

test the configuration by starting a new X-Server using the preliminary configuration file.

Implements SaX::SaXConfigIF.

Definition at line 349 of file config.cpp.

References createConfiguration(), SaX::SaXException::errorString(), and SaX::SaXException::excProcessFailed().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Mon Jan 7 17:27:58 2008 for libsax by  doxygen 1.4.6