Files
znc/Nick.h
psychon dd96f21d17 Make CNick smaller
This removes some not-so-important cache and uses a CString instead of a
set<unsigned char> for saving the flags this nick has (op, voice, ...).
set is huge!

Before the virtual removal (r1300), CNick had 144 bytes, without the virtuals
it only took 112 bytes. Now after this commit it is down to 40 bytes. (amd64)

Happy Christmas tomaw ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1302 726aef4b-f618-498e-8847-2d620e286838
2008-12-24 10:34:07 +00:00

65 lines
1.4 KiB
C++

/*
* Copyright (C) 2004-2008 See the AUTHORS file for details.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#ifndef _NICK_H
#define _NICK_H
#include "ZNCString.h"
#include <set>
#include <vector>
using std::vector;
using std::set;
// Forward Decl
class CUser;
class CChan;
// !Forward Decl
class CNick
{
public:
CNick();
CNick(const CString& sNick);
~CNick();
void Reset();
void Parse(const CString& sNickMask);
CString GetHostMask() const;
unsigned int GetCommonChans(vector<CChan*>& vChans, CUser* pUser) const;
static CString Concat(const CString& sNick, const CString& sSuffix, unsigned int uMaxNickLen = 9);
// Setters
void SetUser(CUser* pUser);
void SetNick(const CString& s);
void SetIdent(const CString& s);
void SetHost(const CString& s);
bool AddPerm(unsigned char uPerm);
bool RemPerm(unsigned char uPerm);
// !Setters
// Getters
CString GetPermStr() const;
unsigned char GetPermChar() const;
bool HasPerm(unsigned char uPerm) const;
const CString& GetNick() const;
const CString& GetIdent() const;
const CString& GetHost() const;
CString GetNickMask() const;
// !Getters
private:
protected:
CString m_sChanPerms;
CUser* m_pUser;
CString m_sNick;
CString m_sIdent;
CString m_sHost;
};
#endif // !_NICK_H