AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
AeonGUI::DOM::Location Class Reference

Represents the URL of the active document. More...

#include <aeongui/dom/Location.hpp>

Public Member Functions

 Location ()
 Default constructor. URL is "about:blank".
 Location (std::function< void(const Location &) > callback)
 Construct with a change callback.
 ~Location ()
 Destructor.
void SetCallback (std::function< void(const Location &) > callback)
 Set or replace the change callback.
void assign (const USVString &url)
 Navigate to the given URL.
void replace (const USVString &url)
 Replace the current URL without creating a history entry.
Locationoperator= (const USVString &url)
 Assign a URL using the = operator.
void reload ()
 Reload the current document.
const USVString & href () const
 Get the full URL.
const USVString & origin () const
 Get the origin portion of the URL.
const USVString & protocol () const
 Get the protocol (e.g. "https:").
const USVString & host () const
 Get the host (hostname:port).
const USVString & hostname () const
 Get the hostname.
const USVString & port () const
 Get the port number.
const USVString & pathname () const
 Get the pathname.
const USVString & search () const
 Get the query string (including leading '?').
const USVString & hash () const
 Get the fragment (including leading '#').

Detailed Description

Represents the URL of the active document.

Provides access to the individual components of a URL (protocol, hostname, port, pathname, etc.) and methods to navigate.

See also
https://html.spec.whatwg.org/multipage/nav-history-apis.html#location

Constructor & Destructor Documentation

◆ Location()

AeonGUI::DOM::Location::Location ( std::function< void(const Location &) > callback)

Construct with a change callback.

Parameters
callbackCalled whenever the location changes.

Member Function Documentation

◆ assign()

void AeonGUI::DOM::Location::assign ( const USVString & url)

Navigate to the given URL.

DOM Properties and Methods

Parameters
urlThe URL to navigate to.

◆ hash()

const USVString & AeonGUI::DOM::Location::hash ( ) const

Get the fragment (including leading '#').

Returns
The hash string.

◆ host()

const USVString & AeonGUI::DOM::Location::host ( ) const

Get the host (hostname:port).

Returns
The host string.

◆ hostname()

const USVString & AeonGUI::DOM::Location::hostname ( ) const

Get the hostname.

Returns
The hostname string.

◆ href()

const USVString & AeonGUI::DOM::Location::href ( ) const

Get the full URL.

Returns
The href string.

◆ operator=()

Location & AeonGUI::DOM::Location::operator= ( const USVString & url)

Assign a URL using the = operator.

Parameters
urlThe URL to navigate to.
Returns
Reference to this Location.

◆ origin()

const USVString & AeonGUI::DOM::Location::origin ( ) const

Get the origin portion of the URL.

Returns
The origin string.

◆ pathname()

const USVString & AeonGUI::DOM::Location::pathname ( ) const

Get the pathname.

Returns
The pathname string.

◆ port()

const USVString & AeonGUI::DOM::Location::port ( ) const

Get the port number.

Returns
The port string.

◆ protocol()

const USVString & AeonGUI::DOM::Location::protocol ( ) const

Get the protocol (e.g. "https:").

Returns
The protocol string.

◆ replace()

void AeonGUI::DOM::Location::replace ( const USVString & url)

Replace the current URL without creating a history entry.

Parameters
urlThe URL to navigate to.

◆ search()

const USVString & AeonGUI::DOM::Location::search ( ) const

Get the query string (including leading '?').

Returns
The search string.

◆ SetCallback()

void AeonGUI::DOM::Location::SetCallback ( std::function< void(const Location &) > callback)

Set or replace the change callback.

Parameters
callbackThe new callback function.

The documentation for this class was generated from the following files: