Mercurial > hg > octave-jordi
annotate liboctave/oct-group.h @ 10738:a4b8364e04c7
wavread.m: Correctly handle non-word aligned chunks (bug #30309).
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Fri, 02 Jul 2010 14:28:39 -0700 |
parents | cbc402e64d83 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
2937 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 2000, 2005, 2006, 2007 John W. Eaton |
2937 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2937 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2937 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_group_h) | |
24 #define octave_group_h 1 | |
25 | |
26 #include <string> | |
27 | |
28 #include <sys/types.h> | |
29 | |
30 #include "str-vec.h" | |
31 | |
32 class | |
6108 | 33 OCTAVE_API |
2937 | 34 octave_group |
35 { | |
36 public: | |
37 | |
38 octave_group (void) | |
39 : gr_name (), gr_passwd (), gr_gid (0), gr_mem (), valid (false) | |
40 { } | |
41 | |
42 octave_group (const octave_group& gr) | |
43 : gr_name (gr.gr_name), gr_passwd (gr.gr_passwd), | |
44 gr_gid (gr.gr_gid), gr_mem (gr.gr_mem), valid (gr.valid) | |
45 { } | |
46 | |
47 octave_group& operator = (const octave_group& gr) | |
48 { | |
49 if (this != &gr) | |
50 { | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
51 gr_name = gr.gr_name; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
52 gr_passwd = gr.gr_passwd; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
53 gr_gid = gr.gr_gid; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
54 gr_mem = gr.gr_mem; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
55 valid = gr.valid; |
2937 | 56 } |
57 | |
58 return *this; | |
59 } | |
60 | |
3504 | 61 std::string name (void) const; |
2937 | 62 |
3504 | 63 std::string passwd (void) const; |
2937 | 64 |
65 gid_t gid (void) const; | |
66 | |
67 string_vector mem (void) const; | |
68 | |
69 bool ok (void) const { return valid; } | |
70 | |
3145 | 71 operator bool () const { return ok (); } |
2937 | 72 |
73 static octave_group getgrent (void); | |
3504 | 74 static octave_group getgrent (std::string& msg); |
2937 | 75 |
76 static octave_group getgrgid (gid_t gid); | |
3504 | 77 static octave_group getgrgid (gid_t gid, std::string& msg); |
2937 | 78 |
3504 | 79 static octave_group getgrnam (const std::string& nm); |
80 static octave_group getgrnam (const std::string& nm, std::string& msg); | |
2937 | 81 |
82 static int setgrent (void); | |
3504 | 83 static int setgrent (std::string& msg); |
2937 | 84 |
85 static int endgrent (void); | |
3504 | 86 static int endgrent (std::string& msg); |
2937 | 87 |
88 private: | |
89 | |
90 // The group name. | |
3504 | 91 std::string gr_name; |
2937 | 92 |
93 // The group password. | |
3504 | 94 std::string gr_passwd; |
2937 | 95 |
96 // The numeric group id. | |
97 gid_t gr_gid; | |
98 | |
99 // The members of the group; | |
100 string_vector gr_mem; | |
101 | |
102 // Flag that says whether we have been properly initialized. | |
103 bool valid; | |
104 | |
105 // This is how we will create an octave_group object from a pointer | |
106 // to a struct group. | |
3504 | 107 octave_group (void *p, std::string& msg); |
2937 | 108 |
109 void gripe_invalid (void) const; | |
110 }; | |
111 | |
112 #endif |