GNU Octave 7.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-2022 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
33namespace octave
34{
35 namespace sys
36 {
37 class
39 uname
40 {
41 public:
42
43 uname (void)
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 (void) = default;
75
76 std::string sysname (void) const { return m_sysname; }
77 std::string nodename (void) const { return m_nodename; }
78 std::string release (void) const { return m_release; }
79 std::string version (void) const { return m_version; }
80 std::string machine (void) const { return m_machine; }
81
82 std::string message (void) const { return m_errmsg; }
83 int error (void) 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;
95
96 void init (void);
97 };
98 }
99}
100
101#endif
std::string m_nodename
Definition: oct-uname.h:88
std::string machine(void) const
Definition: oct-uname.h:80
std::string m_release
Definition: oct-uname.h:89
std::string release(void) const
Definition: oct-uname.h:78
std::string nodename(void) const
Definition: oct-uname.h:77
std::string version(void) const
Definition: oct-uname.h:79
uname(const uname &unm)
Definition: oct-uname.h:50
std::string m_version
Definition: oct-uname.h:90
std::string message(void) const
Definition: oct-uname.h:82
std::string m_errmsg
Definition: oct-uname.h:93
~uname(void)=default
int error(void) const
Definition: oct-uname.h:83
std::string m_sysname
Definition: oct-uname.h:87
std::string sysname(void) const
Definition: oct-uname.h:76
std::string m_machine
Definition: oct-uname.h:91
#define OCTAVE_API
Definition: main.in.cc:55