1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-12-05 17:24:15 +01:00
HLMetaModOfficial/sourcehook/sourcehook_impl_cproto.h
Pavol Marko 7fdf6be5ac linux.gcc compat
--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40466
2007-10-07 22:24:01 +00:00

78 lines
1.4 KiB
C++

/* ======== SourceHook ========
* Copyright (C) 2004-2007 Metamod:Source Development Team
* No warranties of any kind
*
* License: zlib/libpng
*
* Author(s): Pavol "PM OnoTo" Marko
* ============================
*/
#ifndef __SOURCEHOOK_IMPL_CPROTO_H__
#define __SOURCEHOOK_IMPL_CPROTO_H__
namespace SourceHook
{
namespace Impl
{
class CProto
{
ProtoInfo *m_Proto;
static bool Equal(const ProtoInfo *p1, const ProtoInfo *p2);
static ProtoInfo *DupProto(const ProtoInfo *src);
static void FreeProto(ProtoInfo *prot);
public:
CProto() : m_Proto(NULL)
{
}
CProto(const ProtoInfo *pProto) : m_Proto(DupProto(pProto))
{
}
CProto(const CProto &other) : m_Proto(DupProto(other.m_Proto))
{
}
~CProto()
{
FreeProto(m_Proto);
m_Proto = NULL;
}
void operator = (const ProtoInfo *pProto)
{
if (m_Proto)
FreeProto(m_Proto);
m_Proto = DupProto(pProto);
}
void operator = (const CProto &other)
{
if (m_Proto)
FreeProto(m_Proto);
m_Proto = DupProto(other.m_Proto);
}
bool operator == (const ProtoInfo *pProto) const
{
return Equal(pProto, m_Proto);
}
bool operator == (const CProto &other) const
{
return Equal(other.m_Proto, m_Proto);
}
const ProtoInfo *GetProto() const
{
return m_Proto;
}
};
}
}
#endif