gloox  1.0.9
receipt.h
1 /*
2  Copyright (c) 2007-2013 by Jakob Schroeter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 #ifndef RECEIPT_H__
14 #define RECEIPT_H__
15 
16 #include "gloox.h"
17 #include "stanzaextension.h"
18 
19 #include <string>
20 
21 namespace gloox
22 {
23 
24  class Tag;
25 
32  class GLOOX_API Receipt : public StanzaExtension
33  {
34  public:
39  {
42  Invalid
43  };
44 
49  Receipt( const Tag* tag );
50 
56  Receipt( ReceiptType rcpt, const std::string& id = EmptyString )
57  : StanzaExtension( ExtReceipt ), m_rcpt( rcpt ), m_id( id )
58  {}
59 
63  virtual ~Receipt() {}
64 
69  ReceiptType rcpt() const { return m_rcpt; }
70 
75  std::string id() const { return m_id; }
76 
77  // reimplemented from StanzaExtension
78  virtual const std::string& filterString() const;
79 
80  // reimplemented from StanzaExtension
81  virtual StanzaExtension* newInstance( const Tag* tag ) const
82  {
83  return new Receipt( tag );
84  }
85 
86  // reimplemented from StanzaExtension
87  Tag* tag() const;
88 
89  // reimplemented from StanzaExtension
90  virtual StanzaExtension* clone() const
91  {
92  return new Receipt( *this );
93  }
94 
95  private:
96  ReceiptType m_rcpt;
97  std::string m_id;
98 
99  };
100 
101 }
102 
103 #endif // RECEIPT_H__