Team Fortress 2 Source Code as on 22/4/2020
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.

55 lines
1.5 KiB

  1. //=========== Copyright Valve Corporation, All rights reserved. ===============//
  2. //
  3. // Purpose:
  4. //=============================================================================//
  5. #ifndef PANORAMASYMBOL_H
  6. #define PANORAMASYMBOL_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. #include "utlsymbol.h"
  11. namespace panorama
  12. {
  13. // Panorama wrapper around CUtlSymbol which always creates symbol in panorama.dll module
  14. class CPanoramaSymbol
  15. {
  16. public:
  17. // constructor, destructor
  18. CPanoramaSymbol() : m_Id( UTL_INVAL_SYMBOL ) {}
  19. CPanoramaSymbol( UtlSymId_t id ) : m_Id( id ) {}
  20. CPanoramaSymbol( char const* pStr );
  21. CPanoramaSymbol( CPanoramaSymbol const& sym ) : m_Id( sym.m_Id ) {}
  22. // operator=
  23. CPanoramaSymbol& operator=(CPanoramaSymbol const& src) { m_Id = src.m_Id; return *this; }
  24. // operator==
  25. bool operator==(CPanoramaSymbol const& src) const { return m_Id == src.m_Id; }
  26. bool operator==(char const* pStr) const { return CPanoramaSymbol( pStr ).m_Id == m_Id; }
  27. // sort by index offset and NOT lexigraphical
  28. bool operator<(CPanoramaSymbol const& src) const { return m_Id < src.m_Id; }
  29. bool operator>( CPanoramaSymbol const& src ) const { return m_Id > src.m_Id; }
  30. bool operator!=(CPanoramaSymbol const& src) const { return !operator==(src); }
  31. // Is valid?
  32. bool IsValid() const { return m_Id != UTL_INVAL_SYMBOL; }
  33. // Gets at the symbol
  34. operator UtlSymId_t () const { return m_Id; }
  35. // Gets the string associated with the symbol
  36. char const* String() const;
  37. private:
  38. UtlSymId_t m_Id;
  39. };
  40. } // namespace panorama
  41. #endif // PANORAMASYMBOL_H