Current Version: 1.0.10
Project Name: csspp
exceptions.h
Go to the documentation of this file.
1 #ifndef CSSPP_EXCEPTIONS_H
2 #define CSSPP_EXCEPTIONS_H
3 // CSS Preprocessor
4 // Copyright (C) 2015-2016 Made to Order Software Corp.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 #include <stdexcept>
21 
22 namespace csspp
23 {
24 
25 class csspp_exception_logic : public std::logic_error
26 {
27 public:
28  csspp_exception_logic(std::string const & whatmsg) : logic_error(whatmsg) {}
29 };
30 
31 class csspp_exception_runtime : public std::runtime_error
32 {
33 public:
34  csspp_exception_runtime(std::string const & whatmsg) : std::runtime_error(whatmsg) {}
35 };
36 
37 class csspp_exception_overflow : public std::overflow_error
38 {
39 public:
40  csspp_exception_overflow(std::string const & whatmsg) : overflow_error(whatmsg) {}
41 };
42 
44 {
45 public:
46  csspp_exception_lexer(std::string const & whatmsg) : csspp_exception_runtime(whatmsg) {}
47 };
48 
50 {
51 public:
52  csspp_exception_invalid_character(std::string const & whatmsg) : csspp_exception_runtime(whatmsg) {}
53 };
54 
56 {
57 public:
58  csspp_exception_invalid_token(std::string const & whatmsg) : csspp_exception_runtime(whatmsg) {}
59 };
60 
62 {
63 public:
64  csspp_exception_unexpected_token(std::string const & whatmsg) : csspp_exception_runtime(whatmsg) {}
65 };
66 
68 {
69 public:
70  csspp_exception_exit(int new_exit_code) : csspp_exception_runtime("fatal error"), f_exit_code(new_exit_code) {}
71 
72  int exit_code() const { return f_exit_code; }
73 
74 private:
76 };
77 
78 } // namespace csspp
79 #endif
80 // #ifndef CSSPP_EXCEPTIONS_H
81 
82 // Local Variables:
83 // mode: cpp
84 // indent-tabs-mode: nil
85 // c-basic-offset: 4
86 // tab-width: 4
87 // End:
88 
89 // vim: ts=4 sw=4 et
csspp_exception_exit(int new_exit_code)
Definition: exceptions.h:70
csspp_exception_invalid_token(std::string const &whatmsg)
Definition: exceptions.h:58
csspp_exception_unexpected_token(std::string const &whatmsg)
Definition: exceptions.h:64
csspp_exception_runtime(std::string const &whatmsg)
Definition: exceptions.h:34
csspp_exception_overflow(std::string const &whatmsg)
Definition: exceptions.h:40
csspp_exception_lexer(std::string const &whatmsg)
Definition: exceptions.h:46
csspp_exception_logic(std::string const &whatmsg)
Definition: exceptions.h:28
csspp_exception_invalid_character(std::string const &whatmsg)
Definition: exceptions.h:52

Documentation of CSS Preprocessor.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.