Address
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
List of all members
| Name | Kind | Owner |
|---|---|---|
operator<< | friend | Declared here |
user | variable | Declared here |
id | variable | Declared here |
Address | function | Declared here |
Address | function | Declared here |
Address | function | Declared here |
~Address | function | Declared here |
parse | function | Declared here |
valid | function | Declared here |
print | function | Declared here |
toString | function | Declared here |
operator== | function | Declared here |
operator== | function | Declared here |
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. | |
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
addrAddress 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
userUser identifier.idSession ID.
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.
Parameters
addrAddress string to parse.
Returns
True if the result is a valid address.
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
osOutput 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
rAddress to compare against.
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
rString to compare against.
