Address
#include <icy/symple/address.h>
struct AddressDefined in src/symple/include/icy/symple/address.h:28
The Address structure is an endpoint identifier for a peer on the network. The format is like so: user|id
Friends
| Name | Description |
|---|---|
operator<< inline |
operator<<
inline
friend inline std::ostream & operator<<(std::ostream & os, const Address & addr)Defined in src/symple/include/icy/symple/address.h:71
Public Attributes
user
std::string userDefined in src/symple/include/icy/symple/address.h:77
id
std::string idDefined in src/symple/include/icy/symple/address.h:79
Public Methods
| Return | Name | Description |
|---|---|---|
Address | Constructs an empty (invalid) address. | |
Address | Parses an address string of the form user|id. | |
Address | Constructs an address from explicit user and session ID components. | |
~Address virtual | ||
bool | parse | Parses an address string of the form user|id. Populates the user and id fields. |
bool | valid const | Returns true if at least one of user or id is non-empty. |
void | print const | Writes the address in user|id format to the given stream. |
std::string | toString const | Returns the address as a string in user|id format. |
bool | operator== const | Compares two addresses for equality (both user and id must match). |
bool | operator== const | Compares this address against a string in user|id format without allocating. |
Address
Address()Defined in src/symple/include/icy/symple/address.h:32
Constructs an empty (invalid) address.
Address
Address(std::string_view addr)Defined in src/symple/include/icy/symple/address.h:36
Parses an address string of the form user|id.
Parameters
| Parameter | Type | Description |
|---|---|---|
addr | std::string_view | Address string to parse. |
Address
Address(const std::string & user, const std::string & id)Defined in src/symple/include/icy/symple/address.h:41
Constructs an address from explicit user and session ID components.
Parameters
| Parameter | Type | Description |
|---|---|---|
user | const std::string & | User identifier. |
id | const std::string & | Session ID. |
~Address
virtual
virtual ~Address()Defined in src/symple/include/icy/symple/address.h:44
parse
bool parse(std::string_view addr)Defined in src/symple/include/icy/symple/address.h:50
Parses an address string of the form user|id. Populates the user and id fields.
Returns
True if the result is a valid address.
Parameters
| Parameter | Type | Description |
|---|---|---|
addr | std::string_view | Address string to parse. |
valid
const
bool valid() constDefined in src/symple/include/icy/symple/address.h:53
Returns true if at least one of user or id is non-empty.
const
void print(std::ostream & os) constDefined in src/symple/include/icy/symple/address.h:57
Writes the address in user|id format to the given stream.
Parameters
| Parameter | Type | Description |
|---|---|---|
os | std::ostream & | Output stream. |
toString
const
std::string toString() constDefined in src/symple/include/icy/symple/address.h:61
Returns the address as a string in user|id format.
Returns
Serialised address string.
operator==
const
bool operator==(const Address & r) constDefined in src/symple/include/icy/symple/address.h:65
Compares two addresses for equality (both user and id must match).
Parameters
operator==
const
bool operator==(const std::string & r) constDefined in src/symple/include/icy/symple/address.h:69
Compares this address against a string in user|id format without allocating.
Parameters
| Parameter | Type | Description |
|---|---|---|
r | const std::string & | String to compare against. |
