source: trunk/debathena/third/schroot/sbuild/sbuild-keyfile-base.cc @ 24167

Revision 24167, 6.3 KB checked in by broder, 15 years ago (diff)
Import schroot upstream into subversion.
Line 
1/* Copyright © 2005-2008  Roger Leigh <rleigh@debian.org>
2 *
3 * schroot is free software: you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * schroot is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program.  If not, see
15 * <http://www.gnu.org/licenses/>.
16 *
17 *********************************************************************/
18
19#include <config.h>
20
21#include "sbuild-keyfile-base.h"
22
23#include <boost/format.hpp>
24
25using boost::format;
26using namespace sbuild;
27
28namespace
29{
30
31  typedef std::pair<keyfile_base::error_code,const char *> emap;
32
33  /**
34   * This is a list of the supported error codes.  It's used to
35   * construct the real error codes map.
36   */
37  emap init_errors[] =
38    {
39      // TRANSLATORS: %1% = file
40      emap(keyfile_base::BAD_FILE,
41           N_("Can't open file '%1%'")),
42      // TRANSLATORS: %1% = line number in configuration file
43      // TRANSLATORS: %2% = group name ("[groupname]" in configuration file)
44      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
45      emap(keyfile_base::DEPRECATED_KEY,
46           N_("line %1% [%2%]: Deprecated key '%4%' used")),
47      // TRANSLATORS: %1% = group name ("[groupname]" in configuration file)
48      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
49      emap(keyfile_base::DEPRECATED_KEY_NL,
50           N_("[%1%]: Deprecated key '%4%' used")),
51      // TRANSLATORS: %1% = line number in configuration file
52      // TRANSLATORS: %2% = group name ("[groupname]" in configuration file)
53      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
54      emap(keyfile_base::DISALLOWED_KEY,
55           N_("line %1% [%2%]: Disallowed key '%4%' used")),
56      // TRANSLATORS: %1% = group name ("[groupname]" in configuration file)
57      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
58      emap(keyfile_base::DISALLOWED_KEY_NL,
59           N_("[%1%]: Disallowed key '%4%' used")),
60      // TRANSLATORS: %1% = line number in configuration file
61      // TRANSLATORS: %4% = group name ("[groupname]" in configuration file)
62      emap(keyfile_base::DUPLICATE_GROUP,
63           N_("line %1%: Duplicate group '%4%'")),
64      // TRANSLATORS: %1% = line number in configuration file
65      // TRANSLATORS: %2% = group name ("[groupname]" in configuration file)
66      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
67      emap(keyfile_base::DUPLICATE_KEY,
68           N_("line %1% [%2%]: Duplicate key '%4%'")),
69      // TRANSLATORS: %1% = line number in configuration file
70      // TRANSLATORS: %4% = line contents as read from the configuration file
71      emap(keyfile_base::INVALID_GROUP,
72           N_("line %1%: Invalid group: \"%4%\"")),
73      // TRANSLATORS: %1% = line number in configuration file
74      // TRANSLATORS: %4% = line contents as read from the configuration file
75      emap(keyfile_base::INVALID_LINE,
76           N_("line %1%: Invalid line: \"%4%\"")),
77      // TRANSLATORS: %1% = line number in configuration file
78      // TRANSLATORS: %2% = group name ("[groupname]" in configuration file)
79      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
80      emap(keyfile_base::MISSING_KEY,
81           N_("line %1% [%2%]: Required key '%4%' is missing")),
82      // TRANSLATORS: %1% = group name ("[groupname]" in configuration file)
83      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
84      emap(keyfile_base::MISSING_KEY_NL,
85           N_("[%1%]: Required key '%4%' is missing")),
86      // TRANSLATORS: %1% = line number in configuration file
87      // TRANSLATORS: %4% = line contents as read from the configuration file
88      emap(keyfile_base::NO_GROUP,
89           N_("line %1%: No group specified: \"%4%\"")),
90      // TRANSLATORS: %1% = line number in configuration file
91      // TRANSLATORS: %4% = line contents as read from the configuration file
92      emap(keyfile_base::NO_KEY,
93           N_("line %1%: No key specified: \"%4%\"")),
94      // TRANSLATORS: %1% = line number in configuration file
95      // TRANSLATORS: %2% = group name ("[groupname]" in configuration file)
96      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
97      emap(keyfile_base::OBSOLETE_KEY,
98           N_("line %1% [%2%]: Obsolete key '%4%' used")),
99      // TRANSLATORS: %1% = group name ("[groupname]" in configuration file)
100      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
101      emap(keyfile_base::OBSOLETE_KEY_NL,
102           N_("[%1%]: Obsolete key '%4%' used")),
103      // TRANSLATORS: %1% = group name ("[groupname]" in configuration file)
104      // TRANSLATORS: %4% = additional details
105      emap(keyfile_base::PASSTHROUGH_G,
106           N_("[%1%]: %4%")),
107      // TRANSLATORS: %1% = group name ("[groupname]" in configuration file)
108      // TRANSLATORS: %2% = key name ("keyname=value" in configuration file)
109      // TRANSLATORS: %4% = additional details
110      emap(keyfile_base::PASSTHROUGH_GK,
111           N_("[%1%] %2%: %4%")),
112      // TRANSLATORS: %1% = line number in configuration file
113      // TRANSLATORS: %2% = group name ("[groupname]" in configuration file)
114      // TRANSLATORS: %4% = additional details
115      emap(keyfile_base::PASSTHROUGH_LG,
116           N_("line %1% [%2%]: %4%")),
117      // TRANSLATORS: %1% = line number in configuration file
118      // TRANSLATORS: %2% = group name ("[groupname]" in configuration file)
119      // TRANSLATORS: %3% = key name ("keyname=value" in configuration file)
120      // TRANSLATORS: %4% = additional details
121      emap(keyfile_base::PASSTHROUGH_LGK,
122           N_("line %1% [%2%] %3%: %4%")),
123      // TRANSLATORS: %1% = line number in configuration file
124      // TRANSLATORS: %2% = group name ("[groupname]" in configuration file)
125      // TRANSLATORS: %4% = key name ("keyname=value" in configuration file)
126      emap(keyfile_base::UNKNOWN_KEY,
127           N_("line %1% [%2%]: Unknown key '%4%' used")),
128    };
129
130}
131
132template<>
133error<keyfile_base::error_code>::map_type
134error<keyfile_base::error_code>::error_strings
135(init_errors,
136 init_errors + (sizeof(init_errors) / sizeof(init_errors[0])));
137
138keyfile_base::keyfile_base ()
139{
140}
141
142keyfile_base::~keyfile_base()
143{
144}
Note: See TracBrowser for help on using the repository browser.