#include <icy/symple/peer.h>Inherits:
Value
Symple peer record containing identity, presence, and custom fields.
A Peer object may also contain arbitrary application data set by the client to share with other peers on the network. See also: Address for further methods and basic accessors.
| Return | Name | Description |
|---|---|---|
Peer | Constructs an empty peer with type set to "Peer". | |
Peer | Copy constructor; preserves type field. | |
Peer & | operator= | Copy-assigns peer data from another peer. |
Peer | Constructs a peer from a raw JSON value. | |
Address | address const | Returns the peer's address (user + session ID). |
std::string | id const | Returns the session ID assigned by the server. |
std::string | user const | Returns the user identifier. |
std::string | name const | Returns the display name. |
std::string | type const | Returns the peer type string (e.g. "Peer", "bot"). |
std::string | host const | Returns the host address associated with this peer. |
void | setID | Sets the session ID field. |
void | setUser | Sets the user identifier field. |
void | setName | Sets the display name field. |
void | setType | Sets the peer type field. |
void | setHost | Sets the host address field. |
bool | valid virtual | Updates the peer from the given data object. |
void | print const | Writes the peer's JSON representation to the given stream. |
const char * | className virtual const inline |
Peer()Constructs an empty peer with type set to "Peer".
Peer(const Peer & r)Copy constructor; preserves type field.
r Source peer.Peer & operator=(const Peer & r)Copy-assigns peer data from another peer.
r Source peer.Peer(const json::Value & r)Constructs a peer from a raw JSON value.
r JSON object containing peer fields.const
Address address() constReturns the peer's address (user + session ID).
Address constructed from the user and id fields.
const
std::string id() constReturns the session ID assigned by the server.
const
std::string user() constReturns the user identifier.
const
std::string name() constReturns the display name.
const
std::string type() constReturns the peer type string (e.g. "Peer", "bot").
const
std::string host() constReturns the host address associated with this peer.
void setID(std::string_view id)Sets the session ID field.
id Session ID string.void setUser(std::string_view user)Sets the user identifier field.
user User identifier string.void setName(std::string_view name)Sets the display name field.
name Display name string.void setType(std::string_view type)Sets the peer type field.
type Type string.void setHost(std::string_view host)Sets the host address field.
host Host address string.virtual
virtual bool valid()Updates the peer from the given data object.
Returns true if the peer has id, user, and type fields.
const
void print(std::ostream & os) constWrites the peer's JSON representation to the given stream.
os Output stream.virtual const inline
virtual inline const char * className() const