KCoreAddons

KUserOrGroupId< T > Struct Template Reference

#include <kuser.h>

Inheritance diagram for KUserOrGroupId< T >:

Public Types

typedef T NativeType
 

Public Member Functions

bool isValid () const
 
template<>
bool isValid () const
 
NativeType nativeId () const
 
template<>
void * nativeId () const
 
bool operator!= (const KUserOrGroupId &other) const
 
template<>
bool operator!= (const KUserOrGroupId< void * > &other) const
 
bool operator== (const KUserOrGroupId &other) const
 
template<>
bool operator== (const KUserOrGroupId< void * > &other) const
 
QString toString () const
 
template<>
QString toString () const
 

Protected Member Functions

 KUserOrGroupId ()
 
 KUserOrGroupId (NativeType nativeId)
 
 KUserOrGroupId (const KUserOrGroupId< T > &other)
 
template<>
 KUserOrGroupId (const KUserOrGroupId< void * > &other)
 
template<>
 KUserOrGroupId (void *nativeId)
 
KUserOrGroupIdoperator= (const KUserOrGroupId< T > &other)
 
template<>
KUserOrGroupId< void * > & operator= (const KUserOrGroupId< void * > &other)
 

Detailed Description

template<typename T>
struct KUserOrGroupId< T >

A platform independent user or group ID.

This struct is required since Windows does not have an integer uid_t/gid_t type but instead uses an opaque binary blob (SID) which must free allocated memory. On UNIX this is simply a uid_t/gid_t and all operations are inline, so there is no runtime overhead over using the uid_t/gid_t directly. On Windows this is an implicitly shared class that frees the underlying SID once no more references remain.

Unlike KUser/KUserGroup this does not query additional information, it is simply an abstraction over the native user/group ID type. If more information is necessary, a KUser or KUserGroup instance can be constructed from this ID

Author
Alex Richardson arich[email protected]ards[email protected]on.kd[email protected][email protected][email protected]ail.c[email protected]om

Definition at line 59 of file kuser.h.

Constructor & Destructor Documentation

template<typename T >
KUserOrGroupId< T >::KUserOrGroupId ( )
inlineprotected

Creates an invalid KUserOrGroupId.

Definition at line 595 of file kuser.h.

template<typename T>
KUserOrGroupId< T >::KUserOrGroupId ( NativeType  nativeId)
explicitprotected

Creates a KUserOrGroupId from a native user/group ID.

On windows this will not take ownership over the passed SID, a copy will be created instead.

template<typename T>
KUserOrGroupId< T >::KUserOrGroupId ( const KUserOrGroupId< T > &  other)
inlineprotected

Copy constructor.

This is very fast, objects can be passed by value

Definition at line 605 of file kuser.h.

Member Function Documentation

template<typename T >
bool KUserOrGroupId< T >::isValid ( ) const
inline
Returns
true if this object references a valid user/group ID.
Note
If this returns true it doesn't necessarily mean that the referenced user/group exists, it only checks whether this value could be a valid user/group ID.

Definition at line 570 of file kuser.h.

template<typename T >
KUserOrGroupId< T >::NativeType KUserOrGroupId< T >::nativeId ( ) const
inline
Returns
A user/group ID that can be used in operating system specific functions
Note
On Windows the returned pointer will be freed once the last KUserOrGroupId referencing this user/group ID is deleted. Make sure that the KUserOrGroupId object remains valid as long as the native pointer is needed.

Definition at line 585 of file kuser.h.

template<typename T >
bool KUserOrGroupId< T >::operator!= ( const KUserOrGroupId< T > &  other) const
inline
Returns
whether this KUserOrGroupId is not equal to other

Definition at line 580 of file kuser.h.

template<typename T >
bool KUserOrGroupId< T >::operator== ( const KUserOrGroupId< T > &  other) const
inline
Returns
whether this KUserOrGroupId is equal to other

Definition at line 575 of file kuser.h.

template<typename T >
QString KUserOrGroupId< T >::toString ( ) const
inline
Returns
A string representation of this user ID, not the name of the user On UNIX this is a simple integer, e.g. "0" for root. On Windows this is a string like e.g. "S-1-5-32-544" for the Administrators group

Definition at line 590 of file kuser.h.


The documentation for this struct was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Nov 27 2020 23:03:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.