]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/except.h
Add a missing include
[libs/datafile.git] / source / except.h
index 7892db5be1c292a34ff9c239d0d309b937f708fb..cc8c1fbdcd6b3a4f5b303023871d667b66287381 100644 (file)
@@ -1,28 +1,84 @@
-/* $Id$
-
-This file is part of libmspdatafile
-Copyright © 2008  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_DATAFILE_EXCEPT_H_
 #define MSP_DATAFILE_EXCEPT_H_
 
-#include <msp/core/except.h>
+#include <stdexcept>
+#include <string>
+#include <typeinfo>
 
 namespace Msp {
 namespace DataFile {
 
-class TypeError: public Exception
+class data_error: public std::runtime_error
+{
+private:
+       std::string source;
+       unsigned line;
+
+public:
+       data_error(const std::string &, unsigned, const std::string &);
+       data_error(const std::string &, unsigned, const std::exception &);
+       virtual ~data_error() throw() { }
+
+       const std::string &get_source() const { return source; }
+       unsigned get_line() const { return line; }
+
+private:
+       std::string make_what(const std::string &, unsigned, const std::string &);
+};
+
+
+class parse_error: public std::runtime_error
+{
+public:
+       parse_error(const std::string &);
+       virtual ~parse_error() throw() { }
+};
+
+
+class syntax_error: public std::runtime_error
+{
+public:
+       syntax_error(const std::string &t);
+       virtual ~syntax_error() throw() { }
+};
+
+
+class bad_definition: public std::runtime_error
+{
+public:
+       bad_definition(const std::string &w);
+       virtual ~bad_definition() throw() { }
+};
+
+
+class nesting_error: public std::logic_error
+{
+public:
+       nesting_error(const std::string &);
+       virtual ~nesting_error() throw() { }
+};
+
+
+class unknown_keyword: public std::runtime_error
 {
 public:
-       TypeError(const std::string &w): Exception(w) { }
+       unknown_keyword(const std::string &);
+       virtual ~unknown_keyword() throw() { }
 };
 
-class ParseError: public Exception
+
+class invalid_signature: public std::runtime_error
+{
+public:
+       invalid_signature(const std::string &, const std::string &);
+       virtual ~invalid_signature() throw() { }
+};
+
+
+class no_collection: public std::runtime_error
 {
 public:
-       ParseError(const std::string &w): Exception(w) { }
+       no_collection(const std::type_info &);
 };
 
 } // namespace DataFile