GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-uname.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2005-2024 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_uname_h)
27 #define octave_oct_uname_h 1
28 
29 #include "octave-config.h"
30 
31 #include <string>
32 
34 
36 
37 class
39 uname
40 {
41 public:
42 
43  uname ()
44  : m_sysname ("unknown"), m_nodename ("unknown"),
45  m_release ("unknown"), m_version ("unknown"),
46  m_machine ("unknown"),
47  m_errmsg ("uname not supported on this system"), m_errno (-1)
48  { init (); }
49 
50  uname (const uname& unm)
51  : m_sysname (unm.m_sysname), m_nodename (unm.m_nodename),
52  m_release (unm.m_release), m_version (unm.m_version),
53  m_machine (unm.m_machine),
54  m_errmsg (unm.m_errmsg), m_errno (unm.m_errno)
55  { }
56 
57  uname& operator = (const uname& unm)
58  {
59  if (this != &unm)
60  {
61  m_sysname = unm.m_sysname;
62  m_nodename = unm.m_nodename;
63  m_release = unm.m_release;
64  m_version = unm.m_version;
65  m_machine = unm.m_machine;
66 
67  m_errmsg = unm.m_errmsg;
68  m_errno = unm.m_errno;
69  }
70 
71  return *this;
72  }
73 
74  ~uname () = default;
75 
76  std::string sysname () const { return m_sysname; }
77  std::string nodename () const { return m_nodename; }
78  std::string release () const { return m_release; }
79  std::string version () const { return m_version; }
80  std::string machine () const { return m_machine; }
81 
82  std::string message () const { return m_errmsg; }
83  int error () const { return m_errno; }
84 
85 private:
86 
87  std::string m_sysname;
88  std::string m_nodename;
89  std::string m_release;
90  std::string m_version;
91  std::string m_machine;
92 
93  std::string m_errmsg;
94  int m_errno;
95 
96  void init ();
97 };
98 
99 OCTAVE_END_NAMESPACE(sys)
100 OCTAVE_END_NAMESPACE(octave)
101 
102 #endif
std::string release() const
Definition: oct-uname.h:78
uname()
Definition: oct-uname.h:43
std::string version() const
Definition: oct-uname.h:79
std::string nodename() const
Definition: oct-uname.h:77
std::string message() const
Definition: oct-uname.h:82
~uname()=default
std::string machine() const
Definition: oct-uname.h:80
uname(const uname &unm)
Definition: oct-uname.h:50
int error() const
Definition: oct-uname.h:83
std::string sysname() const
Definition: oct-uname.h:76
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition: main.cc:55