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

oct-passwd.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_passwd_h)
00024 #define octave_passwd_h 1
00025 
00026 #include <string>
00027 
00028 #ifdef HAVE_SYS_TYPES_H
00029 #include <sys/types.h>
00030 #endif
00031 
00032 class
00033 octave_passwd
00034 {
00035 public:
00036 
00037   octave_passwd (void)
00038     : pw_name (), pw_passwd (), pw_uid (0), pw_gid (0), pw_gecos (),
00039       pw_dir (), pw_shell (), valid (false)
00040   { }
00041 
00042   octave_passwd (const octave_passwd& pw)
00043     : pw_name (pw.pw_name), pw_passwd (pw.pw_passwd),
00044       pw_uid (pw.pw_uid), pw_gid (pw.pw_gid), pw_gecos (pw.pw_gecos),
00045       pw_dir (pw.pw_dir), pw_shell (pw.pw_shell), valid (pw.valid)
00046   { }
00047 
00048   octave_passwd& operator = (const octave_passwd& pw)
00049   {
00050     if (this != &pw)
00051       {
00052         pw_name = pw.pw_name;
00053         pw_passwd = pw.pw_passwd;
00054         pw_uid = pw.pw_uid;
00055         pw_gid = pw.pw_gid;
00056         pw_gecos = pw.pw_gecos;
00057         pw_dir = pw.pw_dir;
00058         pw_shell = pw.pw_shell;
00059         valid = pw.valid;
00060       }
00061 
00062     return *this;
00063   }
00064 
00065   ~octave_passwd (void) { }
00066 
00067   std::string name (void) const;
00068 
00069   std::string passwd (void) const;
00070 
00071   uid_t uid (void) const;
00072 
00073   gid_t gid (void) const;
00074 
00075   std::string gecos (void) const;
00076 
00077   std::string dir (void) const;
00078 
00079   std::string shell (void) const;
00080 
00081   bool ok (void) const { return valid; }
00082 
00083   operator bool () const { return ok (); }
00084 
00085   static octave_passwd getpwent (void);
00086   static octave_passwd getpwent (std::string& msg);
00087 
00088   static octave_passwd getpwuid (uid_t uid);
00089   static octave_passwd getpwuid (uid_t uid, std::string& msg);
00090 
00091   static octave_passwd getpwnam (const std::string& nm);
00092   static octave_passwd getpwnam (const std::string& nm, std::string& msg);
00093 
00094   static int setpwent (void);
00095   static int setpwent (std::string& msg);
00096 
00097   static int endpwent (void);
00098   static int endpwent (std::string& msg);
00099 
00100 private:
00101 
00102   // User name.
00103   std::string pw_name;
00104 
00105   // Encrypted password.
00106   std::string pw_passwd;
00107 
00108   // Numeric user id.
00109   uid_t pw_uid;
00110 
00111   // Numeric group id.
00112   gid_t pw_gid;
00113 
00114   // Miscellaneous junk.
00115   std::string pw_gecos;
00116 
00117   // Home directory.
00118   std::string pw_dir;
00119 
00120   // Login shell.
00121   std::string pw_shell;
00122 
00123   // Flag that says whether we have been properly initialized.
00124   bool valid;
00125 
00126   // This is how we will create an octave_passwd object from a pointer
00127   // to a struct passwd.
00128   octave_passwd (void *p, std::string& msg);
00129 
00130   void gripe_invalid (void) const;
00131 };
00132 
00133 #endif
00134 
00135 /*
00136 ;;; Local Variables: ***
00137 ;;; mode: C++ ***
00138 ;;; End: ***
00139 */

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