Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
726 B

  1. #include "toolframework/itooldictionary.h"
  2. #include "utlvector.h"
  3. class CToolDictionary : public IToolDictionary
  4. {
  5. public:
  6. virtual int GetToolCount() const
  7. {
  8. return m_Tools.Count();
  9. }
  10. virtual IToolSystem *GetTool( int index )
  11. {
  12. if ( index < 0 || index >= m_Tools.Count() )
  13. {
  14. return NULL;
  15. }
  16. return m_Tools[ index ];
  17. }
  18. public:
  19. void RegisterTool( IToolSystem *tool )
  20. {
  21. m_Tools.AddToTail( tool );
  22. }
  23. private:
  24. CUtlVector< IToolSystem * > m_Tools;
  25. };
  26. static CToolDictionary g_ToolDictionary;
  27. EXPOSE_SINGLE_INTERFACE_GLOBALVAR( IToolDictionary, CToolDictionary, VTOOLDICTIONARY_INTERFACE_VERSION, g_ToolDictionary );
  28. void RegisterTool( IToolSystem *tool )
  29. {
  30. g_ToolDictionary.RegisterTool( tool );
  31. }