From 39ed87570bdb2f86969d4be821c94b722dc71179 Mon Sep 17 00:00:00 2001 From: Joe Ludwig Date: Wed, 26 Jun 2013 15:22:04 -0700 Subject: First version of the SOurce SDK 2013 --- mp/src/public/toolframework/toolframework.cpp | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 mp/src/public/toolframework/toolframework.cpp (limited to 'mp/src/public/toolframework/toolframework.cpp') diff --git a/mp/src/public/toolframework/toolframework.cpp b/mp/src/public/toolframework/toolframework.cpp new file mode 100644 index 00000000..1348035e --- /dev/null +++ b/mp/src/public/toolframework/toolframework.cpp @@ -0,0 +1,41 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +#include "toolframework/itooldictionary.h" +#include "utlvector.h" + +class CToolDictionary : public IToolDictionary +{ +public: + virtual int GetToolCount() const + { + return m_Tools.Count(); + } + + virtual IToolSystem *GetTool( int index ) + { + if ( index < 0 || index >= m_Tools.Count() ) + { + return NULL; + } + return m_Tools[ index ]; + } + +public: + + void RegisterTool( IToolSystem *tool ) + { + m_Tools.AddToTail( tool ); + } +private: + + CUtlVector< IToolSystem * > m_Tools; +}; + +static CToolDictionary g_ToolDictionary; + +EXPOSE_SINGLE_INTERFACE_GLOBALVAR( IToolDictionary, CToolDictionary, VTOOLDICTIONARY_INTERFACE_VERSION, g_ToolDictionary ); + +void RegisterTool( IToolSystem *tool ) +{ + g_ToolDictionary.RegisterTool( tool ); +} + -- cgit v1.2.3