5465
|
1 // oct-errno.h.in |
|
2 /* |
|
3 |
|
4 Copyright (C) 2005 John W. Eaton |
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
5465
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
5465
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_errno_h) |
|
25 #define octave_errno_h 1 |
|
26 |
|
27 #include <map> |
|
28 #include <string> |
|
29 |
|
30 #include "oct-map.h" |
|
31 |
|
32 class |
|
33 octave_errno |
|
34 { |
|
35 protected: |
|
36 |
|
37 octave_errno (void); |
|
38 |
|
39 public: |
|
40 |
|
41 ~octave_errno (void) { } |
|
42 |
|
43 static bool instance_ok (void); |
|
44 |
|
45 static int lookup (const std::string& name); |
|
46 |
|
47 static Octave_map list (void); |
|
48 |
|
49 static int get (void) { return errno; } |
|
50 |
|
51 static int set (int val) |
|
52 { |
|
53 int retval = errno; |
|
54 errno = val; |
|
55 return retval; |
|
56 } |
|
57 |
|
58 private: |
|
59 |
|
60 std::map<std::string, int> errno_tbl; |
|
61 |
|
62 static octave_errno *instance; |
|
63 |
|
64 int do_lookup (const std::string& name); |
|
65 |
|
66 Octave_map do_list (void); |
|
67 }; |
|
68 |
|
69 #endif |
|
70 |
|
71 /* |
|
72 ;;; Local Variables: *** |
|
73 ;;; mode: C++ *** |
|
74 ;;; page-delimiter: "^/\\*" *** |
|
75 ;;; End: *** |
|
76 */ |