Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

dataform.h

00001 /*
00002   Copyright (c) 2005-2008 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 
00014 #ifndef DATAFORM_H__
00015 #define DATAFORM_H__
00016 
00017 #include "dataformfieldcontainer.h"
00018 #include "stanzaextension.h"
00019 
00020 #include <string>
00021 #include <list>
00022 
00023 namespace gloox
00024 {
00025 
00026   class Tag;
00027   class DataFormItem;
00028   class DataFormReported;
00029 
00033   enum FormType
00034   {
00035     TypeForm,                     
00037     TypeSubmit,                   
00039     TypeCancel,                   
00041     TypeResult,                   
00044     TypeInvalid                   
00046   };
00047 
00056   class GLOOX_API DataForm : public StanzaExtension, public DataFormFieldContainer
00057   {
00058     public:
00066       DataForm( FormType type, const StringList& instructions, const std::string& title = EmptyString );
00067 
00075       DataForm( FormType type, const std::string& title = EmptyString );
00076 
00081       DataForm( const Tag* tag );
00082 
00087       DataForm( const DataForm& form );
00088 
00092       virtual ~DataForm();
00093 
00098       const std::string& title() const { return m_title; }
00099 
00105       void setTitle( const std::string& title ) { m_title = title; }
00106 
00111       const StringList& instructions() const { return m_instructions; }
00112 
00120       void setInstructions( const StringList& instructions ) { m_instructions = instructions; }
00121 
00127       FormType type() const { return m_type; }
00128 
00133       void setType( FormType type ) { m_type = type; }
00134 
00141       bool parse( const Tag* tag );
00142 
00146       operator bool() const { return m_type != TypeInvalid; }
00147 
00148       // reimplemented from StanzaExtension
00149       virtual const std::string& filterString() const;
00150 
00151       // reimplemented from StanzaExtension
00152       virtual StanzaExtension* newInstance( const Tag* tag ) const
00153       {
00154         return new DataForm( tag );
00155       }
00156 
00157       // reimplemented from StanzaExtension
00158       virtual Tag* tag() const;
00159 
00160     protected:
00161       FormType m_type;
00162 
00163     private:
00164       StringList m_instructions;
00165 
00166       std::string m_title;
00167 
00168   };
00169 
00170 }
00171 
00172 #endif // DATAFORM_H__

Generated on Mon Sep 1 09:25:09 2008 for gloox by  doxygen 1.4.1