SectorZone: add attribute arc_boundary
[xcsoar.git] / src / FLARM / Error.cpp
blobed0417930f4c4d1c0693f73f67b77b08dce83b58
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "Error.hpp"
25 #include "Util/Macros.hpp"
26 #include "Language/Language.hpp"
28 static const TCHAR *const severity_strings[] = {
29 N_("No error"),
30 N_("Information"),
31 N_("Reduced functionality"),
32 N_("Fatal problem"),
35 const TCHAR *
36 FlarmError::ToString(Severity severity)
38 unsigned i = (unsigned)severity;
39 return i < ARRAY_SIZE(severity_strings)
40 ? severity_strings[i]
41 : N_("Unknown");
44 static constexpr struct {
45 FlarmError::Code code;
46 const TCHAR *string;
47 } error_strings[] = {
48 { FlarmError::Code::FIRMWARE_TIMEOUT, N_("Firmware timeout") },
49 { FlarmError::Code::POWER, N_("Power") },
50 { FlarmError::Code::GPS_COMMUNICATION, N_("GPS communication") },
51 { FlarmError::Code::GPS_CONFIGURATION, N_("GPS configuration") },
52 { FlarmError::Code::RF_COMMUNICATION, N_("RF communication") },
53 { FlarmError::Code::COMMUNICATION, N_("Communication") },
54 { FlarmError::Code::FLASH_MEMORY, N_("Flash memory") },
55 { FlarmError::Code::PRESSURE_SENSOR, N_("Pressure sensor") },
56 { FlarmError::Code::OBSTACLE_DATABASE, N_("Obstacle database") },
57 { FlarmError::Code::FLIGHT_RECORDER, N_("Flight recorder") },
58 { FlarmError::Code::TRANSPONDER_RECEIVER,
59 N_("Transponder receiver") },
60 { FlarmError::Code::OTHER, N_("Other") },
61 { FlarmError::Code::OTHER, nullptr }
64 const TCHAR *
65 FlarmError::ToString(Code code)
67 for (auto i = error_strings; i->string != nullptr; ++i)
68 if (i->code == code)
69 return i->string;
71 return N_("Unknown");