Kodi Documentation 23.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CURL Class Referencefinal

#include <URL.h>

Public Member Functions

 CURL ()=default
 
 CURL (const CURL &)=default
 
CURL & operator= (const CURL &)=default
 
 CURL (CURL &&other)
 Transfer all URI/compatibility state, leaving the source Reset().
 
CURL & operator= (CURL &&other)
 
 CURL (std::string strURL)
 
bool operator== (const CURL &url) const
 
void Reset ()
 
void Parse (std::string strURL)
 Interpret Kodi mixed native-path/URI input without a strict validity gate.
 
bool ParseURI (std::string uri)
 Parse an explicit URI, including one-letter schemes.
 
void ParseNativePath (std::string path)
 Store an explicitly native filename without URI detection or normalization.
 
bool IsLosslessURI () const
 Whether serialization preserves the source URI bytes, even if malformed.
 
bool SupportsPathOperations () const
 Whether this location supports filesystem-style path operations.
 
bool PreservesQueryIdentity () const
 Whether path operations must retain the query as resource identity.
 
std::string GetSchemeSpecificPart () const
 Copy raw bytes after the scheme colon and before the fragment delimiter.
 
std::string_view GetSchemeSpecificPartView () const
 Borrow a lossless URI's scheme-specific bytes without allocation.
 
bool SetURIPath (std::string path)
 Replace a lossless URI's raw path, preserving all other components.
 
bool SetRawQuery (std::optional< std::string > query)
 Replace the raw query of a lossless URI without a map or form decoding.
 
void SetFileName (std::string strFileName)
 Replace the legacy filename or lossless navigable raw path.
 
void SetHostName (std::string strHostName)
 
void SetUserName (std::string strUserName)
 
void SetDomain (std::string strDomain)
 
void SetPassword (std::string strPassword)
 
void SetProtocol (std::string strProtocol)
 Change the scheme, preserving component bytes for lossless forms.
 
void SetOptions (std::string strOptions)
 Set legacy options; lossless URI forms reject this operation unchanged.
 
void SetProtocolOptions (std::string strOptions)
 
void SetPort (int port)
 
bool HasPort () const
 
int GetPort () const
 
const std::string & GetHostName () const
 
const std::string & GetDomain () const
 
const std::string & GetUserName () const
 
const std::string & GetPassWord () const
 
const std::string & GetFileName () const
 Return the compatibility filename, or the raw path for navigable lossless URIs.
 
const std::string & GetProtocol () const
 Return the normalized lower-case scheme; Get() retains lossless source spelling.
 
std::string GetTranslatedProtocol () const
 
const std::string & GetFileType () const
 
const std::string & GetShareName () const
 
const std::string & GetOptions () const
 Return legacy options, or the raw lossless query including its leading ?.
 
const std::string & GetProtocolOptions () const
 
std::string GetFileNameWithoutPath () const
 
char GetDirectorySeparator () const
 Return / for URI paths; native and legacy embedded filenames retain native separators.
 
std::string Get () const
 Serialize with legacy normalization or exact lossless URI bytes.
 
std::string GetWithoutOptions () const
 Serialize without legacy options, or without a lossless URI's query and fragment.
 
std::string GetWithoutUserDetails (bool redact=false) const
 Serialize without credentials, optionally replacing them with redaction labels.
 
std::string GetWithoutFilename () const
 Return the legacy filename prefix, or lossless URI bytes preceding the path.
 
std::string GetRedacted () const
 
bool IsLocal () const
 Test Kodi local-location compatibility, not the presence of a URI authority.
 
bool IsLocalHost () const
 
bool IsProtocol (std::string_view type) const
 Check whether a URL is a given URL scheme. Comparison is case-insensitive as per RFC1738.
 
bool IsFileType (std::string_view type) const
 Check whether a URL is a given filetype. Comparison is effectively case-insensitive as both the parameter and m_strFileType are lower-case.
 
void GetOptions (std::map< std::string, std::string > &options) const
 
bool HasOption (const std::string &key) const
 
bool GetOption (const std::string &key, std::string &value) const
 
std::string GetOption (const std::string &key) const
 
void SetOption (const std::string &key, const std::string &value)
 
void RemoveOption (const std::string &key)
 
