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.

45 lines
1.4 KiB

  1. //========= Copyright �, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose: header for Web API key
  4. //
  5. //=============================================================================
  6. #ifndef GCWEBAPIKEY_H
  7. #define GCWEBAPIKEY_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. using GCSDK::CGCMsgBase;
  12. using GCSDK::WebAPIKey_t;
  13. using GCSDK::EWebAPIKeyStatus;
  14. class CMsgWebAPIKey;
  15. class CWebAPIKey
  16. {
  17. public:
  18. CWebAPIKey() { Clear(); }
  19. void Clear();
  20. bool BIsValid() const { return (m_unAccountID != 0 || m_unPublisherGroupID != 0) && m_eStatus == GCSDK::k_EWebAPIKeyValid; }
  21. bool BIsAccountKey() const { return m_unAccountID != 0; }
  22. bool BIsPublisherKey() const { return m_unPublisherGroupID != 0; }
  23. uint32 GetAccountID() const { return m_unAccountID; }
  24. uint32 GetPublisherGroupID() const { return m_unPublisherGroupID; }
  25. uint32 GetID() const { return m_unWebAPIKeyID; }
  26. const char *GetDomain() const { return m_sDomain; }
  27. EWebAPIKeyStatus GetStatus() const { return m_eStatus; }
  28. void SerializeIntoProtoBuf( CMsgWebAPIKey & apiKey ) const;
  29. void DeserializeFromProtoBuf( const CMsgWebAPIKey & apiKey );
  30. private:
  31. EWebAPIKeyStatus m_eStatus;
  32. uint32 m_unAccountID; // set if key is for an account, 0 otherwise
  33. uint32 m_unPublisherGroupID; // set if key is for a publisher, 0 otherwise
  34. uint32 m_unWebAPIKeyID;
  35. CUtlString m_sDomain;
  36. };
  37. #endif // GCWEBAPIKEY_H