fb2xml.h 831 B

12345678910111213141516171819202122232425
  1. #ifndef FB2XML_H
  2. #define FB2XML_H
  3. #include <QHash>
  4. #define FB2_BEGIN_KEYLIST private: enum Keyword {
  5. #define FB2_END_KEYLIST None }; \
  6. class KeywordHash : public QHash<QString, Keyword> { public: KeywordHash(); }; \
  7. static Keyword toKeyword(const QString &name); private:
  8. #define FB2_BEGIN_KEYHASH(x) \
  9. x::Keyword x::toKeyword(const QString &name) \
  10. { \
  11. static const KeywordHash map; \
  12. KeywordHash::const_iterator i = map.find(name); \
  13. return i == map.end() ? None : i.value(); \
  14. } \
  15. x::KeywordHash::KeywordHash() {
  16. #define FB2_END_KEYHASH }
  17. #define FB2_KEY(key,str) insert(str,key);
  18. #endif // FB2XML_H