SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches

Opaque representation of a computer-readable network address. More...

Inheritance diagram for SDL::Address:
[legend]

Public Member Functions

constexpr Address (AddressRaw resource) noexcept
 Constructs from raw Address.
constexpr Address (Address &&other) noexcept
 Move constructor.
 Address (StringParam host)
 Resolve a human-readable hostname.
 Address (const Address &address)
 Add a reference to an Address.
 ~Address ()
 Destructor.
constexpr Addressoperator= (Address &&other) noexcept
 Assignment operator.
Addressoperator= (const Address &other)
 Assignment operator.
Public Member Functions inherited from SDL::AddressBase
void Unref ()
 Drop a reference to an Address.
Status WaitUntilResolved (Sint32 timeout)
 Block until an address is resolved.
Status GetStatus ()
 Check if an address is resolved, without blocking.
const char * GetString ()
 Get a human-readable string from a resolved address.
const void * GetBytes (int *num_bytes)
 Get the protocol-level bytes of a network address from a resolved address.
int Compare (AddressRef b) const
 Compare two Address objects.
bool operator== (const AddressBase &other) const
 Compares two addresses for equality.
auto operator<=> (const AddressBase &other) const
 Compares two addresses.
StreamSocket CreateClient (Uint16 port, PropertiesRef props)
 Begin connecting a socket as a client to a remote server.
Server CreateServer (Uint16 port, PropertiesRef props)
 Create a server, which listens for connections to accept.
DatagramSocket CreateDatagramSocket (Uint16 port, PropertiesRef props)
 Create and bind a new datagram socket.
constexpr ResourceBaseT ()=default
 Default constructor, creates null/invalid resource.
constexpr ResourceBaseT (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBaseT (std::nullptr_t)
 Constructs null/invalid.
constexpr ResourceBaseT (const ResourceBaseT &)=default
 Copy constructor.
constexpr ResourceBaseT (ResourceBaseT &&) noexcept=default
 Move constructor.
Public Member Functions inherited from SDL::ResourceBaseT< AddressRaw >
constexpr ResourceBaseT ()=default
 Default constructor, creates null/invalid resource.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBaseT &other) const=default
 Comparison.
constexpr RawConstPointer operator-> () const noexcept
 member access to underlying resource pointer.
constexpr RawPointer get () const noexcept
 Retrieves underlying resource pointer.
constexpr RawPointer release () noexcept
 Retrieves underlying resource pointer and clear this.

Static Public Member Functions

static Address borrow (AddressRaw resource)
 Safely borrows the from AddressRaw.

Additional Inherited Members

Public Types inherited from SDL::ResourceBaseT< AddressRaw >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.
Protected Member Functions inherited from SDL::ResourceBaseT< AddressRaw >
constexpr ~ResourceBaseT ()=default
 Destructor.
constexpr ResourceBaseToperator= (const ResourceBaseT &)=default
 Assignment operator.

Detailed Description

Opaque representation of a computer-readable network address.

This is an opaque datatype, to be treated by the app as a handle.

SDL_net uses these to identify other servers; you use them to connect to a remote machine, and you use them to find out who connected to you. They are also used to decide what network interface to use when creating a server.

These are intended to be protocol-independent; a given address might be for IPv4, IPv6, or something more esoteric. SDL_net attempts to hide the differences.

Since
This datatype is available since SDL_net 3.0.0.
See also
ResolveHostname
GetLocalAddresses
CompareAddresses
Category:
Resource

Constructor & Destructor Documentation

◆ Address()

SDL::Address::Address ( AddressRaw resource)
inlineexplicitconstexprnoexcept

Constructs from raw Address.

Parameters
resourcea AddressRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.

Member Function Documentation

◆ borrow()

Address SDL::Address::borrow ( AddressRaw resource)
inlinestatic

Safely borrows the from AddressRaw.

Parameters
resourcea AddressRaw.

This does not takes ownership!


The documentation for this struct was generated from the following file: