kdecore Library API Documentation

kuser.h

00001 /* 00002 * KUser - represent a user/account 00003 * Copyright (C) 2002-2003 Tim Jansen <tim@tjansen.de> 00004 * Copyright (C) 2003 Oswald Buddenhagen <ossi@kde.org> 00005 * Copyright (C) 2004 Jan Schaefer <j_schaef@informatik.uni-kl.de> 00006 * 00007 * $Id: kuser.h,v 1.9 2004/06/11 10:22:21 raabe Exp $ 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Library General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Library General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Library General Public License 00020 * along with this library; see the file COPYING.LIB. If not, write to 00021 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00022 * Boston, MA 02111-1307, USA. 00023 */ 00024 #ifndef KUSER_H 00025 #define KUSER_H 00026 00027 #include "ksharedptr.h" 00028 00029 class KUserGroup; 00030 class QString; 00031 class QStringList; 00032 class KUserPrivate; 00033 struct passwd; 00034 template <class T> class QValueList; 00035 00047 class KUser { 00048 00049 public: 00050 00051 enum UIDMode { 00052 UseEffectiveUID, 00053 UseRealUserID 00054 }; 00055 00066 // XXX KDE4: Make this explicit 00067 KUser(UIDMode mode = UseEffectiveUID); 00068 00074 // XXX KDE4: Make this explicit 00075 KUser(long uid); 00076 00083 // XXX KDE4: Make this explicit 00084 KUser(const QString& name); 00085 00092 // XXX KDE4: Make this explicit 00093 KUser(const char *name); 00094 00101 // XXX KDE4: Make this explicit 00102 KUser(struct passwd *p); 00103 00108 KUser(const KUser & user); 00109 00115 KUser& operator =(const KUser& user); 00116 00121 bool operator ==(const KUser& user) const; 00122 00127 bool operator !=(const KUser &user) const; 00128 00134 bool isValid() const; 00135 00140 long uid() const; 00141 00142 00147 long gid() const; 00148 00153 bool isSuperUser() const; 00154 00159 QString loginName() const; 00160 00165 QString fullName() const; 00166 00172 QString roomNumber() const; 00173 00179 QString workPhone() const; 00180 00186 QString homePhone() const; 00187 00193 QString homeDir() const; 00194 00200 QString shell() const; 00201 00206 QValueList<KUserGroup> groups() const; 00207 00212 QStringList groupNames() const; 00213 00214 00218 ~KUser(); 00219 00224 static QValueList<KUser> allUsers(); 00225 00230 static QStringList allUserNames(); 00231 00232 private: 00233 KSharedPtr<KUserPrivate> d; 00234 void fillPasswd(struct passwd* p); 00235 void fillName(const char* name); 00236 }; 00237 00238 class KUserGroupPrivate; 00239 00240 struct group; 00241 00253 class KUserGroup { 00254 00255 public: 00256 00265 explicit KUserGroup(KUser::UIDMode mode = KUser::UseEffectiveUID); 00266 00272 explicit KUserGroup(long gid); 00273 00279 explicit KUserGroup(const QString& name); 00280 00286 explicit KUserGroup(const char *name); 00287 00293 explicit KUserGroup(struct group *g); 00294 00299 KUserGroup(const KUserGroup & group); 00300 00306 KUserGroup& operator =(const KUserGroup& group); 00307 00313 bool operator ==(const KUserGroup& group) const; 00314 00320 bool operator !=(const KUserGroup& group) const; 00321 00328 bool isValid() const; 00329 00334 long gid() const; 00335 00340 QString name() const; 00341 00346 const QValueList<KUser>& users() const; 00347 00352 QStringList userNames() const; 00353 00354 00358 ~KUserGroup(); 00359 00363 static QValueList<KUserGroup> allGroups(); 00364 00368 static QStringList allGroupNames(); 00369 00370 private: 00371 KSharedPtr<KUserGroupPrivate> d; 00372 void fillGroup(struct group* g); 00373 void fillName(const char* name); 00374 }; 00375 00376 00377 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:40:10 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003