]> git.donarmstrong.com Git - flightcrew.git/blob - src/FlightCrew/ErrorMessages.h
Imported Upstream version 0.7.2+dfsg
[flightcrew.git] / src / FlightCrew / ErrorMessages.h
1 /************************************************************************
2 **
3 **  Copyright (C) 2010  Strahinja Markovic
4 **
5 **  This file is part of FlightCrew.
6 **
7 **  FlightCrew is free software: you can redistribute it and/or modify
8 **  it under the terms of the GNU Lesser General Public License as published
9 **  by the Free Software Foundation, either version 3 of the License, or
10 **  (at your option) any later version.
11 **
12 **  FlightCrew is distributed in the hope that it will be useful,
13 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 **  GNU Lesser General Public License for more details.
16 **
17 **  You should have received a copy of the GNU Lesser General Public License
18 **  along with FlightCrew.  If not, see <http://www.gnu.org/licenses/>.
19 **
20 *************************************************************************/
21
22 #pragma once
23 #ifndef ERRORMESSAGES_H
24 #define ERRORMESSAGES_H
25
26 #include <string>
27 #include <boost/thread/mutex.hpp>
28 #include <boost/unordered/unordered_map_fwd.hpp>
29 #include "ResultId.h"
30
31 namespace FlightCrew
32 {
33
34 class ErrorMessages
35 {
36 public:
37
38     static ErrorMessages& Instance();
39
40     const std::string MessageForId( ResultId error_id );
41
42 private:
43
44     ErrorMessages();
45
46     void LoadMessages();
47
48     ///////////////////////////////
49     // PRIVATE MEMBER VARIABLES
50     ///////////////////////////////
51
52     static boost::mutex s_AccessMutex;
53
54     static ErrorMessages *s_Instance;
55
56     boost::unordered_map< ResultId, std::string > m_Messages;
57 };
58
59 } // namespace FlightCrew
60
61 #endif // ERRORMESSAGES_H