qprefixmatcher_p.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /****************************************************************************
  2. **
  3. ** This file is part of the Qt Extended Opensource Package.
  4. **
  5. ** Copyright (C) 2009 Trolltech ASA.
  6. **
  7. ** Contact: Qt Extended Information (info@qtextended.org)
  8. **
  9. ** This file may be used under the terms of the GNU General Public License
  10. ** version 2.0 as published by the Free Software Foundation and appearing
  11. ** in the file LICENSE.GPL included in the packaging of this file.
  12. **
  13. ** Please review the following information to ensure GNU General Public
  14. ** Licensing requirements will be met:
  15. ** http://www.fsf.org/licensing/licenses/info/GPLv2.html.
  16. **
  17. **
  18. ****************************************************************************/
  19. #ifndef QPREFIXMATCHER_P_H
  20. #define QPREFIXMATCHER_P_H
  21. //
  22. // W A R N I N G
  23. // -------------
  24. //
  25. // This file is not part of the Qt Extended API. It exists purely as an
  26. // implementation detail. This header file may change from version to
  27. // version without notice, or even be removed.
  28. //
  29. // We mean it.
  30. //
  31. #include <qobject.h>
  32. #include <qset.h>
  33. class QPrefixMatcherNode;
  34. class QPrefixMatcher : public QObject
  35. {
  36. Q_OBJECT
  37. public:
  38. explicit QPrefixMatcher( QObject *parent );
  39. ~QPrefixMatcher();
  40. enum Type
  41. {
  42. Unknown,
  43. OKTerminator,
  44. Terminator,
  45. FuzzyTerminator,
  46. TerminatorOrNotification,
  47. Ignore,
  48. Notification,
  49. NotificationWithPDU,
  50. CommandEcho
  51. };
  52. void add( const QString& prefix, QPrefixMatcher::Type type,
  53. bool mayBeCommand = false, QObject *target = 0,
  54. const char *slot = 0 );
  55. QPrefixMatcher::Type lookup
  56. ( const QString& value, const QString& command ) const;
  57. private slots:
  58. void targetDestroyed();
  59. private:
  60. QSet<QObject *> targets;
  61. QPrefixMatcherNode *root;
  62. };
  63. #endif