00001
00002
00003
00004
00005
00006
00007 #pragma once
00008
00009 #include <boost/shared_ptr.hpp>
00010
00011 #include <Swiften/Elements/Element.h>
00012 #include <string>
00013
00014 namespace Swift {
00015 class StreamError : public Element {
00016 public:
00017 typedef boost::shared_ptr<StreamError> ref;
00018
00019 enum Type {
00020 BadFormat,
00021 BadNamespacePrefix,
00022 Conflict,
00023 ConnectionTimeout,
00024 HostGone,
00025 HostUnknown,
00026 ImproperAddressing,
00027 InternalServerError,
00028 InvalidFrom,
00029 InvalidID,
00030 InvalidNamespace,
00031 InvalidXML,
00032 NotAuthorized,
00033 NotWellFormed,
00034 PolicyViolation,
00035 RemoteConnectionFailed,
00036 Reset,
00037 ResourceConstraint,
00038 RestrictedXML,
00039 SeeOtherHost,
00040 SystemShutdown,
00041 UndefinedCondition,
00042 UnsupportedEncoding,
00043 UnsupportedStanzaType,
00044 UnsupportedVersion,
00045 };
00046
00047 StreamError(Type type = UndefinedCondition, const std::string& text = std::string()) : type_(type), text_(text) { }
00048
00049 Type getType() const {
00050 return type_;
00051 }
00052
00053 void setType(Type type) {
00054 type_ = type;
00055 }
00056
00057 void setText(const std::string& text) {
00058 text_ = text;
00059 }
00060
00061 const std::string& getText() const {
00062 return text_;
00063 }
00064
00065 private:
00066 Type type_;
00067 std::string text_;
00068 };
00069 }