GNU Octave 11.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-2026 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
39
41{
42public:
43
45 : m_name (), m_passwd (), m_gid (0), m_mem (), m_valid (false)
46 { }
47
48 OCTAVE_DEFAULT_COPY_MOVE_DELETE (group)
49
50 std::string name () const;
51
52 std::string passwd () const;
53
54 gid_t gid () const;
55
56 string_vector mem () const;
57
58 bool ok () const { return m_valid; }
59
60 operator bool () const { return ok (); }
61
62 static group getgrent ();
63 static group getgrent (std::string& msg);
64
65 static group getgrgid (gid_t gid);
66 static group getgrgid (gid_t gid, std::string& msg);
67
68 static group getgrnam (const std::string& nm);
69 static group getgrnam (const std::string& nm, std::string& msg);
70
71 static int setgrent ();
72 static int setgrent (std::string& msg);
73
74 static int endgrent ();
75 static int endgrent (std::string& msg);
76
77private:
78
79 // The group name.
80 std::string m_name;
81
82 // The group password.
83 std::string m_passwd;
84
85 // The numeric group id.
86 gid_t m_gid;
87
88 // The members of the group;
89 string_vector m_mem;
90
91 // Flag that says whether we have been properly initialized.
92 bool m_valid;
93
94 // This is how we will create an group object from a pointer
95 // to a struct group.
96 group (void *p, std::string& msg);
97};
98
99OCTAVE_END_NAMESPACE(sys)
100OCTAVE_END_NAMESPACE(octave)
101
102#endif
bool ok() const
Definition oct-group.h:58
group()
Definition oct-group.h:44
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition main.in.cc:55