00001 #ifndef ZKBXML_H
00002 #define ZKBXML_H
00003
00004 #include <qxml.h>
00005
00006 class ZkbXmlHandler : public QXmlDefaultHandler {
00007 public:
00008 ZkbXmlHandler();
00009 virtual ~ZkbXmlHandler();
00010
00011 virtual bool startElement(const QString&, const QString&,
00012 const QString& name, const QXmlAttributes& attr);
00013
00014 virtual bool endElement(const QString&, const QString&,
00015 const QString& name);
00016
00017 virtual QString errorString();
00018
00019 protected:
00020 QString err;
00021 QStringList elements;
00022
00023 virtual bool startKeymapElement(int ardelay, int arperiod,
00024 const QString& author);
00025 virtual bool startIncludeElement(const QString& file,
00026 const QString& prfix);
00027 virtual bool startLabelElement(const QString& label,
00028 const QString& state);
00029 virtual bool startStateElement(const QString& name,
00030 const QString& parent, bool dflt);
00031 virtual bool startMapElement(int key, bool pressed);
00032 virtual bool startEventElement(int keycode, int unicode, int modifiers,
00033 bool pressed, bool autorepeat);
00034 virtual bool startNextStateElement(const QString& state);
00035
00036 virtual bool endKeymapElement();
00037 virtual bool endIncludeElement();
00038 virtual bool endLabelElement();
00039 virtual bool endStateElement();
00040 virtual bool endMapElement();
00041 virtual bool endEventElement();
00042 virtual bool endNextStateElement();
00043
00044 bool start_keymap(const QXmlAttributes&);
00045 bool start_include(const QXmlAttributes&);
00046 bool start_label(const QXmlAttributes&);
00047 bool start_state(const QXmlAttributes&);
00048 bool start_map(const QXmlAttributes&);
00049 bool start_event(const QXmlAttributes&);
00050 bool start_next_state(const QXmlAttributes&);
00051 bool end_keymap();
00052 bool end_include();
00053 bool end_label();
00054 bool end_state();
00055 bool end_map();
00056 bool end_event();
00057 bool end_next_state();
00058
00059 void setError(const QString&);
00060 int str2key(const QString&);
00061 int str2modifier(const QString&);
00062 bool str2bool(const QString&);
00063 int str2unicode(const QString&);
00064 int str2keycode(const QString&);
00065 int str2uint(const QString&);
00066 };
00067
00068 #endif