void GetProtocolOptions (std::map< std::string, std::string > &options) const
 
bool HasProtocolOption (const std::string &key) const
 
bool GetProtocolOption (const std::string &key, std::string &value) const
 
std::string GetProtocolOption (const std::string &key) const
 
void SetProtocolOption (const std::string &key, const std::string &value)
 
void RemoveProtocolOption (const std::string &key)
 
bool HasExtension (std::string_view extensions) const
 
std::string GetExtension () const
 
bool IsStack () const
 
bool IsMultiPath () const
 
bool IsFavourite () const
 
bool IsPlugin () const
 
bool IsScript () const
 
bool IsAddonsPath () const
 
bool IsSourcesPath () const
 
bool IsCDDA () const
 
bool IsISO9660 () const
 
bool IsMusicDb () const
 
bool IsVideoDb () const
 
bool IsBlurayPath () const
 
bool IsAndroidApp () const
 
bool IsLibraryFolder () const
 
bool IsUPnP () const
 
bool IsAPK () const
 
bool IsZIP () const
 
bool IsArchive () const
 
bool IsCBZ () const
 
bool IsCBR () const
 
bool IsDiscImage () const
 
bool IsPicture () const
 
bool HasParentInHostname () const
 
bool HasEncodedHostname () const
 
bool HasEncodedFilename () const
 
bool IsLibraryContent () const
 
bool IsBDFile () const
 
bool IsDVDFile () const
 
bool IsOpticalMediaFile () const
 
Raw URI components

Owned copies without decoding; safe across object mutation, copying and moving. Legacy adapters expose components of their current serialized spelling. Presence predicates distinguish absent components from present empty components. Native filenames have no URI authority, query or fragment.

std::string GetRawScheme () const
 
std::string GetRawAuthority () const
 
std::string GetRawPath () const
 
std::string GetRawQuery () const
 
std::string GetRawFragment () const
 
bool HasAuthority () const
 
bool HasQuery () const
 
bool HasFragment () const
 

Static Public Member Functions

static std::string GetRedacted (std::string_view path)
 Redact credentials and complete data bodies, including malformed candidates.
 
static bool IsFullPath (const std::string &url)
 Test Kodi absolute-location compatibility, independently of handler availability.
 
static std::string Decode (std::string_view strURLData)
 
static std::string Encode (std::string_view strURLData)
 
static bool IsProtocolEqual (const std::string &protocol, std::string_view type)
 Check whether a URL protocol is a given URL scheme. Both parameters MUST be lower-case. Typically this would be called using the result of TranslateProtocol() which enforces this for protocol.
 

Friends

class CURIRedactor
 
bool operator== (const CURL &url, const std::string_view str)
 

Constructor & Destructor Documentation

◆ CURL() [1/4]

CURL::CURL ( )
default

◆ CURL() [2/4]

CURL::CURL ( const CURL & )
default

◆ CURL() [3/4]

CURL::CURL ( CURL && other)

Transfer all URI/compatibility state, leaving the source Reset().

◆ CURL() [4/4]

CURL::CURL ( std::string strURL)
explicit

Member Function Documentation

◆ Decode()

std::string CURL::Decode ( std::string_view strURLData)
static

◆ Encode()

std::string CURL::Encode ( std::string_view strURLData)
static

◆ Get()

std::string CURL::Get ( ) const

Serialize with legacy normalization or exact lossless URI bytes.

◆ GetDirectorySeparator()

char CURL::GetDirectorySeparator ( ) const

Return / for URI paths; native and legacy embedded filenames retain native separators.

◆ GetDomain()

const std::string & CURL::GetDomain ( ) const
inline

◆ GetExtension()

std::string CURL::GetExtension ( ) const

◆ GetFileName()

const std::string & CURL::GetFileName ( ) const
inline

Return the compatibility filename, or the raw path for navigable lossless URIs.

Note
Non-file identifiers have no filename, share or filetype. The reference belongs to this object and may change on mutation; use GetRawPath for URI bodies.

◆ GetFileNameWithoutPath()

std::string CURL::GetFileNameWithoutPath ( ) const

◆ GetFileType()

const std::string & CURL::GetFileType ( ) const
inline

◆ GetHostName()

