QXmppIq.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2008-2012 The QXmpp developers
  3. *
  4. * Author:
  5. * Manjeet Dahiya
  6. *
  7. * Source:
  8. * http://code.google.com/p/qxmpp
  9. *
  10. * This file is a part of QXmpp library.
  11. *
  12. * This library is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU Lesser General Public
  14. * License as published by the Free Software Foundation; either
  15. * version 2.1 of the License, or (at your option) any later version.
  16. *
  17. * This library is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * Lesser General Public License for more details.
  21. *
  22. */
  23. #ifndef QXMPPIQ_H
  24. #define QXMPPIQ_H
  25. #include "QXmppStanza.h"
  26. // forward declarations of QXmlStream* classes will not work on Mac, we need to
  27. // include the whole header.
  28. // See http://lists.trolltech.com/qt-interest/2008-07/thread00798-0.html
  29. // for an explanation.
  30. #include <QXmlStreamWriter>
  31. class QXmppIqPrivate;
  32. /// \brief The QXmppIq class is the base class for all IQs.
  33. ///
  34. /// \ingroup Stanzas
  35. class QXMPP_EXPORT QXmppIq : public QXmppStanza
  36. {
  37. public:
  38. /// This enum describes the type of IQ.
  39. enum Type
  40. {
  41. Error = 0, ///< Error response.
  42. Get, ///< Get request.
  43. Set, ///< Set request.
  44. Result ///< Result.
  45. };
  46. QXmppIq(QXmppIq::Type type = QXmppIq::Get);
  47. QXmppIq(const QXmppIq &other);
  48. ~QXmppIq();
  49. QXmppIq& operator=(const QXmppIq &other);
  50. QXmppIq::Type type() const;
  51. void setType(QXmppIq::Type);
  52. /// \cond
  53. void parse(const QDomElement &element);
  54. void toXml(QXmlStreamWriter *writer) const;
  55. protected:
  56. virtual void parseElementFromChild(const QDomElement &element);
  57. virtual void toXmlElementFromChild(QXmlStreamWriter *writer) const;
  58. /// \endcond
  59. private:
  60. QSharedDataPointer<QXmppIqPrivate> d;
  61. };
  62. #endif // QXMPPIQ_H