diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/shared/ehandle.h | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/shared/ehandle.h')
| -rw-r--r-- | mp/src/game/shared/ehandle.h | 338 |
1 files changed, 169 insertions, 169 deletions
diff --git a/mp/src/game/shared/ehandle.h b/mp/src/game/shared/ehandle.h index 3430d7c0..7e44cf66 100644 --- a/mp/src/game/shared/ehandle.h +++ b/mp/src/game/shared/ehandle.h @@ -1,169 +1,169 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-
-#ifndef EHANDLE_H
-#define EHANDLE_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#if defined( _DEBUG ) && defined( GAME_DLL )
-#include "tier0/dbg.h"
-#include "cbase.h"
-#endif
-
-
-#include "const.h"
-#include "basehandle.h"
-#include "entitylist_base.h"
-
-
-class IHandleEntity;
-
-
-// -------------------------------------------------------------------------------------------------- //
-// Game-code CBaseHandle implementation.
-// -------------------------------------------------------------------------------------------------- //
-
-inline IHandleEntity* CBaseHandle::Get() const
-{
- extern CBaseEntityList *g_pEntityList;
- return g_pEntityList->LookupEntity( *this );
-}
-
-
-// -------------------------------------------------------------------------------------------------- //
-// CHandle.
-// -------------------------------------------------------------------------------------------------- //
-template< class T >
-class CHandle : public CBaseHandle
-{
-public:
-
- CHandle();
- CHandle( int iEntry, int iSerialNumber );
- CHandle( const CBaseHandle &handle );
- CHandle( T *pVal );
-
- // The index should have come from a call to ToInt(). If it hasn't, you're in trouble.
- static CHandle<T> FromIndex( int index );
-
- T* Get() const;
- void Set( const T* pVal );
-
- operator T*();
- operator T*() const;
-
- bool operator !() const;
- bool operator==( T *val ) const;
- bool operator!=( T *val ) const;
- const CBaseHandle& operator=( const T *val );
-
- T* operator->() const;
-};
-
-
-// ----------------------------------------------------------------------- //
-// Inlines.
-// ----------------------------------------------------------------------- //
-
-template<class T>
-CHandle<T>::CHandle()
-{
-}
-
-
-template<class T>
-CHandle<T>::CHandle( int iEntry, int iSerialNumber )
-{
- Init( iEntry, iSerialNumber );
-}
-
-
-template<class T>
-CHandle<T>::CHandle( const CBaseHandle &handle )
- : CBaseHandle( handle )
-{
-}
-
-
-template<class T>
-CHandle<T>::CHandle( T *pObj )
-{
- Term();
- Set( pObj );
-}
-
-
-template<class T>
-inline CHandle<T> CHandle<T>::FromIndex( int index )
-{
- CHandle<T> ret;
- ret.m_Index = index;
- return ret;
-}
-
-
-template<class T>
-inline T* CHandle<T>::Get() const
-{
- return (T*)CBaseHandle::Get();
-}
-
-
-template<class T>
-inline CHandle<T>::operator T *()
-{
- return Get( );
-}
-
-template<class T>
-inline CHandle<T>::operator T *() const
-{
- return Get( );
-}
-
-
-template<class T>
-inline bool CHandle<T>::operator !() const
-{
- return !Get();
-}
-
-template<class T>
-inline bool CHandle<T>::operator==( T *val ) const
-{
- return Get() == val;
-}
-
-template<class T>
-inline bool CHandle<T>::operator!=( T *val ) const
-{
- return Get() != val;
-}
-
-template<class T>
-void CHandle<T>::Set( const T* pVal )
-{
- CBaseHandle::Set( reinterpret_cast<const IHandleEntity*>(pVal) );
-}
-
-template<class T>
-inline const CBaseHandle& CHandle<T>::operator=( const T *val )
-{
- Set( val );
- return *this;
-}
-
-template<class T>
-T* CHandle<T>::operator -> () const
-{
- return Get();
-}
-
-
-#endif // EHANDLE_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef EHANDLE_H +#define EHANDLE_H +#ifdef _WIN32 +#pragma once +#endif + +#if defined( _DEBUG ) && defined( GAME_DLL ) +#include "tier0/dbg.h" +#include "cbase.h" +#endif + + +#include "const.h" +#include "basehandle.h" +#include "entitylist_base.h" + + +class IHandleEntity; + + +// -------------------------------------------------------------------------------------------------- // +// Game-code CBaseHandle implementation. +// -------------------------------------------------------------------------------------------------- // + +inline IHandleEntity* CBaseHandle::Get() const +{ + extern CBaseEntityList *g_pEntityList; + return g_pEntityList->LookupEntity( *this ); +} + + +// -------------------------------------------------------------------------------------------------- // +// CHandle. +// -------------------------------------------------------------------------------------------------- // +template< class T > +class CHandle : public CBaseHandle +{ +public: + + CHandle(); + CHandle( int iEntry, int iSerialNumber ); + CHandle( const CBaseHandle &handle ); + CHandle( T *pVal ); + + // The index should have come from a call to ToInt(). If it hasn't, you're in trouble. + static CHandle<T> FromIndex( int index ); + + T* Get() const; + void Set( const T* pVal ); + + operator T*(); + operator T*() const; + + bool operator !() const; + bool operator==( T *val ) const; + bool operator!=( T *val ) const; + const CBaseHandle& operator=( const T *val ); + + T* operator->() const; +}; + + +// ----------------------------------------------------------------------- // +// Inlines. +// ----------------------------------------------------------------------- // + +template<class T> +CHandle<T>::CHandle() +{ +} + + +template<class T> +CHandle<T>::CHandle( int iEntry, int iSerialNumber ) +{ + Init( iEntry, iSerialNumber ); +} + + +template<class T> +CHandle<T>::CHandle( const CBaseHandle &handle ) + : CBaseHandle( handle ) +{ +} + + +template<class T> +CHandle<T>::CHandle( T *pObj ) +{ + Term(); + Set( pObj ); +} + + +template<class T> +inline CHandle<T> CHandle<T>::FromIndex( int index ) +{ + CHandle<T> ret; + ret.m_Index = index; + return ret; +} + + +template<class T> +inline T* CHandle<T>::Get() const +{ + return (T*)CBaseHandle::Get(); +} + + +template<class T> +inline CHandle<T>::operator T *() +{ + return Get( ); +} + +template<class T> +inline CHandle<T>::operator T *() const +{ + return Get( ); +} + + +template<class T> +inline bool CHandle<T>::operator !() const +{ + return !Get(); +} + +template<class T> +inline bool CHandle<T>::operator==( T *val ) const +{ + return Get() == val; +} + +template<class T> +inline bool CHandle<T>::operator!=( T *val ) const +{ + return Get() != val; +} + +template<class T> +void CHandle<T>::Set( const T* pVal ) +{ + CBaseHandle::Set( reinterpret_cast<const IHandleEntity*>(pVal) ); +} + +template<class T> +inline const CBaseHandle& CHandle<T>::operator=( const T *val ) +{ + Set( val ); + return *this; +} + +template<class T> +T* CHandle<T>::operator -> () const +{ + return Get(); +} + + +#endif // EHANDLE_H |