const std::string & CURL::GetHostName ( ) const
inline

◆ GetOption() [1/2]

std::string CURL::GetOption ( const std::string & key) const

◆ GetOption() [2/2]

bool CURL::GetOption ( const std::string & key,
std::string & value ) const

◆ GetOptions() [1/2]

const std::string & CURL::GetOptions ( ) const
inline

Return legacy options, or the raw lossless query including its leading ?.

Note
Lossless fragments are separate and the legacy options map remains empty. This reference belongs to the object and may change on mutation.

◆ GetOptions() [2/2]

void CURL::GetOptions ( std::map< std::string, std::string > & options) const

◆ GetPassWord()

const std::string & CURL::GetPassWord ( ) const
inline

◆ GetPort()

int CURL::GetPort ( ) const
inline

◆ GetProtocol()

const std::string & CURL::GetProtocol ( ) const
inline

Return the normalized lower-case scheme; Get() retains lossless source spelling.

◆ GetProtocolOption() [1/2]

std::string CURL::GetProtocolOption ( const std::string & key) const

◆ GetProtocolOption() [2/2]

bool CURL::GetProtocolOption ( const std::string & key,
std::string & value ) const

◆ GetProtocolOptions() [1/2]

const std::string & CURL::GetProtocolOptions ( ) const
inline

◆ GetProtocolOptions() [2/2]

void CURL::GetProtocolOptions ( std::map< std::string, std::string > & options) const

◆ GetRawAuthority()

std::string CURL::GetRawAuthority ( ) const

◆ GetRawFragment()

std::string CURL::GetRawFragment ( ) const

◆ GetRawPath()

std::string CURL::GetRawPath ( ) const

◆ GetRawQuery()

std::string CURL::GetRawQuery ( ) const

◆ GetRawScheme()

std::string CURL::GetRawScheme ( ) const

◆ GetRedacted() [1/2]

std::string CURL::GetRedacted ( ) const

◆ GetRedacted() [2/2]

std::string CURL::GetRedacted ( std::string_view path)
static

Redact credentials and complete data bodies, including malformed candidates.

Note
Kodi logging policy replaces a data resource, or an image, parent-in-hostname, or stack wrapper containing one, with scheme:[REDACTED] without copying its body. Get() and GetWithoutUserDetails(false) retain data bytes.

◆ GetSchemeSpecificPart()

std::string CURL::GetSchemeSpecificPart ( ) const

Copy raw bytes after the scheme colon and before the fragment delimiter.

Returns
Includes the query and its delimiter; empty for native input.

◆ GetSchemeSpecificPartView()

std::string_view CURL::GetSchemeSpecificPartView ( ) const
inline

Borrow a lossless URI's scheme-specific bytes without allocation.

Returns
Includes the query and its delimiter, excludes the fragment; empty for native paths and legacy URLs.
Note
The view is invalidated by mutation, moving from, or destruction of this object.

◆ GetShareName()

const std::string & CURL::GetShareName ( ) const
inline

◆ GetTranslatedProtocol()

std::string CURL::GetTranslatedProtocol ( ) const

◆ GetUserName()

const std::string & CURL::GetUserName ( ) const
inline

◆ GetWithoutFilename()

std::string CURL::GetWithoutFilename ( ) const

Return the legacy filename prefix, or lossless URI bytes preceding the path.

Returns
Empty for non-file identifiers; lossless query and fragment are omitted.

◆ GetWithoutOptions()

std::string CURL::GetWithoutOptions ( ) const

Serialize without legacy options, or without a lossless URI's query and fragment.

Warning
Explicitly discards query identity; structural navigation should use SetURIPath.

◆ GetWithoutUserDetails()

std::string CURL::GetWithoutUserDetails ( bool redact = false) const

Serialize without credentials, optionally replacing them with redaction labels.

Parameters
redactAlso replaces data resources and their wrappers with bounded text when true.
Note
Non-redacted data retains its complete source. Raw URI components are not decoded.

◆ HasAuthority()

bool CURL::HasAuthority ( ) const

◆ HasEncodedFilename()

bool CURL::HasEncodedFilename ( ) const

◆ HasEncodedHostname()

bool CURL::HasEncodedHostname ( ) const

◆ HasExtension()

