gloox  1.0
shim.h
1 /*
2  Copyright (c) 2007-2009 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 SHIM_H__
14 #define SHIM_H__
15 
16 #include "stanzaextension.h"
17 #include "macros.h"
18 
19 #include <map>
20 #include <string>
21 
22 namespace gloox
23 {
24 
25  class Tag;
26 
35  class GLOOX_API SHIM : public StanzaExtension
36  {
37  public:
41  typedef std::map<std::string, std::string> HeaderList;
42 
47  SHIM( const HeaderList& hl );
48 
53  SHIM( const Tag* tag = 0 );
54 
59  const HeaderList& headers() const { return m_headers; }
60 
64  virtual ~SHIM();
65 
66  // re-implemented from StanzaExtension
67  virtual const std::string& filterString() const;
68 
69  // re-implemented from StanzaExtension
70  virtual StanzaExtension* newInstance( const Tag* tag ) const
71  {
72  return new SHIM( tag );
73  }
74 
75  // re-implemented from StanzaExtension
76  virtual Tag* tag() const;
77 
78  // reimplemented from StanzaExtension
79  virtual StanzaExtension* clone() const
80  {
81  return new SHIM( *this );
82  }
83 
84  private:
85  HeaderList m_headers;
86 
87  };
88 
89 }
90 
91 #endif // SHIM_H__