gloox  1.0.13
iodata.h
1 /*
2  Copyright (c) 2015 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 
14 #ifndef IODATA_H__
15 #define IODATA_H__
16 
17 #include "adhocplugin.h"
18 
19 #include "gloox.h"
20 #include "tag.h"
21 
22 #include <string>
23 
24 namespace gloox
25 {
26 
36  class GLOOX_API IOData : public AdhocPlugin
37  {
38  public:
42  enum Type
43  {
44  TypeIoSchemataGet,
53  };
54 
55  struct Status
56  {
57  int elapsed;
59  int remaining;
61  int percentage;
62  std::string info;
63  };
64 
69  IOData( Type type );
70 
75  IOData( const Tag* tag );
76 
80  virtual ~IOData();
81 
86  Type type() const { return m_type; }
87 
93  const Tag* in() const { return m_in; }
94 
100  void setIn( Tag* in );
101 
107  const Tag* out() const { return m_out; }
108 
114  void setOut( Tag* out );
115 
121  const Tag* error() const { return m_error; }
122 
128  void setError( Tag* error );
129 
134  void setDesc( const std::string& desc ) { m_desc = desc; }
135 
140  const std::string& desc() const { return m_desc; }
141 
146  void setStatus( Status status ) { m_status = status; }
147 
152  Status status() const { return m_status; }
153 
154  // reimplemented from AdhocPlugin/StanzaExtension
155  virtual Tag* tag() const;
156 
157  // reimplemented from AdhocPlugin/StanzaExtension
158  virtual IOData* clone() const;
159 
160  // reimplemented from AdhocPlugin/StanzaExtension
161  virtual const std::string& filterString() const { return EmptyString; }
162 
163  // reimplemented from AdhocPlugin/StanzaExtension
164  virtual StanzaExtension* newInstance( const Tag* /*tag*/ ) const { return 0; }
165 
169  operator bool() const { return m_type != TypeInvalid; }
170 
171  private:
172  Tag* m_in;
173  Tag* m_out;
174  Tag* m_error;
175 
176  std::string m_desc;
177 
178  Status m_status;
179 
180  Type m_type;
181 
182  };
183 
184 }
185 
186 #endif // IODATA_H__