File indexing completed on 2024-04-21 15:42:51
0001 /*************************************************************************** 0002 Smb4K's container class for information about a workgroup. 0003 ------------------- 0004 begin : Sa Jan 26 2008 0005 copyright : (C) 2008-2017 by Alexander Reinholdt 0006 email : alexander.reinholdt@kdemail.net 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * This program is free software; you can redistribute it and/or modify * 0011 * it under the terms of the GNU General Public License as published by * 0012 * the Free Software Foundation; either version 2 of the License, or * 0013 * (at your option) any later version. * 0014 * * 0015 * This program is distributed in the hope that it will be useful, but * 0016 * WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0018 * General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program; if not, write to the * 0022 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,* 0023 * MA 02110-1335, USA * 0024 ***************************************************************************/ 0025 0026 #ifndef SMB4KWORKGROUP_H 0027 #define SMB4KWORKGROUP_H 0028 0029 // application specific includes 0030 #include "smb4kbasicnetworkitem.h" 0031 0032 // Qt includes 0033 #include <QString> 0034 #include <QScopedPointer> 0035 #include <QHostAddress> 0036 0037 0038 // forward declarations 0039 class Smb4KWorkgroupPrivate; 0040 0041 /** 0042 * This class is a container that carries information about a workgroup or 0043 * domain found in the network neighborhood. It is part of the core classes 0044 * of Smb4K. 0045 * 0046 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0047 */ 0048 0049 class Q_DECL_EXPORT Smb4KWorkgroup : public Smb4KBasicNetworkItem 0050 { 0051 friend class Smb4KWorkgroupPrivate; 0052 0053 public: 0054 /** 0055 * The default constructor. It takes the name of the workgroup as only 0056 * argument. You have to set all other information by the other functions 0057 * provided by this class. 0058 * 0059 * @param name The name of the workgroup or domain. 0060 */ 0061 explicit Smb4KWorkgroup(const QString &name); 0062 0063 /** 0064 * The copy constructor. This constructor takes another Smb4KWorkgroup item 0065 * as argument and copies its values. 0066 * 0067 * @param workgroup The Smb4KWorkgroup item that is to be copied. 0068 */ 0069 Smb4KWorkgroup(const Smb4KWorkgroup &workgroup); 0070 0071 /** 0072 * The empty constructor. It does not take any argument and you have to 0073 * set all information by the other functions provided by this class. 0074 */ 0075 Smb4KWorkgroup(); 0076 0077 /** 0078 * The destructor. 0079 */ 0080 ~Smb4KWorkgroup(); 0081 0082 /** 0083 * Sets the name of the workgroup. 0084 * 0085 * @param name The name of the workgroup 0086 */ 0087 void setWorkgroupName(const QString &name); 0088 0089 /** 0090 * This function returns the name of the workgroup. 0091 * 0092 * @returns the workgroup name. 0093 */ 0094 QString workgroupName() const; 0095 0096 /** 0097 * Sets the name of the master browser of this workgroup or domain. 0098 * 0099 * @param masterName The name of the master browser 0100 */ 0101 void setMasterBrowserName(const QString &name); 0102 0103 /** 0104 * Returns the name of the master browser of this workgroup or domain. 0105 * 0106 * @returns the name of the master browser. 0107 */ 0108 QString masterBrowserName() const; 0109 0110 /** 0111 * Set the IP address of the master browser. @p ip will only be accepted 0112 * if it is compatible with either IPv4 or IPv6. 0113 * 0114 * @param ip The master browser's IP address 0115 */ 0116 void setMasterBrowserIpAddress(const QString &ip); 0117 0118 /** 0119 * Set the IP address of the master browser. @p address will only be accepted 0120 * if it is compatible with either IPv4 or IPv6. 0121 * 0122 * @param address The master browser's IP address 0123 */ 0124 void setMasterBrowserIpAddress(const QHostAddress &address); 0125 0126 /** 0127 * Returns the IP address of the master browser of this workgroup 0128 * or domain. If the IP address was not compatible with IPv4 and 0129 * IPv6 or if no IP address was supplied, an empty string is returned. 0130 * 0131 * @returns the IP address of the master browser or an empty string. 0132 */ 0133 QString masterBrowserIpAddress() const; 0134 0135 /** 0136 * Returns TRUE if the workgroup/domain master browsers IP address is set and 0137 * FALSE otherwise. 0138 * 0139 * @returns TRUE if the master browsers IP address is known. 0140 */ 0141 bool hasMasterBrowserIpAddress() const; 0142 0143 /** 0144 * Updates the workgroup item if the workgroup name of @p workgroup and 0145 * of this item is equal. Otherwise it does nothing. 0146 * @param workgroup The workgroup object that is used to update 0147 * this object 0148 */ 0149 void update(Smb4KWorkgroup *workgroup); 0150 0151 private: 0152 const QScopedPointer<Smb4KWorkgroupPrivate> d; 0153 }; 0154 0155 #endif