Fix GetClients() const correctness

It’s dangerous to give a non-const reference to an internal
container that the API users are not supposed to modify.
This commit is contained in:
J-P Nurmi
2014-10-01 20:28:59 +02:00
parent 705e79f808
commit 4fe249280e
8 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -148,7 +148,7 @@ public:
CUser* GetUser() const { return m_pUser; }
void SetNetwork(CIRCNetwork* pNetwork, bool bDisconnect=true, bool bReconnect=true);
CIRCNetwork* GetNetwork() const { return m_pNetwork; }
std::vector<CClient*>& GetClients();
const std::vector<CClient*>& GetClients() const;
const CIRCSock* GetIRCSock() const;
CIRCSock* GetIRCSock();
CString GetFullName();
+1 -1
View File
@@ -74,7 +74,7 @@ public:
CUser* GetUser();
const CString& GetName() const;
bool IsNetworkAttached() const { return !m_vClients.empty(); }
std::vector<CClient*>& GetClients() { return m_vClients; }
const std::vector<CClient*>& GetClients() const { return m_vClients; }
void SetUser(CUser *pUser);
bool SetName(const CString& sName);
+1 -1
View File
@@ -141,8 +141,8 @@ public:
// !Setters
// Getters
std::vector<CClient*>& GetUserClients() { return m_vClients; }
std::vector<CClient*> GetAllClients();
const std::vector<CClient*>& GetUserClients() const { return m_vClients; }
const CString& GetUserName() const;
const CString& GetCleanUserName() const;
const CString& GetNick(bool bAllowDefault = true) const;