bool CURL::HasExtension ( std::string_view extensions) const

◆ HasFragment()

bool CURL::HasFragment ( ) const

◆ HasOption()

bool CURL::HasOption ( const std::string & key) const

◆ HasParentInHostname()

bool CURL::HasParentInHostname ( ) const

◆ HasPort()

bool CURL::HasPort ( ) const
inline

◆ HasProtocolOption()

bool CURL::HasProtocolOption ( const std::string & key) const

◆ HasQuery()

bool CURL::HasQuery ( ) const

◆ IsAddonsPath()

bool CURL::IsAddonsPath ( ) const

◆ IsAndroidApp()

bool CURL::IsAndroidApp ( ) const

◆ IsAPK()

bool CURL::IsAPK ( ) const

◆ IsArchive()

bool CURL::IsArchive ( ) const

◆ IsBDFile()

bool CURL::IsBDFile ( ) const

◆ IsBlurayPath()

bool CURL::IsBlurayPath ( ) const

◆ IsCBR()

bool CURL::IsCBR ( ) const

◆ IsCBZ()

bool CURL::IsCBZ ( ) const

◆ IsCDDA()

bool CURL::IsCDDA ( ) const

◆ IsDiscImage()

bool CURL::IsDiscImage ( ) const

◆ IsDVDFile()

bool CURL::IsDVDFile ( ) const

◆ IsFavourite()

bool CURL::IsFavourite ( ) const

◆ IsFileType()

bool CURL::IsFileType ( std::string_view type) const
inline

Check whether a URL is a given filetype. Comparison is effectively case-insensitive as both the parameter and m_strFileType are lower-case.

Parameters
typea lower-case filetype, e.g. "mp3".
Returns
true if the url is of the given filetype, false otherwise.

◆ IsFullPath()

bool CURL::IsFullPath ( const std::string & url)
static

Test Kodi absolute-location compatibility, independently of handler availability.

Note
Recognized identifiers and native roots qualify; drive-relative C:foo retains its historical true result. Interior :// text does not create an outer scheme.

◆ IsISO9660()

bool CURL::IsISO9660 ( ) const

◆ IsLibraryContent()

bool CURL::IsLibraryContent ( ) const

◆ IsLibraryFolder()

bool CURL::IsLibraryFolder ( ) const

◆ IsLocal()

bool CURL::IsLocal ( ) const

Test Kodi local-location compatibility, not the presence of a URI authority.

Note
A new identifier without a hostname does not imply a native file or backend.

◆ IsLocalHost()

bool CURL::IsLocalHost ( ) const

◆ IsLosslessURI()

bool CURL::IsLosslessURI ( ) const
inline

Whether serialization preserves the source URI bytes, even if malformed.

◆ IsMultiPath()

bool CURL::IsMultiPath ( ) const

◆ IsMusicDb()

bool CURL::IsMusicDb ( ) const

◆ IsOpticalMediaFile()

bool CURL::IsOpticalMediaFile ( ) const

◆ IsPicture()

bool CURL::IsPicture ( ) const

◆ IsPlugin()

bool CURL::IsPlugin ( ) const

◆ IsProtocol()

bool CURL::IsProtocol ( std::string_view type) const
inline

Check whether a URL is a given URL scheme. Comparison is case-insensitive as per RFC1738.

Parameters
typea lower-case scheme name, e.g. "smb".
Returns
true if the url is of the given scheme, false otherwise.

◆ IsProtocolEqual()

bool CURL::IsProtocolEqual ( const std::string & protocol,
std::string_view type )
static

Check whether a URL protocol is a given URL scheme. Both parameters MUST be lower-case. Typically this would be called using the result of TranslateProtocol() which enforces this for protocol.

Parameters
protocola lower-case scheme name, e.g. "ftp"
typea lower-case scheme name, e.g. "smb".
Returns
true if the url is of the given scheme, false otherwise.

◆ IsScript()

bool CURL::IsScript ( ) const

◆ IsSourcesPath()

bool CURL::IsSourcesPath ( ) const

◆ IsStack()

bool CURL::IsStack ( ) const

◆ IsUPnP()

bool CURL::IsUPnP ( ) const

◆ IsVideoDb()

