#include <config.h>
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) | |
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 142 of file config.h.
| 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 37 of file config.cpp.
References SaX::SaXException::setLock(), and SaX::SaXException::unsetLock().
| 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 465 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 476 of file config.cpp.
| 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 72 of file config.cpp.
References SaX::SaXException::errorString(), SaX::SaXException::excImportAlreadyAdded(), SaX::SaXException::excUnknownImport(), and SaX::SaXImport::getSectionID().
| 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 171 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 488 of file config.cpp.
| 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 503 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 184 of file config.cpp.
References SaX::SaXExport::doExport(), SaX::SaXException::errorString(), SaX::SaXException::excFileOpenFailed(), SaX::SaXException::excNoAPIFileFound(), SaX::SaXException::excProcessFailed(), SaX::SaXException::setLock(), and SaX::SaXException::unsetLock().
Referenced by testConfiguration().
| 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 250 of file config.cpp.
References SaX::SaXException::errorString(), and SaX::SaXException::excFileOpenFailed().
| 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 361 of file config.cpp.
References createConfiguration(), SaX::SaXException::errorString(), and SaX::SaXException::excProcessFailed().
| 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 415 of file config.cpp.
References SaX::SaXException::errorString(), and SaX::SaXException::excProcessFailed().
1.5.5