00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_group_h)
00024 #define octave_group_h 1
00025
00026 #include <string>
00027
00028 #ifdef HAVE_SYS_TYPES_H
00029 #include <sys/types.h>
00030 #endif
00031
00032 #include "str-vec.h"
00033
00034 class
00035 octave_group
00036 {
00037 public:
00038
00039 octave_group (void)
00040 : gr_name (), gr_passwd (), gr_gid (0), gr_mem (), valid (false)
00041 { }
00042
00043 octave_group (const octave_group& gr)
00044 : gr_name (gr.gr_name), gr_passwd (gr.gr_passwd),
00045 gr_gid (gr.gr_gid), gr_mem (gr.gr_mem), valid (gr.valid)
00046 { }
00047
00048 octave_group& operator = (const octave_group& gr)
00049 {
00050 if (this != &gr)
00051 {
00052 gr_name = gr.gr_name;
00053 gr_passwd = gr.gr_passwd;
00054 gr_gid = gr.gr_gid;
00055 gr_mem = gr.gr_mem;
00056 valid = gr.valid;
00057 }
00058
00059 return *this;
00060 }
00061
00062 std::string name (void) const;
00063
00064 std::string passwd (void) const;
00065
00066 gid_t gid (void) const;
00067
00068 string_vector mem (void) const;
00069
00070 bool ok (void) const { return valid; }
00071
00072 operator bool () const { return ok (); }
00073
00074 static octave_group getgrent (void);
00075 static octave_group getgrent (std::string& msg);
00076
00077 static octave_group getgrgid (gid_t gid);
00078 static octave_group getgrgid (gid_t gid, std::string& msg);
00079
00080 static octave_group getgrnam (const std::string& nm);
00081 static octave_group getgrnam (const std::string& nm, std::string& msg);
00082
00083 static int setgrent (void);
00084 static int setgrent (std::string& msg);
00085
00086 static int endgrent (void);
00087 static int endgrent (std::string& msg);
00088
00089 private:
00090
00091
00092 std::string gr_name;
00093
00094
00095 std::string gr_passwd;
00096
00097
00098 gid_t gr_gid;
00099
00100
00101 string_vector gr_mem;
00102
00103
00104 bool valid;
00105
00106
00107
00108 octave_group (void *p, std::string& msg);
00109
00110 void gripe_invalid (void) const;
00111 };
00112
00113 #endif
00114
00115
00116
00117
00118
00119