gloox  0.9.9.12
dataform.h
1 /*
2  Copyright (c) 2005-2008 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 
14 #ifndef DATAFORM_H__
15 #define DATAFORM_H__
16 
17 #include "dataformbase.h"
18 
19 #include <string>
20 #include <list>
21 
22 namespace gloox
23 {
24 
25  class Tag;
26 
35  class GLOOX_API DataForm : public DataFormBase
36  {
37  public:
42  {
43  FormTypeForm,
45  FormTypeSubmit,
47  FormTypeCancel,
49  FormTypeResult,
51  FormTypeInvalid
53  };
54 
62  DataForm( DataFormType type, const StringList& instructions, const std::string& title = "" );
63 
71  DataForm( DataFormType type, const std::string& title = "" );
72 
77  DataForm( Tag *tag );
78 
82  DataForm();
83 
87  virtual ~DataForm();
88 
95  Tag* tag() const;
96 
101  const std::string& title() const { return m_title; }
102 
108  void setTitle( const std::string& title ) { m_title = title; }
109 
114  const StringList& instructions() const { return m_instructions; }
115 
123  void setInstructions( const StringList& instructions ) { m_instructions = instructions; }
124 
130  DataForm::DataFormType type() const { return m_type; }
131 
138  bool parse( Tag *tag );
139 
140  private:
141  StringList m_instructions;
142 
143  DataFormType m_type;
144  std::string m_title;
145  };
146 
147 }
148 
149 #endif // DATAFORM_H__