gloox  1.0
receipt.h
00001 /*
00002   Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 #ifndef RECEIPT_H__
00014 #define RECEIPT_H__
00015 
00016 #include "gloox.h"
00017 #include "stanzaextension.h"
00018 
00019 #include <string>
00020 
00021 namespace gloox
00022 {
00023 
00024   class Tag;
00025 
00032   class GLOOX_API Receipt : public StanzaExtension
00033   {
00034     public:
00038       enum ReceiptType
00039       {
00040         Request,                    
00041         Received,                   
00042         Invalid                     
00043       };
00044 
00049       Receipt( const Tag* tag );
00050 
00055       Receipt( ReceiptType rcpt )
00056         : StanzaExtension( ExtReceipt ), m_rcpt( rcpt )
00057       {}
00058 
00062       virtual ~Receipt() {}
00063 
00068       ReceiptType rcpt() const { return m_rcpt; }
00069 
00070       // reimplemented from StanzaExtension
00071       virtual const std::string& filterString() const;
00072 
00073       // reimplemented from StanzaExtension
00074       virtual StanzaExtension* newInstance( const Tag* tag ) const
00075       {
00076         return new Receipt( tag );
00077       }
00078 
00079       // reimplemented from StanzaExtension
00080       Tag* tag() const;
00081 
00082       // reimplemented from StanzaExtension
00083       virtual StanzaExtension* clone() const
00084       {
00085         return new Receipt( *this );
00086       }
00087 
00088     private:
00089       ReceiptType m_rcpt;
00090 
00091   };
00092 
00093 }
00094 
00095 #endif // RECEIPT_H__