AndroMeta  2.0.0
AndroMeta/include/AndroMeta/MError.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009-2012 AndroMeta LLC. All rights reserved.
00003  *
00004  * AndroMeta LLC retains all intellectual property and proprietary 
00005  * rights to this software and related documentation and any modifications 
00006  * thereto.  Any use, reproduction, disclosure, or distribution of this 
00007  * software and related documentation without an express license agreement 
00008  * from AndroMeta LLC is strictly prohibited.
00009  * 
00010  */
00011 
00018 #ifndef ANDROMETA_M_ERROR_H
00019 #define ANDROMETA_M_ERROR_H
00020 
00021 #include <exception>
00022 
00023 #include <AndroMeta/MStr.h>
00024 
00025 namespace Meta{
00026   
00027   class MVar;
00028   
00041   class MError : public std::exception{
00042   public:
00043     
00049     MError(const mstr& message) throw();
00050     
00054     MError(const MError& error);
00055     
00059     virtual ~MError() throw();
00060     
00065     virtual const char* what() const throw();
00066     
00071     const char* msg() const throw();
00072     
00076     const mstr& type() const throw();
00077     
00090     void setType(const mstr& type) throw();
00091     
00095     bool instanceOf(const mstr& type) const throw();
00096     
00100     MVar& value() throw();
00101     
00105     const MVar& value() const throw();
00106     
00107   private:
00108     MError& operator=(const MError&);
00109     
00110     class MError_* x_;
00111   };
00112 
00113   inline std::ostream& operator<<(std::ostream& ostr, const MError& e){
00114     ostr << e.what();
00115     return ostr;
00116   }
00117   
00118 } // end namespace Meta
00119 
00120 #endif // ANDROMETA_M_ERROR_H