textwolf  0.2
exception.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 
11 #ifndef __TEXTWOLF_EXCEPTION_HPP__
12 #define __TEXTWOLF_EXCEPTION_HPP__
13 #include <exception>
14 #include <stdexcept>
15 
16 namespace textwolf {
17 
21 {
24  enum Cause
25  {
43  };
44 };
45 
48 struct exception :public std::runtime_error
49 {
51  Cause cause; //< exception cause tag
52 
55  exception (Cause p_cause) throw()
56  :std::runtime_error("textwolf error in XML"), cause(p_cause) {}
58  exception (const exception& orig) throw()
59  :std::runtime_error("textwolf error in XML"), cause(orig.cause) {}
61  virtual ~exception() throw() {}
62 
66  exception& operator= (const exception& orig) throw()
67  {cause=orig.cause; return *this;}
68 
71  virtual const char* what() const throw()
72  {
73  // enumeration of exception causes as strings
74  static const char* nameCause[ 17] = {
75  "Unknown","DimOutOfRange","StateNumbersNotAscending","InvalidParamState",
76  "InvalidParamChar","DuplicateStateTransition","InvalidState","IllegalParam",
77  "IllegalAttributeName","OutOfMem","ArrayBoundsReadWrite","NotAllowedOperation"
78  "FileReadError","IllegalXmlHeader","InvalidTagOffset","CorruptTagStack",
79  "CodePageIndexNotSupported"
80  };
81  return nameCause[ (unsigned int) cause];
82  }
83 };
84 
85 }//namespace
86 #endif
duplicate transition definition in automaton. Internal textwolf error
Definition: exception.hpp:31
uknown error
Definition: exception.hpp:26
invalid string for a tag or attribute in the automaton definition. Usage error
Definition: exception.hpp:34
Base class for structures that can throw exceptions for non recoverable errors.
Definition: exception.hpp:20
illegal XML header (more than 4 null bytes in a row). Usage error
Definition: exception.hpp:39
invalid state definition in automaton. Internal textwolf error
Definition: exception.hpp:32
currupted tag stack. Internal textwolf error
Definition: exception.hpp:41
throws_exception::Cause Cause
Definition: exception.hpp:50
parameter check in automaton definition failed. Internal textwolf error
Definition: exception.hpp:33
Cause cause
Definition: exception.hpp:51
out of memory in the automaton definition. System error (std::bad_alloc)
Definition: exception.hpp:35
textwolf exception class
Definition: exception.hpp:48
internal error in the tag stack. Internal textwolf error
Definition: exception.hpp:40
invalid array access. Internal textwolf error
Definition: exception.hpp:36
virtual ~exception()
Destructor.
Definition: exception.hpp:61
exception & operator=(const exception &orig)
Assignement.
Definition: exception.hpp:66
XML scanner automaton definition check failed. Labels of states must be equal to their indices...
Definition: exception.hpp:28
error reading a file. System error
Definition: exception.hpp:38
virtual const char * what() const
Exception message.
Definition: exception.hpp:71
memory reserved for statically allocated table or memory block is too small. Increase the size of mem...
Definition: exception.hpp:27
Cause
Enumeration of error cases.
Definition: exception.hpp:24
exception Cause p_cause throw()
Constructor.
Definition: exception.hpp:55
defining an operation in an automaton definition that is not allowed there. Usage error ...
Definition: exception.hpp:37
parameter check (for control character) in automaton definition failed. Internal textwolf error ...
Definition: exception.hpp:30
the index of the code page specified for a character set encoding is unknown to textwolf. Usage error
Definition: exception.hpp:42
parameter check (for state) in automaton definition failed. Internal textwolf error ...
Definition: exception.hpp:29