KIO
kacl.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2005 - 2007 Till Adam <adam@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KACL_H 00021 #define KACL_H 00022 00023 00024 #include <sys/types.h> 00025 #include <kio/global.h> 00026 00027 #include <QtCore/QPair> 00028 #include <QtCore/QList> 00029 00030 00031 typedef QPair<QString, unsigned short> ACLUserPermissions; 00032 typedef QList<ACLUserPermissions> ACLUserPermissionsList; 00033 typedef QList<ACLUserPermissions>::iterator ACLUserPermissionsIterator; 00034 typedef QList<ACLUserPermissions>::const_iterator ACLUserPermissionsConstIterator; 00035 00036 typedef QPair<QString, unsigned short> ACLGroupPermissions; 00037 typedef QList<ACLGroupPermissions> ACLGroupPermissionsList; 00038 typedef QList<ACLGroupPermissions>::iterator ACLGroupPermissionsIterator; 00039 typedef QList<ACLGroupPermissions>::const_iterator ACLGroupPermissionsConstIterator; 00040 00047 class KIO_EXPORT KACL 00048 { 00049 public: 00054 KACL( const QString & aclString ); 00055 00057 KACL( const KACL& rhs ); 00058 00063 KACL( mode_t basicPermissions ); 00064 00069 KACL(); 00070 00071 virtual ~KACL(); 00072 00073 KACL& operator=( const KACL& rhs ); 00074 00075 bool operator==( const KACL& rhs ) const; 00076 00077 bool operator!=( const KACL& rhs ) const; 00078 00083 bool isValid() const; 00084 00090 unsigned short ownerPermissions() const; 00091 00094 bool setOwnerPermissions( unsigned short ); 00095 00097 unsigned short owningGroupPermissions() const; 00098 00101 bool setOwningGroupPermissions( unsigned short ); 00102 00104 unsigned short othersPermissions() const; 00105 00108 bool setOthersPermissions( unsigned short ); 00109 00111 mode_t basePermissions() const; 00112 00120 bool isExtended() const; 00121 00126 unsigned short maskPermissions( bool &exists ) const; 00127 00132 bool setMaskPermissions( unsigned short ); 00133 00139 unsigned short namedUserPermissions( const QString& name, bool *exists ) const; 00140 00144 bool setNamedUserPermissions( const QString& name, unsigned short ); 00145 00150 ACLUserPermissionsList allUserPermissions() const; 00151 00156 bool setAllUserPermissions( const ACLUserPermissionsList &list ); 00157 00163 unsigned short namedGroupPermissions( const QString& name, bool *exists ) const; 00164 00168 bool setNamedGroupPermissions( const QString& name, unsigned short ); 00169 00175 ACLGroupPermissionsList allGroupPermissions() const; 00180 bool setAllGroupPermissions( const ACLGroupPermissionsList & ); 00181 00185 bool setACL( const QString &aclStr ); 00186 00191 QString asString() const; 00192 00193 protected: 00194 virtual void virtual_hook( int id, void* data ); 00195 private: 00196 class KACLPrivate; 00197 KACLPrivate* const d; 00198 KIO_EXPORT friend QDataStream & operator<< ( QDataStream & s, const KACL & a ); 00199 KIO_EXPORT friend QDataStream & operator>> ( QDataStream & s, KACL & a ); 00200 }; 00201 00202 KIO_EXPORT QDataStream & operator<< ( QDataStream & s, const KACL & a ); 00203 KIO_EXPORT QDataStream & operator>> ( QDataStream & s, KACL & a ); 00204 00205 #endif
KDE 4.6 API Reference