Add some 'const' attributes to various functions

No real changes in here, only way more constness...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1129 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-07-14 08:13:06 +00:00
parent 4a62fca388
commit 86924339a3
8 changed files with 27 additions and 27 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ CBufLine::CBufLine(const CString& sPre, const CString& sPost, bool bIncNick=true
CBufLine::~CBufLine() {}
void CBufLine::GetLine(const CString& sTarget, CString& sRet) {
void CBufLine::GetLine(const CString& sTarget, CString& sRet) const {
if (m_bIncNick)
sRet = m_sPre + sTarget + m_sPost;
else
@@ -54,7 +54,7 @@ int CBuffer::UpdateLine(const CString& sPre, const CString& sPost, bool bIncNick
return AddLine(sPre, sPost, bIncNick);
}
bool CBuffer::GetLine(const CString& sTarget, CString& sRet, unsigned int uIdx) {
bool CBuffer::GetLine(const CString& sTarget, CString& sRet, unsigned int uIdx) const {
if (uIdx >= size()) {
return false;
}
+3 -3
View File
@@ -18,7 +18,7 @@ class CBufLine {
public:
CBufLine(const CString& sPre, const CString& sPost, bool bIncNick);
virtual ~CBufLine();
void GetLine(const CString& sTarget, CString& sRet);
void GetLine(const CString& sTarget, CString& sRet) const;
const CString& GetPre() const { return m_sPre; }
const CString& GetPost() const { return m_sPost; }
@@ -44,8 +44,8 @@ public:
/// Same as AddLine, but if there is already a line with sPre it is replaced.
int UpdateLine(const CString& sPre, const CString& sPost, bool bIncNick = true);
bool GetNextLine(const CString& sTarget, CString& sRet);
bool GetLine(const CString& sTarget, CString& sRet, unsigned int uIdx);
bool IsEmpty() { return empty(); }
bool GetLine(const CString& sTarget, CString& sRet, unsigned int uIdx) const;
bool IsEmpty() const { return empty(); }
void Clear() { clear(); }
// Setters
+2 -2
View File
@@ -486,8 +486,8 @@ bool CChan::AddNick(const CString& sNick) {
return true;
}
unsigned int CChan::GetPermCount(unsigned char uPerm) {
map<unsigned char, unsigned int>::iterator it = m_muuPermCount.find(uPerm);
unsigned int CChan::GetPermCount(unsigned char uPerm) const {
map<unsigned char, unsigned int>::const_iterator it = m_muuPermCount.find(uPerm);
return (it == m_muuPermCount.end()) ? 0 : it->second;
}
+2 -2
View File
@@ -127,7 +127,7 @@ public:
bool HasMode(unsigned char uMode) const;
CString GetOptions() const;
CString GetModeArg(unsigned char uMode) const;
unsigned int GetPermCount(unsigned char uPerm);
unsigned int GetPermCount(unsigned char uPerm) const;
bool IsOn() const { return m_bIsOn; }
const CString& GetName() const { return m_sName; }
const map<unsigned char, CString>& GetModes() const { return m_musModes; }
@@ -148,7 +148,7 @@ public:
bool InConfig() const { return m_bInConfig; }
unsigned long GetCreationDate() const { return m_ulCreationDate; }
bool IsDisabled() const { return m_bDisabled; }
unsigned int GetJoinTries() { return m_uJoinTries; }
unsigned int GetJoinTries() const { return m_uJoinTries; }
// !Getters
private:
protected:
+5 -5
View File
@@ -455,7 +455,7 @@ bool CUser::AddAllowedHost(const CString& sHostMask) {
return true;
}
bool CUser::IsHostAllowed(const CString& sHostMask) {
bool CUser::IsHostAllowed(const CString& sHostMask) const {
if (m_ssAllowedHosts.empty()) {
return true;
}
@@ -684,7 +684,7 @@ void CUser::JoinChans() {
}
}
CServer* CUser::FindServer(const CString& sName) {
CServer* CUser::FindServer(const CString& sName) const {
for (unsigned int a = 0; a < m_vServers.size(); a++) {
CServer* pServer = m_vServers[a];
if (sName.CaseCmp(pServer->GetName()) == 0) {
@@ -785,7 +785,7 @@ bool CUser::AddServer(const CString& sName, unsigned short uPort, const CString&
return true;
}
bool CUser::IsLastServer() {
bool CUser::IsLastServer() const {
return (m_uServerIdx >= m_vServers.size());
}
@@ -801,7 +801,7 @@ CServer* CUser::GetNextServer() {
return m_vServers[m_uServerIdx++]; // Todo: cycle through these
}
CServer* CUser::GetCurrentServer() {
CServer* CUser::GetCurrentServer() const {
unsigned int uIdx = (m_uServerIdx) ? m_uServerIdx -1 : 0;
if (uIdx >= m_vServers.size()) {
@@ -811,7 +811,7 @@ CServer* CUser::GetCurrentServer() {
return m_vServers[uIdx];
}
bool CUser::CheckPass(const CString& sPass) {
bool CUser::CheckPass(const CString& sPass) const {
if (!m_bPassHashed) {
return (sPass == m_sPass);
}
+7 -7
View File
@@ -42,19 +42,19 @@ public:
bool AddChan(const CString& sName, bool bInConfig);
bool DelChan(const CString& sName);
void JoinChans();
CServer* FindServer(const CString& sName);
CServer* FindServer(const CString& sName) const;
bool DelServer(const CString& sName);
bool AddServer(const CString& sName, bool bIPV6 = false);
bool AddServer(const CString& sName, unsigned short uPort, const CString& sPass = "", bool bSSL = false, bool bIPV6 = false);
CServer* GetNextServer();
CServer* GetCurrentServer();
bool CheckPass(const CString& sPass);
CServer* GetCurrentServer() const;
bool CheckPass(const CString& sPass) const;
bool AddAllowedHost(const CString& sHostMask);
bool IsHostAllowed(const CString& sHostMask);
bool IsHostAllowed(const CString& sHostMask) const;
bool IsValid(CString& sErrMsg, bool bSkipPass = false) const;
static bool IsValidUserName(const CString& sUserName);
static CString MakeCleanUserName(const CString& sUserName);
bool IsLastServer();
bool IsLastServer() const;
bool ConnectPaused();
void DelClients();
@@ -86,12 +86,12 @@ public:
bool PutStatusNotice(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
bool IsUserAttached() { return (m_vClients.size() > 0); }
bool IsUserAttached() const { return (m_vClients.size() > 0); }
void UserConnected(CClient* pClient);
void UserDisconnected(CClient* pClient);
CString GetLocalIP();
bool IsIRCConnected() { return m_bIRCConnected; }
bool IsIRCConnected() const { return m_bIRCConnected; }
void IRCConnected(CIRCSock* pIRCSock);
void IRCDisconnected();
void CheckIRCConnect();
+3 -3
View File
@@ -94,7 +94,7 @@ CString CZNC::GetTag(bool bIncludeVersion) {
return szBuf;
}
CString CZNC::GetUptime() {
CString CZNC::GetUptime() const {
time_t now = time(NULL);
return CString::ToTimeStr(now - TimeStarted());
}
@@ -390,8 +390,8 @@ Csock* CZNC::FindSockByName(const CString& sSockName) {
return m_Manager.FindSockByName(sSockName);
}
bool CZNC::IsHostAllowed(const CString& sHostMask) {
for (map<CString,CUser*>::iterator a = m_msUsers.begin(); a != m_msUsers.end(); a++) {
bool CZNC::IsHostAllowed(const CString& sHostMask) const {
for (map<CString,CUser*>::const_iterator a = m_msUsers.begin(); a != m_msUsers.end(); a++) {
if (a->second->IsHostAllowed(sHostMask)) {
return true;
}
+3 -3
View File
@@ -100,7 +100,7 @@ public:
bool DeletePidFile();
CUser* GetUser(const CString& sUser);
Csock* FindSockByName(const CString& sSockName);
bool IsHostAllowed(const CString& sHostMask);
bool IsHostAllowed(const CString& sHostMask) const;
void InitDirs(const CString& sArgvPath, const CString& sDataDir);
bool OnBoot();
CString ExpandConfigPath(const CString& sConfigFile);
@@ -110,7 +110,7 @@ public:
bool RehashConfig(CString& sError);
static CString GetVersion();
static CString GetTag(bool bIncludeVersion = true);
CString GetUptime();
CString GetUptime() const;
// This returns the path to the .so and to the data dir
// which is where static data (webadmin skins) are saved
bool FindModPath(const CString& sModule, CString& sModPath,
@@ -139,7 +139,7 @@ public:
// !Setters
// Getters
bool GetNeedRehash() { return m_bNeedRehash; }
bool GetNeedRehash() const { return m_bNeedRehash; }
CSockManager& GetManager() { return m_Manager; }
#ifdef _MODULES
CGlobalModules& GetModules() { return *m_pModules; }