libsax 7.2

config.h

00001 /**************
00002 FILE          : config.h
00003 ***************
00004 PROJECT       : SaX2 - library interface [header]
00005               :
00006 AUTHOR        : Marcus Schäfer <ms@suse.de>
00007               :
00008 BELONGS TO    : SaX2 - SuSE advanced X11 configuration 
00009               : 
00010               :
00011 DESCRIPTION   : native C++ class library to access SaX2
00012               : functionality. Easy to use interface for
00013               : //.../
00014               : - importing/exporting X11 configurations
00015               : - modifying/creating X11 configurations 
00016               : ---
00017               :
00018               :
00019 STATUS        : Status: Development
00020 **************/
00021 #ifndef SAX_CONFIG_H
00022 #define SAX_CONFIG_H 1
00023 
00024 //====================================
00025 // Includes...
00026 //------------------------------------
00027 #include <stdarg.h>
00028 #include <dirent.h>
00029 #include <stdlib.h>
00030 extern "C" {
00031 #include "xf86Parser.h"
00032 }
00033 
00034 #include "export.h"
00035 
00036 namespace SaX {
00037 //====================================
00038 // Defines...
00039 //------------------------------------
00040 #define SAX_NEW         20
00041 #define SAX_MERGE       21
00042 #define SAX_CREATE_API  "/usr/share/sax/libsax/createAPI.pl"
00043 #define SAX_TEST_CONFIG "/usr/share/sax/libsax/createTST.pl"
00044 #define SAX_API_FILE    "/var/lib/sax/apidata"
00045 #define SAX_API_CONFIG  "/var/lib/sax/xorg.conf"
00046 #define SAX_API_MD5     "/var/lib/sax/xorg.conf.md5"
00047 #define SAX_SYS_MD5     "/etc/X11/xorg.conf.md5"
00048 #define SAX_SYS_CONFIG  "/etc/X11/xorg.conf"
00049 #define SAX_SYS_CSAVED  "/etc/X11/xorg.conf.saxsave"
00050 #define SAX_X11_LOADER  "/usr/X11R6/bin/Xorg"
00051 #define SAX_XFINE_CACHE "/var/cache/xfine"
00052 #define SAX_MD5_SUM     "/usr/bin/md5sum"
00053 #define CONFPATH        "%A,%R,/etc/%R,%P/etc/X11/%R,%E,%F,/etc/X11/%F"
00054 #define CONFERRORLINE   80
00055 
00056 //====================================
00057 // Interface class for dlopen ability
00058 //------------------------------------
00066 class SaXConfigIF : public SaXException {
00067         public:
00068         virtual void setParseErrorValue ( char* ) = 0;
00069         virtual void setParseError ( char* ) = 0;
00070         virtual void addImport ( SaXImport* ) = 0;
00071         virtual void setMode ( int ) = 0;
00072 
00073         public:
00074         virtual QString getParseErrorValue ( void ) = 0;
00075         virtual QString getParseError ( void ) = 0;
00076 
00077         public:
00078         virtual bool createConfiguration  ( void ) = 0;
00079         virtual void commitConfiguration  ( void ) = 0;
00080         virtual int  testConfiguration    ( void ) = 0;
00081         virtual bool isChecksumOK         ( void ) = 0;
00082 
00083         public:
00084         virtual ~SaXConfigIF ( void ) { }
00085 };
00086 //====================================
00087 // Class SaXConfig...
00088 //------------------------------------
00142 class SaXConfig : public SaXConfigIF {
00143         private:
00144         QList <SaXImport*> mImportList;
00145         SaXImport* mDesktop;
00146         int configMode;
00147 
00148         private:
00149         QString* mParseErrorString;
00150         QString* mParseErrorValue;
00151 
00152         private:
00153         bool gotCard;
00154         bool gotDesktop;
00155         bool gotPointers;
00156         bool gotKeyboard;
00157         bool gotLayout;
00158         bool gotPath;
00159         bool gotExtensions;
00160 
00161         private:
00162         void enableXFineCache (bool = true);
00163         void removeXFineCache (void);
00164 
00165         public:
00166         void setParseErrorValue ( char* );
00167         void setParseError ( char* );
00168         void addImport ( SaXImport* );
00169         void setMode ( int );
00170         
00171         public:
00172         QString getParseErrorValue ( void );
00173         QString getParseError ( void );
00174 
00175         public:
00176         bool createConfiguration  ( void );
00177         void commitConfiguration  ( void );
00178         int  testConfiguration    ( void );
00179         bool isChecksumOK         ( void );
00180 
00181         public:
00182         SaXConfig ( int = SAX_MERGE );
00183 };
00184 } // end namespace
00185 #endif