DCMTK  Version 3.6.6
OFFIS DICOM Toolkit
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
OFStandard::OFPasswd Class Reference

A non-POD version of "struct passwd" for thread- and memory-safe data access. More...

Public Member Functions

 OFPasswd ()
 default constructor that creates an invalid object.
 
OFBool operator! () const
 test if a OFPasswd object is invalid. More...
 
 operator OFBool () const
 test if a OFPasswd object is valid. More...
 

Public Attributes

OFString pw_name
 the username.
 
OFString pw_passwd
 the user password.
 
OFString pw_gecos
 the real name.
 
OFString pw_dir
 the home directory.
 
OFString pw_shell
 the shell program.
 
uid_t pw_uid
 the user ID.
 
gid_t pw_gid
 the group ID.
 

Private Member Functions

 OFPasswd (passwd *const p)
 the constructor that "sucks out" a struct passwd instance. More...
 

Private Attributes

OFBool ok
 internal state, OFTrue when valid.
 

Friends

class OFStandard
 only OFStandard may instantiate a valid object.
 

Detailed Description

A non-POD version of "struct passwd" for thread- and memory-safe data access.

Wraps the contents of a "struct passwd" instance to a non-POD object containing RAII-style data (e.g. OFString instead of const char*). To handle the old pointer behavior, OFPasswd objects can have an invalid state in which case all members are undefined. You can test whether an OFPasswd object is invalid or not with the overloaded operators "operator !" and "operator OFBool". Therefore, it behaves quite the same way as pointers in this regard.

Remarks
This class is only available if DCMTK detected a system offering support for the the <grp.h> header file.
Note
The downside of this non-POD class is that it leads to some unnecessary string copy operations. The resulting performance penalty should be insignificant. However, implementing this class based on auto_ptr / unique_ptr or using c++11 move semantics would prevent that, if somebody thinks it is necessary.

Constructor & Destructor Documentation

◆ OFPasswd()

OFStandard::OFPasswd::OFPasswd ( passwd *const  p)
private

the constructor that "sucks out" a struct passwd instance.

Parameters
pthe struct passwd instance to clone into this object.

Member Function Documentation

◆ operator OFBool()

OFStandard::OFPasswd::operator OFBool ( ) const

test if a OFPasswd object is valid.

Returns
OFTrue if the object is valid, otherwise OFFalse.

◆ operator!()

OFBool OFStandard::OFPasswd::operator! ( ) const

test if a OFPasswd object is invalid.

Returns
OFTrue if the object is invalid, otherwise OFFalse.

The documentation for this class was generated from the following file:


Generated on Thu Jan 14 2021 for DCMTK Version 3.6.6 by Doxygen 1.8.18