bool CURL::IsVideoDb ( ) const

◆ IsZIP()

bool CURL::IsZIP ( ) const

◆ operator=() [1/2]

CURL & CURL::operator= ( const CURL & )
default

◆ operator=() [2/2]

CURL & CURL::operator= ( CURL && other)

◆ operator==()

bool CURL::operator== ( const CURL & url) const
inline

◆ Parse()

void CURL::Parse ( std::string strURL)

Interpret Kodi mixed native-path/URI input without a strict validity gate.

Note
Recognized drive prefixes and unknown authority-free schemes remain native; use ParseURI for explicit URI intent. Legacy adapters retain their normalization; new URI forms preserve spelling, including malformed bodies.
Todo
fix all Addon paths

◆ ParseNativePath()

void CURL::ParseNativePath ( std::string path)

Store an explicitly native filename without URI detection or normalization.

Note
Clears all URI state; ?, #, +, % and colons remain filename bytes.

◆ ParseURI()

bool CURL::ParseURI ( std::string uri)

Parse an explicit URI, including one-letter schemes.

Returns
Generic syntax validity; malformed URIs remain lossless. Input without a scheme resets the object and returns false.

◆ PreservesQueryIdentity()

bool CURL::PreservesQueryIdentity ( ) const

Whether path operations must retain the query as resource identity.

◆ RemoveOption()

void CURL::RemoveOption ( const std::string & key)

◆ RemoveProtocolOption()

void CURL::RemoveProtocolOption ( const std::string & key)

◆ Reset()

void CURL::Reset ( )

◆ SetDomain()

void CURL::SetDomain ( std::string strDomain)
inline

◆ SetFileName()

void CURL::SetFileName ( std::string strFileName)

Replace the legacy filename or lossless navigable raw path.

Note
Non-file identifiers are unchanged. Use SetURIPath to observe failure. Legacy authority/credential/port setters likewise leave lossless forms unchanged.

◆ SetHostName()

void CURL::SetHostName ( std::string strHostName)
inline

◆ SetOption()

void CURL::SetOption ( const std::string & key,
const std::string & value )

◆ SetOptions()

void CURL::SetOptions ( std::string strOptions)

Set legacy options; lossless URI forms reject this operation unchanged.

Note
Legacy map/transport-option setters also reject lossless forms with a warning. Read-only map access is empty for those forms; use raw component access instead.

◆ SetPassword()

void CURL::SetPassword ( std::string strPassword)
inline

◆ SetPort()

void CURL::SetPort ( int port)
inline

◆ SetProtocol()

void CURL::SetProtocol ( std::string strProtocol)

Change the scheme, preserving component bytes for lossless forms.

Note
Invalid scheme tokens leave the object unchanged. An empty scheme switches to native path bytes and clears URI state. Transitions to established scheme:// adapters reapply their normalization; authority-free forms remain lossless.

◆ SetProtocolOption()

void CURL::SetProtocolOption ( const std::string & key,
const std::string & value )

◆ SetProtocolOptions()

void CURL::SetProtocolOptions ( std::string strOptions)

◆ SetRawQuery()

bool CURL::SetRawQuery ( std::optional< std::string > query)

Replace the raw query of a lossless URI without a map or form decoding.

Parameters
queryNo value removes the delimiter; an empty value retains an empty ?.
Returns
False without changes for legacy storage or invalid query syntax.
Note
Duplicate/empty fields, plus signs and percent-escape spelling are retained.

◆ SetURIPath()

bool CURL::SetURIPath ( std::string path)

Replace a lossless URI's raw path, preserving all other components.

Returns
False without changes for unsupported policy or invalid path syntax.
Note
With an authority, paths must be empty or slash-prefixed; without one, they cannot start with "//". Magnet paths must be empty or absolute.

◆ SetUserName()

void CURL::SetUserName ( std::string strUserName)
inline

◆ SupportsPathOperations()

bool CURL::SupportsPathOperations ( ) const

Whether this location supports filesystem-style path operations.

Note
Only absolute, authority-free magnet member paths are navigable.

Friends And Related Symbol Documentation

◆ CURIRedactor

friend class CURIRedactor
friend

◆ operator==

bool operator== ( const CURL & url,
const std::string_view str )
friend

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