gloox  1.0.28
receipt.h
1 /*
2  Copyright (c) 2007-2023 by Jakob Schröter <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__
An implementation of Message Receipts (XEP-0184) as a StanzaExtension.
Definition: receipt.h:33
Receipt(ReceiptType rcpt, const std::string &id=EmptyString)
Definition: receipt.h:56
std::string id() const
Definition: receipt.h:75
virtual StanzaExtension * newInstance(const Tag *tag) const
Definition: receipt.h:81
virtual ~Receipt()
Definition: receipt.h:63
virtual StanzaExtension * clone() const
Definition: receipt.h:90
ReceiptType rcpt() const
Definition: receipt.h:69
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
This is an abstraction of an XML element.
Definition: tag.h:47
The namespace for the gloox library.
Definition: adhoc.cpp:28
const std::string EmptyString
Definition: gloox.cpp:124