Home
Symple module

Address

The Address structure is an endpoint identifier for a peer on the network.

Address

#include <icy/symple/address.h>
struct Address

Defined 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

NameKindOwner
operator<<friendDeclared here
uservariableDeclared here
idvariableDeclared here
AddressfunctionDeclared here
AddressfunctionDeclared here
AddressfunctionDeclared here
~AddressfunctionDeclared here
parsefunctionDeclared here
validfunctionDeclared here
printfunctionDeclared here
toStringfunctionDeclared here
operator==functionDeclared here
operator==functionDeclared here

Friends

NameDescription
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

ReturnNameDescription
std::stringuser
std::stringid

user

std::string user

Defined in src/symple/include/icy/symple/address.h:77


id

std::string id

Defined in src/symple/include/icy/symple/address.h:79

Public Methods

ReturnNameDescription
AddressConstructs an empty (invalid) address.
AddressParses an address string of the form user|id.
AddressConstructs an address from explicit user and session ID components.
boolparseParses an address string of the form user|id. Populates the user and id fields.
boolvalid constReturns true if at least one of user or id is non-empty.
voidprint constWrites the address in user|id format to the given stream.
std::stringtoString constReturns the address as a string in user|id format.
booloperator== constCompares two addresses for equality (both user and id must match).
booloperator== constCompares 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


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

  • user User identifier.

  • id Session 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

Returns

True if the result is a valid address.


valid

const

bool valid() const

Defined in src/symple/include/icy/symple/address.h:53

Returns true if at least one of user or id is non-empty.


print

const

void print(std::ostream & os) const

Defined in src/symple/include/icy/symple/address.h:57

Writes the address in user|id format to the given stream.

Parameters

  • os Output stream.

toString

const

std::string toString() const

Defined 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) const

Defined 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) const

Defined in src/symple/include/icy/symple/address.h:69

Compares this address against a string in user|id format without allocating.

Parameters

  • r String to compare against.