KPropertyComposedUrl

Search for usage in LXR

KPropertyComposedUrl Class Reference

#include <KPropertyComposedUrl.h>

Public Member Functions

 KPropertyComposedUrl ()
 
 KPropertyComposedUrl (const KPropertyComposedUrl &other)
 
 KPropertyComposedUrl (const QUrl &baseUrl, const QString &relativePath=QString())
 
 KPropertyComposedUrl (const QUrl &baseUrl, const QUrl &absoluteUrl)
 
QUrl absoluteUrl () const
 
QUrl baseUrl () const
 
bool isValid () const
 
bool operator!= (const KPropertyComposedUrl &other) const
 
KPropertyComposedUrloperator= (const KPropertyComposedUrl &other)
 
bool operator== (const KPropertyComposedUrl &other) const
 
QString relativePath () const
 
void setAbsoluteUrl (const QUrl &absoluteUrl)
 
void setBaseUrl (const QUrl &url)
 
void setRelativePath (const QString &relativePath)
 
QUrl value () const
 

Detailed Description

A data structure that composes absolute and relative URLs.

Since
3.2

Definition at line 35 of file KPropertyComposedUrl.h.

Constructor & Destructor Documentation

◆ KPropertyComposedUrl() [1/4]

KPropertyComposedUrl::KPropertyComposedUrl ( )

Constructs empty and invalid composed URL.

Definition at line 55 of file KPropertyComposedUrl.cpp.

◆ KPropertyComposedUrl() [2/4]

KPropertyComposedUrl::KPropertyComposedUrl ( const QUrl & baseUrl,
const QString & relativePath = QString() )

Constructs composed URL with specified base URL and path relative to the base URL.

baseUrl must be a valid absolute URL, otherwise the entire composed URL is invalid. relativePath must be proper relative path. It is not important if it points to existing filesystem object.

Definition at line 60 of file KPropertyComposedUrl.cpp.

◆ KPropertyComposedUrl() [3/4]

KPropertyComposedUrl::KPropertyComposedUrl ( const QUrl & baseUrl,
const QUrl & absoluteUrl )

Constructs composed URL with specified base URL and independent absolute URL.

baseUrl must be absolute or empty URL, otherwise the entire composed URL is invalid. absoluteUrl must be absolute URL. It is not important if it points to existing filesystem object.

Because absoluteUrl carries all needed information, baseUrl is ignored in this variant of constructor. However baseUrl is still remembered and will be used if this object's value will be changed to relative path using setRelativePath().

Definition at line 67 of file KPropertyComposedUrl.cpp.

◆ KPropertyComposedUrl() [4/4]

KPropertyComposedUrl::KPropertyComposedUrl ( const KPropertyComposedUrl & other)

Constructs a copy of other.

Definition at line 74 of file KPropertyComposedUrl.cpp.

◆ ~KPropertyComposedUrl()

KPropertyComposedUrl::~KPropertyComposedUrl ( )

Definition at line 79 of file KPropertyComposedUrl.cpp.

Member Function Documentation

◆ absoluteUrl()

QUrl KPropertyComposedUrl::absoluteUrl ( ) const

Returns absolute URL that has been set for this object.

Empty URL is returned if absolute URL is not specified. In this case relative path can still be present. If absolute URL is present, relative path is empty.

Definition at line 132 of file KPropertyComposedUrl.cpp.

◆ baseUrl()

QUrl KPropertyComposedUrl::baseUrl ( ) const

Returns the base URL (absolute) or empty URL if there is no absolute base URL specified.

Definition at line 117 of file KPropertyComposedUrl.cpp.

◆ isValid()

bool KPropertyComposedUrl::isValid ( ) const

Return true if the URL value that can be computed (from base URL, absolute URL and relative path) is valid.

See also
value() for description of how value is computed.

Definition at line 160 of file KPropertyComposedUrl.cpp.

◆ operator!=()

bool KPropertyComposedUrl::operator!= ( const KPropertyComposedUrl & other) const
inline

Return true if this KPropertyComposedUrl does not equal to other.

Definition at line 88 of file KPropertyComposedUrl.h.

◆ operator=()

KPropertyComposedUrl & KPropertyComposedUrl::operator= ( const KPropertyComposedUrl & other)

Assigns other to this KPropertyComposedUrl.

Definition at line 84 of file KPropertyComposedUrl.cpp.

◆ operator==()

bool KPropertyComposedUrl::operator== ( const KPropertyComposedUrl & other) const

Return true if this KPropertyComposedUrl equals to other.

Two KPropertyComposedUrl objects are equal if they have the same values.

See also
value()

Definition at line 92 of file KPropertyComposedUrl.cpp.

◆ relativePath()

QString KPropertyComposedUrl::relativePath ( ) const

Returns relative path that has been set for this object.

Empty string is returned if there is no path assigned. Non-empty path can be used to calculate value by concatenating it with the base URL. If relativePath() is present absoluteUrl() is empty .

Definition at line 146 of file KPropertyComposedUrl.cpp.

◆ setAbsoluteUrl()

void KPropertyComposedUrl::setAbsoluteUrl ( const QUrl & absoluteUrl)

Sets a new absolute URL.

If absoluteUrl is not valid and absolute, it is cleared. If absoluteUrl is absolute, relative path (relativePath()) is cleared.

Definition at line 137 of file KPropertyComposedUrl.cpp.

◆ setBaseUrl()

void KPropertyComposedUrl::setBaseUrl ( const QUrl & url)

Sets base URL (absolute)

If baseUrl is not valid and absolute, base URL is cleared. In any case relative path (relativePath()) and absolute URL (absoluteUrl()) are not modified.

Definition at line 122 of file KPropertyComposedUrl.cpp.

◆ setRelativePath()

void KPropertyComposedUrl::setRelativePath ( const QString & relativePath)

Sets a new relative path for this object.

If relativePath is not a valid or empty path, it is cleared. If relativePath is empty or valid, absolute URL is cleared.

Definition at line 151 of file KPropertyComposedUrl.cpp.

◆ value()

QUrl KPropertyComposedUrl::value ( ) const

Returns URL value computed from base URL, absolute URL and relative path, whichever is defined.

  • If the KPropertyComposedUrl is invalid, empty QUrl is returned
  • If absolute path is present, it is returned
  • If base URL and relative path are present, URL with added relative path is returned

append necessary '/'

Definition at line 97 of file KPropertyComposedUrl.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.