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 /sp/src/public/tier1/tier1.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 'sp/src/public/tier1/tier1.h')
| -rw-r--r-- | sp/src/public/tier1/tier1.h | 212 |
1 files changed, 106 insertions, 106 deletions
diff --git a/sp/src/public/tier1/tier1.h b/sp/src/public/tier1/tier1.h index 7e48c3c3..ac790673 100644 --- a/sp/src/public/tier1/tier1.h +++ b/sp/src/public/tier1/tier1.h @@ -1,106 +1,106 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose: A higher level link library for general use in the game and tools.
-//
-//===========================================================================//
-
-
-#ifndef TIER1_H
-#define TIER1_H
-
-#if defined( _WIN32 )
-#pragma once
-#endif
-
-#include "appframework/IAppSystem.h"
-#include "tier1/convar.h"
-
-
-//-----------------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------------
-class ICvar;
-class IProcessUtils;
-
-
-//-----------------------------------------------------------------------------
-// These tier1 libraries must be set by any users of this library.
-// They can be set by calling ConnectTier1Libraries.
-// It is hoped that setting this, and using this library will be the common mechanism for
-// allowing link libraries to access tier1 library interfaces
-//-----------------------------------------------------------------------------
-
-// These are marked DLL_EXPORT for Linux.
-DLL_EXPORT ICvar *cvar;
-extern ICvar *g_pCVar;
-extern IProcessUtils *g_pProcessUtils;
-
-
-//-----------------------------------------------------------------------------
-// Call this to connect to/disconnect from all tier 1 libraries.
-// It's up to the caller to check the globals it cares about to see if ones are missing
-//-----------------------------------------------------------------------------
-void ConnectTier1Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount );
-void DisconnectTier1Libraries();
-
-
-//-----------------------------------------------------------------------------
-// Helper empty implementation of an IAppSystem for tier2 libraries
-//-----------------------------------------------------------------------------
-template< class IInterface, int ConVarFlag = 0 >
-class CTier1AppSystem : public CTier0AppSystem< IInterface >
-{
- typedef CTier0AppSystem< IInterface > BaseClass;
-
-public:
- CTier1AppSystem( bool bIsPrimaryAppSystem = true ) : BaseClass( bIsPrimaryAppSystem )
- {
- }
-
- virtual bool Connect( CreateInterfaceFn factory )
- {
- if ( !BaseClass::Connect( factory ) )
- return false;
-
- if ( BaseClass::IsPrimaryAppSystem() )
- {
- ConnectTier1Libraries( &factory, 1 );
- }
- return true;
- }
-
- virtual void Disconnect()
- {
- if ( BaseClass::IsPrimaryAppSystem() )
- {
- DisconnectTier1Libraries();
- }
- BaseClass::Disconnect();
- }
-
- virtual InitReturnVal_t Init()
- {
- InitReturnVal_t nRetVal = BaseClass::Init();
- if ( nRetVal != INIT_OK )
- return nRetVal;
-
- if ( g_pCVar && BaseClass::IsPrimaryAppSystem() )
- {
- ConVar_Register( ConVarFlag );
- }
- return INIT_OK;
- }
-
- virtual void Shutdown()
- {
- if ( g_pCVar && BaseClass::IsPrimaryAppSystem() )
- {
- ConVar_Unregister( );
- }
- BaseClass::Shutdown( );
- }
-};
-
-
-#endif // TIER1_H
-
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: A higher level link library for general use in the game and tools. +// +//===========================================================================// + + +#ifndef TIER1_H +#define TIER1_H + +#if defined( _WIN32 ) +#pragma once +#endif + +#include "appframework/IAppSystem.h" +#include "tier1/convar.h" + + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +class ICvar; +class IProcessUtils; + + +//----------------------------------------------------------------------------- +// These tier1 libraries must be set by any users of this library. +// They can be set by calling ConnectTier1Libraries. +// It is hoped that setting this, and using this library will be the common mechanism for +// allowing link libraries to access tier1 library interfaces +//----------------------------------------------------------------------------- + +// These are marked DLL_EXPORT for Linux. +DLL_EXPORT ICvar *cvar; +extern ICvar *g_pCVar; +extern IProcessUtils *g_pProcessUtils; + + +//----------------------------------------------------------------------------- +// Call this to connect to/disconnect from all tier 1 libraries. +// It's up to the caller to check the globals it cares about to see if ones are missing +//----------------------------------------------------------------------------- +void ConnectTier1Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount ); +void DisconnectTier1Libraries(); + + +//----------------------------------------------------------------------------- +// Helper empty implementation of an IAppSystem for tier2 libraries +//----------------------------------------------------------------------------- +template< class IInterface, int ConVarFlag = 0 > +class CTier1AppSystem : public CTier0AppSystem< IInterface > +{ + typedef CTier0AppSystem< IInterface > BaseClass; + +public: + CTier1AppSystem( bool bIsPrimaryAppSystem = true ) : BaseClass( bIsPrimaryAppSystem ) + { + } + + virtual bool Connect( CreateInterfaceFn factory ) + { + if ( !BaseClass::Connect( factory ) ) + return false; + + if ( BaseClass::IsPrimaryAppSystem() ) + { + ConnectTier1Libraries( &factory, 1 ); + } + return true; + } + + virtual void Disconnect() + { + if ( BaseClass::IsPrimaryAppSystem() ) + { + DisconnectTier1Libraries(); + } + BaseClass::Disconnect(); + } + + virtual InitReturnVal_t Init() + { + InitReturnVal_t nRetVal = BaseClass::Init(); + if ( nRetVal != INIT_OK ) + return nRetVal; + + if ( g_pCVar && BaseClass::IsPrimaryAppSystem() ) + { + ConVar_Register( ConVarFlag ); + } + return INIT_OK; + } + + virtual void Shutdown() + { + if ( g_pCVar && BaseClass::IsPrimaryAppSystem() ) + { + ConVar_Unregister( ); + } + BaseClass::Shutdown( ); + } +}; + + +#endif // TIER1_H + |