#include <icy/symple/address.h>The Address structure is an endpoint identifier for a peer on the network. The format is like so: user|id
std::string userstd::string id| 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. | |
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()Constructs an empty (invalid) address.
Address(std::string_view addr)Parses an address string of the form user|id.
addr Address string to parse.Address(const std::string & user, const std::string & id)Constructs an address from explicit user and session ID components.
user User identifier.
id Session ID.
bool parse(std::string_view addr)Parses an address string of the form user|id. Populates the user and id fields.
addr Address string to parse.True if the result is a valid address.
const
bool valid() constReturns true if at least one of user or id is non-empty.
const
void print(std::ostream & os) constWrites the address in user|id format to the given stream.
os Output stream.const
std::string toString() constReturns the address as a string in user|id format.
Serialised address string.
const
bool operator==(const Address & r) constCompares two addresses for equality (both user and id must match).
r Address to compare against.const
bool operator==(const std::string & r) constCompares this address against a string in user|id format without allocating.
r String to compare against.