# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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  *  This library is free software; you can redistribute it and/or
    00008  *  modify it under the terms of the GNU Library General Public
    00009  *  License as published by the Free Software Foundation; either
    00010  *  version 2 of the License, or (at your option) any later version.
    00011  *
    00012  *  This library is distributed in the hope that it will be useful,
    00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  *  Library General Public License for more details.
    00016  *
    00017  *  You should have received a copy of the GNU Library General Public License
    00018  *  along with this library; see the file COPYING.LIB.  If not, write to
    00019  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00020  *  Boston, MA 02111-1307, USA.
    00021  */
    00022 #ifndef KUSER_H
    00023 #define KUSER_H
    00024
    00025 #include "ksharedptr.h"
    00026
    00027 class KUserGroup;
    00028 class QString;
    00029 class QStringList;
    00030 class KUserPrivate;
    00031 struct passwd;
    00032 template <class T> class QValueList;
    00033
    00045 class KDECORE_EXPORT KUser {
    00046
    00047 public:
    00048
    00049   enum UIDMode {
    00050     UseEffectiveUID,
    00051     UseRealUserID
    00052   };
    00053
    00067   // XXX KDE4: Make this explicit
    00068   KUser(UIDMode mode = UseEffectiveUID);
    00069
    00075   // XXX KDE4: Make this explicit; give parameter as uid_t instead of "long"
    00076   KUser(long uid);
    00077
    00084   // XXX KDE4: Make this explicit
    00085   KUser(const QString& name);
    00086
    00093   // XXX KDE4: Make this explicit
    00094   KUser(const char *name);
    00095
    00102   // XXX KDE4: Make this explicit
    00103   KUser(struct passwd *p);
    00104
    00109   KUser(const KUser & user);
    00110
    00116   KUser& operator =(const KUser& user);
    00117
    00122   bool operator ==(const KUser& user) const;
    00123
    00128   bool operator !=(const KUser &user) const;
    00129
    00135   bool isValid() const;
    00136
    00141   // XXX KDE4: Make this return uid_t
    00142   long uid() const;
    00143
    00144
    00149   // XXX KDE4: Make this return gid_t
    00150   long gid() const;
    00151
    00156   bool isSuperUser() const;
    00157
    00162   QString loginName() const;
    00163
    00168   QString fullName() const;
    00169
    00175   QString roomNumber() const;
    00176
    00182   QString workPhone() const;
    00183
    00189   QString homePhone() const;
    00190
    00196   QString homeDir() const;
    00197
    00203   QString shell() const;
    00204
    00209   QValueList<KUserGroup> groups() const;
    00210
    00215   QStringList groupNames() const;
    00216
    00217
    00221   ~KUser();
    00222
    00227   static QValueList<KUser> allUsers();
    00228
    00233   static QStringList allUserNames();
    00234
    00235 private:
    00236   KSharedPtr<KUserPrivate> d;
    00237   void fillPasswd(struct passwd* p);
    00238   void fillName(const char* name);
    00239 };
    00240
    00241 class KUserGroupPrivate;
    00242
    00243 struct group;
    00244
    00256 class KDECORE_EXPORT KUserGroup {
    00257
    00258 public:
    00259
    00270   explicit KUserGroup(KUser::UIDMode mode = KUser::UseEffectiveUID);
    00271
    00277   // XXX KDE4: Give parameter as gid_t instead of "long"
    00278   explicit KUserGroup(long gid);
    00279
    00285   explicit KUserGroup(const QString& name);
    00286
    00292   explicit KUserGroup(const char *name);
    00293
    00299   explicit KUserGroup(struct group *g);
    00300
    00305   KUserGroup(const KUserGroup & group);
    00306
    00312   KUserGroup& operator =(const KUserGroup& group);
    00313
    00319   bool operator ==(const KUserGroup& group) const;
    00320
    00326   bool operator !=(const KUserGroup& group) const;
    00327
    00334   bool isValid() const;
    00335
    00340   // XXX KDE4: Return gid_t instead of "long"
    00341   long gid() const;
    00342
    00347   QString name() const;
    00348
    00353   const QValueList<KUser>& users() const;
    00354
    00359   QStringList userNames() const;
    00360
    00361
    00365   ~KUserGroup();
    00366
    00370   static QValueList<KUserGroup> allGroups();
    00371
    00375   static QStringList allGroupNames();
    00376
    00377 private:
    00378   KSharedPtr<KUserGroupPrivate> d;
    00379   void fillGroup(struct group* g);
    00380   void fillName(const char* name);
    00381 };
    00382
    00383
    00384 #endif

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:12 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003