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/game/server/textstatsmgr.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/game/server/textstatsmgr.h')
| -rw-r--r-- | sp/src/game/server/textstatsmgr.h | 266 |
1 files changed, 133 insertions, 133 deletions
diff --git a/sp/src/game/server/textstatsmgr.h b/sp/src/game/server/textstatsmgr.h index 620f8def..473e1a0e 100644 --- a/sp/src/game/server/textstatsmgr.h +++ b/sp/src/game/server/textstatsmgr.h @@ -1,133 +1,133 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-
-#ifndef TEXTSTATSMGR_H
-#define TEXTSTATSMGR_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-
-#include "filesystem.h"
-#include "utllinkedlist.h"
-
-
-// Text stats get to print their stuff by implementing this type of function.
-typedef void (*TextStatPrintFn)( IFileSystem *pFileSys, FileHandle_t hFile, void *pUserData );
-typedef void (*TextStatFileFn)();
-
-
-// The CTextStatsMgr is just a collection of CTextStat's that go into the same file.
-class CTextStatsMgr
-{
-public:
- CTextStatsMgr( void );
-
- // Write a file with all the registered stats.
- bool WriteFile( IFileSystem *pFileSystem, const char *pFilename = NULL );
-
- // Get the preset filename to write stats to, if none is specified when writing
- char *GetStatsFilename( void );
-
- // Set the filename to write stats to, if none is specified when writing
- void SetStatsFilename( char *sFilename );
-
-private:
- char m_szStatFilename[ MAX_PATH ];
-};
-
-
-// This is the default CTextStatsMgr, but there can be any number of them.
-extern CTextStatsMgr g_TextStatsMgr;
-
-
-
-// Make these to register text stat functions.
-class CTextStat
-{
-friend class CTextStatsMgr;
-
-public:
- CTextStat();
- CTextStat( TextStatPrintFn fn, void *pUserData, CTextStatsMgr *pMgr=&g_TextStatsMgr );
- ~CTextStat();
-
- // This can be called if you don't want to pass parameters into the constructor.
- void Init( TextStatPrintFn printFn, void *pUserData, CTextStatsMgr *pMgr=&g_TextStatsMgr );
- void Term();
-
-
-private:
-
- // Special constructor to just tie off the linked list.
- CTextStat( bool bGlobalListHead );
-
- // The global list of CTextStats.
- static CTextStat* GetTextStatsList();
-
- static void RemoveFn( void *pUserData );
-
- // Link it into the global list.
- CTextStat *m_pPrev;
- CTextStat *m_pNext;
-
- CTextStatsMgr *m_pMgr;
-
- TextStatPrintFn m_PrintFn;
- void *m_pUserData;
-};
-
-
-// This class registers like a ConVar and acts like an int. When the game is shutdown,
-// its value will be saved in the stats file along with its name.s
-class CTextStatInt
-{
-public:
- CTextStatInt( const char *pName, int initialValue=0, CTextStatsMgr *pMgr=&g_TextStatsMgr );
-
- operator int() const { return m_Value; }
- int operator=( int val ) { m_Value = val; return m_Value; }
-
- int operator++() { m_Value++; return m_Value; }
- int operator--() { m_Value--; return m_Value; }
- int operator+=( int val ) { m_Value += val; return m_Value; }
- int operator-=( int val ) { m_Value -= val; return m_Value; }
- int operator*=( int val ) { m_Value *= val; return m_Value; }
- int operator/=( int val ) { m_Value /= val; return m_Value; }
-
-
-private:
-
- static void PrintFn( IFileSystem *pFileSys, FileHandle_t hFile, void *pUserData );
-
-
-private:
-
- const char *m_pName;
- int m_Value;
-
- CTextStat m_Reg; // Use to register ourselves.
-};
-
-
-// This can be registered to get a callback when the text stats mgr is saving its files.
-// You can write data out to your own file in here.
-class CTextStatFile
-{
-public:
- CTextStatFile( TextStatFileFn fn );
-
-private:
- friend class CTextStatsMgr;
-
- static CTextStatFile *s_pHead;
- CTextStatFile *m_pNext;
- TextStatFileFn m_pFn;
-};
-
-
-#endif // TEXTSTATSMGR_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef TEXTSTATSMGR_H +#define TEXTSTATSMGR_H +#ifdef _WIN32 +#pragma once +#endif + + +#include "filesystem.h" +#include "utllinkedlist.h" + + +// Text stats get to print their stuff by implementing this type of function. +typedef void (*TextStatPrintFn)( IFileSystem *pFileSys, FileHandle_t hFile, void *pUserData ); +typedef void (*TextStatFileFn)(); + + +// The CTextStatsMgr is just a collection of CTextStat's that go into the same file. +class CTextStatsMgr +{ +public: + CTextStatsMgr( void ); + + // Write a file with all the registered stats. + bool WriteFile( IFileSystem *pFileSystem, const char *pFilename = NULL ); + + // Get the preset filename to write stats to, if none is specified when writing + char *GetStatsFilename( void ); + + // Set the filename to write stats to, if none is specified when writing + void SetStatsFilename( char *sFilename ); + +private: + char m_szStatFilename[ MAX_PATH ]; +}; + + +// This is the default CTextStatsMgr, but there can be any number of them. +extern CTextStatsMgr g_TextStatsMgr; + + + +// Make these to register text stat functions. +class CTextStat +{ +friend class CTextStatsMgr; + +public: + CTextStat(); + CTextStat( TextStatPrintFn fn, void *pUserData, CTextStatsMgr *pMgr=&g_TextStatsMgr ); + ~CTextStat(); + + // This can be called if you don't want to pass parameters into the constructor. + void Init( TextStatPrintFn printFn, void *pUserData, CTextStatsMgr *pMgr=&g_TextStatsMgr ); + void Term(); + + +private: + + // Special constructor to just tie off the linked list. + CTextStat( bool bGlobalListHead ); + + // The global list of CTextStats. + static CTextStat* GetTextStatsList(); + + static void RemoveFn( void *pUserData ); + + // Link it into the global list. + CTextStat *m_pPrev; + CTextStat *m_pNext; + + CTextStatsMgr *m_pMgr; + + TextStatPrintFn m_PrintFn; + void *m_pUserData; +}; + + +// This class registers like a ConVar and acts like an int. When the game is shutdown, +// its value will be saved in the stats file along with its name.s +class CTextStatInt +{ +public: + CTextStatInt( const char *pName, int initialValue=0, CTextStatsMgr *pMgr=&g_TextStatsMgr ); + + operator int() const { return m_Value; } + int operator=( int val ) { m_Value = val; return m_Value; } + + int operator++() { m_Value++; return m_Value; } + int operator--() { m_Value--; return m_Value; } + int operator+=( int val ) { m_Value += val; return m_Value; } + int operator-=( int val ) { m_Value -= val; return m_Value; } + int operator*=( int val ) { m_Value *= val; return m_Value; } + int operator/=( int val ) { m_Value /= val; return m_Value; } + + +private: + + static void PrintFn( IFileSystem *pFileSys, FileHandle_t hFile, void *pUserData ); + + +private: + + const char *m_pName; + int m_Value; + + CTextStat m_Reg; // Use to register ourselves. +}; + + +// This can be registered to get a callback when the text stats mgr is saving its files. +// You can write data out to your own file in here. +class CTextStatFile +{ +public: + CTextStatFile( TextStatFileFn fn ); + +private: + friend class CTextStatsMgr; + + static CTextStatFile *s_pHead; + CTextStatFile *m_pNext; + TextStatFileFn m_pFn; +}; + + +#endif // TEXTSTATSMGR_H |