Peer
Peer
#include <icy/symple/peer.h>class PeerDefined in src/symple/include/icy/symple/peer.h:30
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.
List of all members
| Name | Kind | Owner |
|---|---|---|
operator<< | friend | Declared here |
Peer | function | Declared here |
Peer | function | Declared here |
operator= | function | Declared here |
Peer | function | Declared here |
~Peer | function | Declared here |
address | function | Declared here |
id | function | Declared here |
user | function | Declared here |
name | function | Declared here |
type | function | Declared here |
host | function | Declared here |
setID | function | Declared here |
setUser | function | Declared here |
setName | function | Declared here |
setType | function | Declared here |
setHost | function | Declared here |
valid | function | Declared here |
print | function | Declared here |
className | function | Declared here |
Friends
| Name | Description |
|---|---|
operator<< inline |
operator<<
inline
friend inline std::ostream & operator<<(std::ostream & os, const Peer & peer)Defined in src/symple/include/icy/symple/peer.h:101
Public Methods
| 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
Peer()Defined in src/symple/include/icy/symple/peer.h:34
Constructs an empty peer with type set to "Peer".
Peer
Peer(const Peer & r)Defined in src/symple/include/icy/symple/peer.h:38
Copy constructor; preserves type field.
Parameters
rSource peer.
operator=
Peer & operator=(const Peer & r)Defined in src/symple/include/icy/symple/peer.h:42
Copy-assigns peer data from another peer.
Parameters
rSource peer.
Peer
Peer(const json::Value & r)Defined in src/symple/include/icy/symple/peer.h:46
Constructs a peer from a raw JSON value.
Parameters
rJSON object containing peer fields.
address
const
Address address() constDefined in src/symple/include/icy/symple/peer.h:52
Returns the peer's address (user + session ID).
Returns
Address constructed from the user and id fields.
id
const
std::string id() constDefined in src/symple/include/icy/symple/peer.h:55
Returns the session ID assigned by the server.
user
const
std::string user() constDefined in src/symple/include/icy/symple/peer.h:58
Returns the user identifier.
name
const
std::string name() constDefined in src/symple/include/icy/symple/peer.h:61
Returns the display name.
type
const
std::string type() constDefined in src/symple/include/icy/symple/peer.h:65
Returns the peer type string (e.g. "Peer", "bot").
host
const
std::string host() constDefined in src/symple/include/icy/symple/peer.h:68
Returns the host address associated with this peer.
setID
void setID(std::string_view id)Defined in src/symple/include/icy/symple/peer.h:72
Sets the session ID field.
Parameters
idSession ID string.
setUser
void setUser(std::string_view user)Defined in src/symple/include/icy/symple/peer.h:76
Sets the user identifier field.
Parameters
userUser identifier string.
setName
void setName(std::string_view name)Defined in src/symple/include/icy/symple/peer.h:80
Sets the display name field.
Parameters
nameDisplay name string.
setType
void setType(std::string_view type)Defined in src/symple/include/icy/symple/peer.h:85
Sets the peer type field.
Parameters
typeType string.
setHost
void setHost(std::string_view host)Defined in src/symple/include/icy/symple/peer.h:89
Sets the host address field.
Parameters
hostHost address string.
valid
virtual
virtual bool valid()Defined in src/symple/include/icy/symple/peer.h:95
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) constDefined in src/symple/include/icy/symple/peer.h:99
Writes the peer's JSON representation to the given stream.
Parameters
osOutput stream.
className
virtual const inline
virtual inline const char * className() const