/usr/share/cruisecontrol-bin-2.6.1/projects/qpid-trunk/cpp/src/qpid/Exception.h

00001 #ifndef _Exception_
00002 #define _Exception_
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  * 
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  * 
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include "qpid/framing/amqp_types.h"
00026 #include "qpid/Msg.h"
00027 
00028 #include <memory>
00029 #include <string>
00030 
00031 namespace qpid
00032 {
00033 
00035 std::string strError(int err);
00036 
00040 class Exception : public std::exception
00041 {
00042   public:
00043     explicit Exception(const std::string& message=std::string()) throw();
00044     virtual ~Exception() throw();
00045     virtual const char* what() const throw();
00046 
00047   protected:
00048     std::string getPrefix() const;
00049   private:
00050     std::string message;
00051     mutable std::string whatStr;
00052 };
00053 
00063 struct SessionException : public Exception {
00064     const framing::ReplyCode code;
00065     SessionException(framing::ReplyCode code_, const std::string& message)
00066         : Exception(message), code(code_) {}
00067 };
00068 
00069 struct ChannelException : public SessionException {
00070     ChannelException(framing::ReplyCode code, const std::string& message)
00071         : SessionException(code, message) {}
00072 };
00073 
00074 struct ConnectionException : public SessionException {
00075     ConnectionException(framing::ReplyCode code, const std::string& message)
00076         : SessionException(code, message) {}
00077 };
00078 
00079 struct ClosedException : public Exception {
00080     ClosedException(const std::string& msg=std::string());
00081     std::string getPrefix() const;
00082 };
00083 
00084 } // namespace qpid
00085  
00086 #endif  

Generated on Thu Apr 10 11:08:17 2008 for Qpid by  doxygen 1.4.7