# Hurricane Documentation

# Hurricane VLSI Database

Exception.h
1 // ****************************************************************************************************
2 // File: ./hurricane/Exception.h
3 // Authors: R. Escassut
4 // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
5 //
6 // This file is part of Hurricane.
7 //
8 // Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU
9 // Lesser General Public License as published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
11 //
12 // Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
13 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
14 // General Public License for more details.
15 //
16 // You should have received a copy of the Lesser GNU General Public License along with Hurricane. If
17 // not, see <http://www.gnu.org/licenses/>.
18 // ****************************************************************************************************
19
20 #ifndef HURRICANE_EXCEPTION
21 #define HURRICANE_EXCEPTION
22
23 #include "hurricane/Commons.h"
24 #include "hurricane/TextTranslator.h"
25
26 namespace Hurricane {
27
28
29
30 // ****************************************************************************************************
31 // Exception declaration
32 // ****************************************************************************************************
33
34 class Exception {
35 // **************
36
37 // Attributes
38 // **********
39
40 private: static TextTranslator _textTranslator;
41 private: static TextTranslator _htmlTranslator;
42
43 // Constructors
44 // ************
45
46 protected: Exception();
47
48 private: Exception(const Exception& exception); // not implemented to forbid copy construction
49
50 // Destructor
51 // **********
52
53 public: virtual ~Exception();
54
55 // Operators
56 // *********
57
58 private: Exception& operator=(const Exception& exception); // not implemented to forbid assignment
59
60 // Accessors
61 // *********
62
63 public: string what () const { return textWhat(); };
64 public: string textWhat() const { return _textTranslator.translate(_getString()); };
65 public: string htmlWhat() const { return _htmlTranslator.translate(_getString()); };
66
67 // Others
68 // ******
69
70 public: static void setTextTranslator ( const TextTranslator& translator ) { _textTranslator=translator; }
71 public: static void setHtmlTranslator ( const TextTranslator& translator ) { _htmlTranslator=translator; }
72 public: virtual string _getString () const = 0;
73
74 };
75
76
77 } // End of Hurricane namespace.
78
79
80 #endif // HURRICANE_EXCEPTION
81
82
83 // ****************************************************************************************************
84 // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
85 // ****************************************************************************************************
Hurricane::Exception::textWhat
string textWhat() const
Definition: Exception.h:64
Hurricane::Exception::setTextTranslator
static void setTextTranslator(const TextTranslator &translator)
Definition: Exception.h:70
Hurricane::Exception::setHtmlTranslator
static void setHtmlTranslator(const TextTranslator &translator)
Definition: Exception.h:71
Hurricane::Exception
Exception description (API)
Definition: Exception.h:34
Hurricane::Exception::htmlWhat
string htmlWhat() const
Definition: Exception.h:65
Hurricane::Exception::what
string what() const
Definition: Exception.h:63
Hurricane
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5