![]() |
ircproxy The Ultimate Cyborg |
00001 // ircproxy -- An IRC bouncer. 00002 // 00003 //! @file Flags.h 00004 //! @brief This file contains the declaration of class Flags. 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 FLAGS_H 00017 #define FLAGS_H 00018 00019 #ifndef USE_PCH 00020 #include <string> 00021 #endif 00022 00023 #include "Network.h" 00024 00025 //! @brief A class to store the relevant part of the flags field from a WHO reply. 00026 class Flags { 00027 private: 00028 unsigned int M_flags; //!< A mask for the user mode flags. 00029 Network const* M_network; //!< A pointer to the corresponding network, or NULL when this object is not initialized. 00030 00031 public: 00032 //! Construct an uninitialized Flags object. 00033 Flags(void) : M_network(NULL) { } 00034 //! Construct an initialized Flags object for network \a network and string \a who_flags. 00035 Flags(Network const& network, std::string const& who_flags) { assign(network, who_flags); } 00036 //! Copy constructor. 00037 Flags(Flags const& flags) : M_flags(flags.M_flags), M_network(flags.M_network) { } 00038 //! Assignment operator. 00039 Flags& operator=(Flags const& flags) { M_flags = flags.M_flags; M_network = flags.M_network; return *this; } 00040 00041 //! (Re)initialize this object for network \a network and string \a who_flags. 00042 void assign(Network const& network, std::string const& who_flags); 00043 00044 //! Reassign \a who_flags to this object without changing the network. 00045 Flags& operator=(std::string const& who_flags) { ASSERT(is_initialized()); assign(*M_network, who_flags); return *this; } 00046 00047 //! Returns true if this object is initialized. 00048 bool is_initialized(void) const { return M_network; } 00049 }; 00050 00051 #endif // FLAGS_H
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|