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 |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
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 |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
21 02110-1301, USA. |
|
22 |
|
23 */ |
|
24 |
|
25 #if !defined (octave_errno_h) |
|
26 #define octave_errno_h 1 |
|
27 |
|
28 #include <map> |
|
29 #include <string> |
|
30 |
|
31 #include "oct-map.h" |
|
32 |
|
33 class |
|
34 octave_errno |
|
35 { |
|
36 protected: |
|
37 |
|
38 octave_errno (void); |
|
39 |
|
40 public: |
|
41 |
|
42 ~octave_errno (void) { } |
|
43 |
|
44 static bool instance_ok (void); |
|
45 |
|
46 static int lookup (const std::string& name); |
|
47 |
|
48 static Octave_map list (void); |
|
49 |
|
50 static int get (void) { return errno; } |
|
51 |
|
52 static int set (int val) |
|
53 { |
|
54 int retval = errno; |
|
55 errno = val; |
|
56 return retval; |
|
57 } |
|
58 |
|
59 private: |
|
60 |
|
61 std::map<std::string, int> errno_tbl; |
|
62 |
|
63 static octave_errno *instance; |
|
64 |
|
65 int do_lookup (const std::string& name); |
|
66 |
|
67 Octave_map do_list (void); |
|
68 }; |
|
69 |
|
70 #endif |
|
71 |
|
72 /* |
|
73 ;;; Local Variables: *** |
|
74 ;;; mode: C++ *** |
|
75 ;;; page-delimiter: "^/\\*" *** |
|
76 ;;; End: *** |
|
77 */ |