メインページ   クラス階層   構成   ファイル一覧   構成メンバ   ファイルメンバ  

oct-group.h

解説を見る。
00001 /*
00002 
00003 Copyright (C) 1996, 1997 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 2, or (at your option) any
00010 later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, write to the Free
00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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   // The group name.
00092   std::string gr_name;
00093 
00094   // The group password.
00095   std::string gr_passwd;
00096 
00097   // The numeric group id.
00098   gid_t gr_gid;
00099 
00100   // The members of the group;
00101   string_vector gr_mem;
00102 
00103   // Flag that says whether we have been properly initialized.
00104   bool valid;
00105 
00106   // This is how we will create an octave_group object from a pointer
00107   // to a struct group.
00108   octave_group (void *p, std::string& msg);
00109 
00110   void gripe_invalid (void) const;
00111 };
00112 
00113 #endif
00114 
00115 /*
00116 ;;; Local Variables: ***
00117 ;;; mode: C++ ***
00118 ;;; End: ***
00119 */

Wed Dec 29 11:52:07 2004に生成されました。 doxygen1.2.18
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送