textwolf  0.2
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  */
13 #include <exception>
14 #include <stdexcept>
16 namespace textwolf {
21 {
24  enum Cause
25  {
43  };
44 };
48 struct exception :public std::runtime_error
49 {
51  Cause cause; //< exception cause tag
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() {}
66  exception& operator= (const exception& orig) throw()
67  {cause=orig.cause; return *this;}
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 };
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()
Definition: exception.hpp:61
exception & operator=(const exception &orig)
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
Enumeration of error cases.
Definition: exception.hpp:24
exception Cause p_cause throw()
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