ircproxy The Ultimate Cyborg |
00001 // ircproxy -- An IRC bouncer. 00002 // 00003 //! @file IdentityReference.h 00004 //! @brief This file contains the declaration of class IdentityReference. 00005 // 00006 // Copyright (C) 2006, 2007 by 00007 // 00008 // Carlo Wood, Run on IRC <carlo@alinoe.com> 00009 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt 00010 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61 00011 // 00012 // This file may be distributed under the terms of the Q Public License 00013 // version 1.0 as appearing in the file LICENSE.QPL included in the 00014 // packaging of this file. 00015 00016 #ifndef IDENTITYREFERENCE_H 00017 #define IDENTITYREFERENCE_H 00018 00019 class Identity; 00020 00021 //! \brief Base class for classes that always are related to exactly one Identity. 00022 class IdentityReference { 00023 private: 00024 Identity* M_identity; //!< Pointer to the identity that this session is related to. 00025 00026 protected: 00027 //! Default constructor. 00028 IdentityReference(void) : M_identity(NULL) { } 00029 //! Construct an IdentityReference instance for identity \a identity. 00030 IdentityReference(Identity* identity) : M_identity(identity) { } 00031 00032 //! Initialize the underlying Identity pointer. 00033 void set_identity(Identity* identity) { ASSERT(!M_identity); M_identity = identity; } 00034 00035 public: 00036 //! Returns a const reference to the underlying identity. 00037 Identity const& identity(void) const { return *M_identity; } 00038 00039 //! Returns a reference to the underlying identity. 00040 Identity& identity(void) { return *M_identity; } 00041 00042 //! Returns true when this object is associated with an Identity. 00043 bool has_identity(void) const { return M_identity; } 00044 }; 00045 00046 #endif // IDENTITYREFERENCE_H
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|