HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends
tt::URL Class Reference

#include <ttauri/URL.hpp>

Public Member Functions

 URL (std::string_view url)
 
 URL (char const *url)
 
 URL (std::string const &url)
 
 URL (url_parts const &parts)
 
 URL (URL const &other) noexcept
 
 URL (URL &&other) noexcept=default
 
URLoperator= (URL const &other) noexcept
 
URLoperator= (URL &&other) noexcept=default
 
size_t hash () const noexcept
 
std::string_view scheme () const noexcept
 
std::string query () const noexcept
 
std::string fragment () const noexcept
 
std::string filename () const noexcept
 
std::string directory () const noexcept
 
std::string nativeDirectory () const noexcept
 
std::string extension () const noexcept
 
std::vector< std::stringpathSegments () const noexcept
 
std::string path () const noexcept
 
std::string nativePath () const noexcept
 
std::wstring nativeWPath () const noexcept
 
bool isFileScheme () const noexcept
 
bool isAbsolute () const noexcept
 
bool isRelative () const noexcept
 
bool isRootDirectory () const noexcept
 
URL urlByAppendingPath (URL const &other) const noexcept
 
URL urlByAppendingPath (std::string_view const other) const noexcept
 
URL urlByAppendingPath (std::string const &other) const noexcept
 
URL urlByAppendingPath (char const *other) const noexcept
 
URL urlByAppendingPath (std::wstring_view const other) const noexcept
 
URL urlByAppendingPath (std::wstring const &other) const noexcept
 
URL urlByAppendingPath (wchar_t const *other) const noexcept
 
URL urlByAppendingExtension (std::string_view other) const noexcept
 
URL urlByAppendingExtension (std::string const &other) const noexcept
 
URL urlByAppendingExtension (char const *other) const noexcept
 
URL urlByRemovingFilename () const noexcept
 
std::unique_ptr< resource_viewloadView () const
 Load a resource.
 
std::vector< URLurlsByScanningWithGlobPattern () const noexcept
 

Static Public Member Functions

static URL urlFromPath (std::string_view const path) noexcept
 
static URL urlFromWPath (std::wstring_view const path) noexcept
 
static URL urlFromCurrentWorkingDirectory () noexcept
 
static URL urlFromResourceDirectory () noexcept
 
static URL urlFromExecutableDirectory () noexcept
 
static URL urlFromExecutableFile () noexcept
 
static URL urlFromApplicationDataDirectory () noexcept
 
static URL urlFromApplicationLogDirectory () noexcept
 
static URL urlFromSystemfontDirectory () noexcept
 
static std::vector< std::stringfilenamesByScanningDirectory (std::string_view path) noexcept
 
static std::string nativePathFromPath (std::string_view path) noexcept
 
static std::wstring nativeWPathFromPath (std::string_view path) noexcept
 

Friends

bool operator== (URL const &lhs, URL const &rhs) noexcept
 
bool operator< (URL const &lhs, URL const &rhs) noexcept
 
bool operator> (URL const &lhs, URL const &rhs) noexcept
 
bool operator!= (URL const &lhs, URL const &rhs) noexcept
 
bool operator>= (URL const &lhs, URL const &rhs) noexcept
 
bool operator<= (URL const &lhs, URL const &rhs) noexcept
 
URL operator/ (URL const &lhs, URL const &rhs) noexcept
 
URL operator/ (URL const &lhs, std::string_view const &rhs) noexcept
 
std::string to_string (URL const &url) noexcept
 
std::ostreamoperator<< (std::ostream &lhs, const URL &rhs)
 

Detailed Description

Universal Resource Locator.

An instance internally holds a string to an url. This will have the following effects:

Constructors and path manipulations will cause the url to be normalized:

'file:' scheme urls can handle the following:

The url instance may be relative itself; meaning it does not hold a scheme. This is important, because it means that any string passed to the constructor is a valid url. This also means that non of the constructors and non of the methods will ever cause an error.

meaningless-urls could still cause meaningless results when converted to a path. But this is no different from having a meaningless path in the first place.

Member Function Documentation

◆ filenamesByScanningDirectory()

static std::vector< std::string > tt::URL::filenamesByScanningDirectory ( std::string_view path)
staticnoexcept

Return file names in the directory pointed by the url.

Parameters
pathpath to the directory to scan.
Returns
A list of filenames or subdirectories (ending in '/') in the directory.

◆ loadView()

std::unique_ptr< resource_view > tt::URL::loadView ( ) const

Load a resource.

Returns
A pointer to a resource view.

◆ urlsByScanningWithGlobPattern()

std::vector< URL > tt::URL::urlsByScanningWithGlobPattern ( ) const
noexcept

Return new URLs by finding matching files. Currently only works for file: scheme urls.

The following wildcards are supported:

  • '*' Replaced by 0 or more characters.
  • '?' Replaced by 1 character.
  • '**' Replaced by 0 or more nested directories.
  • '[abcd]' Replaced by a single character from the set "abcd".
  • '{foo,bar}' Replaced by a string "foo" or "bar".

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