FuzzyException.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Copyright 2010 Juan Rada-Vilela
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. /*
  13. * File: FuzzyException.h
  14. * Author: jcrada
  15. *
  16. * Created on November 11, 2009, 7:15 AM
  17. */
  18. #ifndef FL_FUZZYEXCEPTION_H
  19. #define FL_FUZZYEXCEPTION_H
  20. #include <string>
  21. #include <exception>
  22. namespace fl {
  23. class FuzzyException : public std::exception {
  24. private:
  25. std::string _message;
  26. std::string _location;
  27. const FuzzyException* _previous_exception;
  28. public:
  29. FuzzyException(const std::string& file, int line, const std::string& function);
  30. FuzzyException(const std::string& file, int line, const std::string& function,
  31. const std::string& message);
  32. FuzzyException(const std::string& file, int line, const std::string& function,
  33. const std::string& message, const FuzzyException& previous_exception);
  34. virtual ~FuzzyException() throw ();
  35. virtual std::string name() const throw ();
  36. virtual void setMessage(const std::string& message) throw ();
  37. virtual std::string message() const throw ();
  38. virtual void setLocation(const std::string& file, int line,
  39. const std::string& function) throw ();
  40. virtual std::string location() const throw ();
  41. virtual void setPreviousException(const FuzzyException& exception) throw ();
  42. virtual const FuzzyException* previousException() const throw ();
  43. virtual const char* what() const throw ();
  44. virtual std::string toString() const throw ();
  45. virtual std::string stackTrace() const throw ();
  46. static void Assert(const std::string& file, int line,
  47. const std::string& function, bool assert, const std::string message = "");
  48. };
  49. }
  50. #endif /* FL_FUZZYEXCEPTION_H */