• Main Page
  • Classes
  • Files
  • File List

Swiften/Elements/ErrorPayload.h

00001 /*
00002  * Copyright (c) 2010 Remko Tronçon
00003  * Licensed under the GNU General Public License v3.
00004  * See Documentation/Licenses/GPLv3.txt for more information.
00005  */
00006 
00007 #pragma once
00008 
00009 #include <boost/shared_ptr.hpp>
00010 #include <string>
00011 
00012 #include <Swiften/Elements/Payload.h>
00013 
00014 namespace Swift {
00015   class ErrorPayload : public Payload {
00016     public:
00017       typedef boost::shared_ptr<ErrorPayload> ref;
00018 
00019       enum Type { Cancel, Continue, Modify, Auth, Wait };
00020 
00021       enum Condition {
00022         BadRequest,
00023         Conflict,
00024         FeatureNotImplemented,
00025         Forbidden,
00026         Gone,
00027         InternalServerError,
00028         ItemNotFound,
00029         JIDMalformed,
00030         NotAcceptable,
00031         NotAllowed,
00032         NotAuthorized,
00033         PaymentRequired,
00034         RecipientUnavailable,
00035         Redirect,
00036         RegistrationRequired,
00037         RemoteServerNotFound,
00038         RemoteServerTimeout,
00039         ResourceConstraint,
00040         ServiceUnavailable,
00041         SubscriptionRequired,
00042         UndefinedCondition,
00043         UnexpectedRequest
00044       };
00045 
00046       ErrorPayload(Condition condition = UndefinedCondition, Type type = Cancel, const std::string& text = std::string()) : type_(type), condition_(condition), text_(text) { }
00047 
00048       Type getType() const {
00049         return type_; 
00050       }
00051 
00052       void setType(Type type) {
00053         type_ = type;
00054       }
00055 
00056       Condition getCondition() const { 
00057         return condition_; 
00058       }
00059 
00060       void setCondition(Condition condition) { 
00061         condition_ = condition;
00062       }
00063 
00064       void setText(const std::string& text) {
00065         text_ = text;
00066       }
00067 
00068       const std::string& getText() const { 
00069         return text_; 
00070       }
00071 
00072       void setPayload(boost::shared_ptr<Payload> payload) {
00073         payload_ = payload;
00074       }
00075 
00076       boost::shared_ptr<Payload> getPayload() const {
00077         return payload_;
00078       }
00079 
00080     private:
00081       Type type_;
00082       Condition condition_;
00083       std::string text_;
00084       boost::shared_ptr<Payload> payload_;
00085   };
00086 }

Generated on Fri Oct 12 2012 21:00:19 for Swiften by  doxygen 1.7.1