00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ERROR_H__
00014 #define ERROR_H__
00015
00016 #include "gloox.h"
00017 #include "stanzaextension.h"
00018
00019 #include <string>
00020 #include <map>
00021
00022 namespace gloox
00023 {
00024
00025 class Tag;
00026
00034 class GLOOX_API Error : public StanzaExtension
00035 {
00036 public:
00037
00038
00039
00040
00041
00042
00047 Error( const Tag* tag = 0 );
00048
00055 Error( StanzaErrorType type, StanzaError error, Tag* appError = 0 )
00056 : StanzaExtension( ExtError ), m_type( type ),
00057 m_error( error ), m_appError( appError )
00058 {}
00059
00063 virtual ~Error();
00064
00069 StanzaErrorType type() const { return m_type; }
00070
00075 StanzaError error() const { return m_error; }
00076
00083 const Tag* appError() const { return m_appError; }
00084
00094 const std::string& text( const std::string& lang = "default" ) const;
00095
00096
00097 virtual const std::string& filterString() const;
00098
00099
00100 virtual StanzaExtension* newInstance( const Tag* tag ) const
00101 {
00102 return new Error( tag );
00103 }
00104
00105
00106 virtual Tag* tag() const;
00107
00108 private:
00109 Error( const Error& error );
00110
00111 void setValues( const Tag* tag );
00112 StanzaErrorType m_type;
00113 StanzaError m_error;
00114 Tag* m_appError;
00115 StringMap m_text;
00116 };
00117
00118 }
00119
00120 #endif