GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
oct-errno.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2005-2025 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_oct_errno_h)
27#define octave_oct_errno_h 1
28
29#include "octave-config.h"
30
31#include <cerrno>
32#include <map>
33#include <string>
34
35#include "oct-map.h"
36
38{
39protected:
40
41 octave_errno ();
42
43public:
44
45 OCTAVE_DISABLE_COPY_MOVE (octave_errno)
46
47 ~octave_errno () = default;
48
49 static bool instance_ok ();
50
51 static void cleanup_instance ()
52 { delete s_instance; s_instance = nullptr; }
53
54 static int lookup (const std::string& name);
55
56 static octave_scalar_map list ();
57
58 static int get () { return errno; }
59
60 static int set (int val)
61 {
62 int retval = errno;
63 errno = val;
64 return retval;
65 }
66
67private:
68
69 int do_lookup (const std::string& name);
70
71 octave_scalar_map do_list ();
72
73 //--------
74
75 std::map<std::string, int> m_errno_tbl;
76
77 static octave_errno *s_instance;
78};
79
80#endif
static int set(int val)
Definition oct-errno.h:60
static octave_scalar_map list()
static void cleanup_instance()
Definition oct-errno.h:51
static int lookup(const std::string &name)
static int get()
Definition oct-errno.h:58
~octave_errno()=default
static bool instance_ok()