~gabriel1984sibiu/octave/octave

« back to all changes in this revision

Viewing changes to libinterp/corefcn/oct-errno.h

  • Committer: Grevutiu Gabriel
  • Date: 2014-01-02 13:05:54 UTC
  • Revision ID: gabriel1984sibiu@gmail.com-20140102130554-3r7ivdjln1ni6kcg
New version (3.8.0) from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// oct-errno.h.in
 
2
/*
 
3
 
 
4
Copyright (C) 2005-2013 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 3 of the License, or (at your
 
11
option) any 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, see
 
20
<http://www.gnu.org/licenses/>.
 
21
 
 
22
*/
 
23
 
 
24
#if !defined (octave_oct_errno_h)
 
25
#define octave_oct_errno_h 1
 
26
 
 
27
#include <cerrno>
 
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 void cleanup_instance (void) { delete instance; instance = 0; }
 
47
 
 
48
  static int lookup (const std::string& name);
 
49
 
 
50
  static octave_scalar_map list (void);
 
51
 
 
52
  static int get (void) { return errno; }
 
53
 
 
54
  static int set (int val)
 
55
  {
 
56
    int retval = errno;
 
57
    errno = val;
 
58
    return retval;
 
59
  }
 
60
 
 
61
private:
 
62
 
 
63
  std::map<std::string, int> errno_tbl;
 
64
 
 
65
  static octave_errno *instance;
 
66
 
 
67
  int do_lookup (const std::string& name);
 
68
 
 
69
  octave_scalar_map do_list (void);
 
70
};
 
71
 
 
72
#endif