1 #ifndef OPENTERA_WEBRTC_NATIVE_CLIENT_UTILS_CLIENT_H 
    2 #define OPENTERA_WEBRTC_NATIVE_CLIENT_UTILS_CLIENT_H 
    4 #include <nlohmann/json.hpp> 
   17         nlohmann::json m_data;
 
   22         explicit Client(
const nlohmann::json& message);
 
   25         virtual ~
Client() = 
default;
 
   27         [[nodiscard]] 
const std::string& 
id() 
const;
 
   28         [[nodiscard]] 
const std::string& 
name() 
const;
 
   29         [[nodiscard]] 
const nlohmann::json& 
data() 
const;
 
   31         static bool isValid(
const nlohmann::json& message);
 
   36         friend bool operator==(
const Client& c1, 
const Client& c2);
 
   43     inline const std::string& 
Client::id()
 const { 
return m_id; }
 
   55     inline const nlohmann::json& 
Client::data()
 const { 
return m_data; }
 
   57     inline bool operator==(
const Client& c1, 
const Client& c2)
 
   59         return c1.m_id == c2.m_id && c1.m_name == c2.m_name && c1.m_data == c2.m_data;
 
   62     inline bool operator!=(
const Client& c1, 
const Client& c2) { 
return !(c1 == c2); }
 
   71         nlohmann::json m_data;
 
   82         [[nodiscard]] 
const std::string& 
id() 
const;
 
   83         [[nodiscard]] 
const std::string& 
name() 
const;
 
   84         [[nodiscard]] 
const nlohmann::json& 
data() 
const;
 
   87         explicit operator Client() 
const;
 
  119     inline RoomClient::operator 
Client()
 const { 
return {m_id, m_name, m_data}; }
 
  121     inline bool operator==(
const RoomClient& c1, 
const RoomClient& c2)
 
  123         return c1.m_id == c2.m_id && c1.m_name == c2.m_name && c1.m_data == c2.m_data &&
 
  124                c1.m_isConnected == c2.m_isConnected;
 
  127     inline bool operator!=(
const RoomClient& c1, 
const RoomClient& c2) { 
return !(c1 == c2); }
 
Represents a peer client.
Definition: Client.h:14
 
const nlohmann::json & data() const
Returns the client data.
Definition: Client.h:55
 
const std::string & id() const
Returns the client id.
Definition: Client.h:43
 
const std::string & name() const
Returns the client name.
Definition: Client.h:49
 
Represents a room client.
Definition: Client.h:68
 
bool isConnected() const
Indicates if the client is connected (RTCPeerConnection).
Definition: Client.h:117
 
RoomClient()
Creates a room client with the default values.
Definition: Client.cpp:42
 
const nlohmann::json & data() const
Returns the client data.
Definition: Client.h:111
 
const std::string & id() const
Returns the client id.
Definition: Client.h:99
 
const std::string & name() const
Returns the client name.
Definition: Client.h:105