GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
oct-group.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-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_group_h)
27#define octave_oct_group_h 1
28
29#include "octave-config.h"
30
31#include <string>
32
33#include <sys/types.h>
34
35#include "str-vec.h"
36
38
40
42{
43public:
44
46 : m_name (), m_passwd (), m_gid (0), m_mem (), m_valid (false)
47 { }
48
49 OCTAVE_DEFAULT_COPY_MOVE_DELETE (group)
50
51 std::string name () const;
52
53 std::string passwd () const;
54
55 gid_t gid () const;
56
57 string_vector mem () const;
58
59 bool ok () const { return m_valid; }
60
61 operator bool () const { return ok (); }
62
63 static group getgrent ();
64 static group getgrent (std::string& msg);
65
66 static group getgrgid (gid_t gid);
67 static group getgrgid (gid_t gid, std::string& msg);
68
69 static group getgrnam (const std::string& nm);
70 static group getgrnam (const std::string& nm, std::string& msg);
71
72 static int setgrent ();
73 static int setgrent (std::string& msg);
74
75 static int endgrent ();
76 static int endgrent (std::string& msg);
77
78private:
79
80 // The group name.
81 std::string m_name;
82
83 // The group password.
84 std::string m_passwd;
85
86 // The numeric group id.
87 gid_t m_gid;
88
89 // The members of the group;
90 string_vector m_mem;
91
92 // Flag that says whether we have been properly initialized.
93 bool m_valid;
94
95 // This is how we will create an group object from a pointer
96 // to a struct group.
97 group (void *p, std::string& msg);
98};
99
100OCTAVE_END_NAMESPACE(sys)
101OCTAVE_END_NAMESPACE(octave)
102
103#endif
bool ok() const
Definition oct-group.h:59
group()
Definition oct-group.h:45
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition main.in.cc:55