swift
Loading...
Searching...
No Matches
swift::misc::network::CUrl Class Reference

Value object encapsulating information of a location, kind of simplified CValueObject compliant version of QUrl. More...

#include <url.h>

Inheritance diagram for swift::misc::network::CUrl:
[legend]

Public Types

enum  ColumnIndex {
  IndexScheme = CPropertyIndexRef::GlobalIndexCUrl , IndexHost , IndexPort , IndexPath ,
  IndexQuery
}
 Properties by index. More...
Public Types inherited from swift::misc::CValueObject< CUrl >
using base_type
 Base class.
Public Types inherited from swift::misc::CEmpty
using base_type = CEmpty
 Base class is alias of itself.
Public Types inherited from swift::misc::mixin::Index< CUrl >
enum  ColumnIndex
 Base class enums. More...

Public Member Functions

 CUrl (const QString &fullUrl=QString())
 Default constructor.
 CUrl (const char *url)
 Construct from character array.
 CUrl (const QUrl &url)
 By QUrl.
 CUrl (const QString &address, int port)
 Constructor.
 CUrl (const QString &scheme, const QString &address, int port, const QString &path)
 Constructor.
const QString & getHost () const
 Get host.
void setHost (const QString &address)
 Set address (e.g. myserver.foo.com).
const QString & getScheme () const
 Get protocl.
void setScheme (const QString &protocol)
 Set protocol.
bool hasScheme () const
 Protocol.
const QString & getPath () const
 Get path.
void setPath (const QString &path)
 Set path.
QString appendPath (const QString &pathToAppend)
 Append path.
bool hasPath () const
 Has path?
int getPort () const
 Get port.
void setPort (int port)
 Set port.
bool hasPort () const
 Port?
bool hasDefaultPort () const
 Default port.
QString getQuery () const
 Get query part.
void setQuery (const QString &query)
 Set query.
bool hasQuery () const
 Query string?
void appendQuery (const QString &queryToAppend)
 Append query.
void appendQuery (const QString &key, const QString &value)
 Append query.
bool hasFragment () const
 Fragment string?
void setFragment (const QString &fragment)
 Set fragment.
bool isEmpty () const
 Empty.
QString getFullUrl (bool withQuery=true) const
 Qualified name.
void setFullUrl (const QString &fullUrl)
 Set full URL.
QString getFileName () const
 File name.
QUrl toQUrl () const
 To QUrl.
void setQUrl (const QUrl &url)
 To QUrl.
QNetworkRequest toNetworkRequest () const
 To request.
CUrl withAppendedPath (const QString &path) const
 Append path.
CUrl withAppendedQuery (const QString &query) const
 Append path.
CUrl withSwitchedScheme (const QString &protocol, int port) const
 Switch protocol.
bool pathEndsWith (const QString &ending, Qt::CaseSensitivity cs=Qt::CaseInsensitive) const
 Path ending with?
bool isFile () const
 A path ends with "/", and file is anythingy beyond that, e.g. "path/file".
bool isFileWithSuffix (const QString &suffix={}) const
 Stricter version of isFile().
QString getFileSuffix () const
 File appendix if any, otherwise empty, does not include the ".".
QString getFileSuffixPlusDot () const
 Suffix plus dot.
bool isHavingHtmlSuffix () const
 Likely a HTM file?
bool isExecutableFile () const
 Executable file (decided by appendix).
bool isSwiftInstaller () const
 swift installer
QVariant propertyByIndex (swift::misc::CPropertyIndexRef index) const
 Property by index.
void setPropertyByIndex (swift::misc::CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
QString convertToQString (bool i18n=false) const
 Cast as QString.
QJsonObject toJson () const
 Cast to JSON object.
void convertFromJson (const QJsonObject &json)
 Assign from JSON object.
 operator QUrl () const
 Convert to QUrl.
Public Member Functions inherited from swift::misc::mixin::MetaType< CUrl >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object.
QString getClassName () const
 Class name.
bool isA (int metaTypeId) const
 Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
Public Member Functions inherited from swift::misc::mixin::DBusByMetaClass< CUrl >
void marshallToDbus (QDBusArgument &arg, Tags...) const
 Marshall without begin/endStructure, for when composed within another object.
void unmarshallFromDbus (const QDBusArgument &arg, Tags...)
 Unmarshall without begin/endStructure, for when composed within another object.
Public Member Functions inherited from swift::misc::mixin::DataStreamByMetaClass< CUrl >
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream.
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream.
Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< CUrl >
QJsonObject toJson () const
 Cast to JSON object.
QString toJsonString (QJsonDocument::JsonFormat format=QJsonDocument::Indented) const
 Convenience function JSON as string.
void convertFromJson (const QJsonObject &json)
 Assign from JSON object.
Public Member Functions inherited from swift::misc::mixin::String< CUrl >
QString toQString (bool i18n=false) const
 Cast as QString.
std::string toStdString (bool i18n=false) const
 To std string.
QString stringForStreaming () const
 String for streaming operators.
Public Member Functions inherited from swift::misc::mixin::Index< CUrl >
CPropertyIndexList apply (const CPropertyIndexVariantMap &indexMap, bool skipEqualValues=false)
 Update by variant map.
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const CUrl &compareValue) const
 Compare for index.
bool equalsPropertyByIndex (const QVariant &compareValue, CPropertyIndexRef index) const
 Is given variant equal to value of property index?
Public Member Functions inherited from swift::misc::mixin::Icon< CUrl >
CIcons::CIcons::StandardIconUnknown16 toIcon () const
 As icon, not implemented by all classes.

Static Public Member Functions

static int protocolToDefaultPort (const QString &protocol)
 Protocol to default port.
static bool isDefaultPort (const QString &protocol, int port)
 Default port for given protocol.
static CUrl fromLocalFile (const QString &localFile)
 From local file path.
Static Public Member Functions inherited from swift::misc::mixin::MetaType< CUrl >
static void registerMetadata ()
 Register metadata.
Static Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< CUrl >
static DerivedObj fromJson (const QJsonObject &json)
 Get object from QJsonObject.
static DerivedObj fromJsonNoThrow (const QString &jsonString, bool acceptCacheJson, bool &success, QString &errMsg)
 Get object from JSON string.

Additional Inherited Members

Protected Member Functions inherited from swift::misc::CValueObject< CUrl >
 CEmpty ()=default
 Inheriting constructors.
 CEmpty (const CEmpty &)=default
 Inheriting constructors.
 CValueObject ()=default
 Default constructor.
CValueObject & operator= (const CValueObject &)=default
 Copy assignment operator.
 ~CValueObject ()=default
 Destructor.
Protected Member Functions inherited from swift::misc::CEmpty
 CEmpty ()=default
 Protected default constructor.
 CEmpty (const CEmpty &)=default
 Protected copy constructor.
CEmpty & operator= (const CEmpty &)=default
 Protected copy assignment operator.
 ~CEmpty ()=default
 Non-virtual protected destructor.

Detailed Description

Value object encapsulating information of a location, kind of simplified CValueObject compliant version of QUrl.

Definition at line 26 of file url.h.

Member Enumeration Documentation

◆ ColumnIndex

Properties by index.

Definition at line 30 of file url.h.

Constructor & Destructor Documentation

◆ CUrl() [1/5]

swift::misc::network::CUrl::CUrl ( const QString & fullUrl = QString())

Default constructor.

Definition at line 17 of file url.cpp.

◆ CUrl() [2/5]

swift::misc::network::CUrl::CUrl ( const char * url)

Construct from character array.

Definition at line 25 of file url.cpp.

◆ CUrl() [3/5]

swift::misc::network::CUrl::CUrl ( const QUrl & url)

By QUrl.

Definition at line 27 of file url.cpp.

◆ CUrl() [4/5]

swift::misc::network::CUrl::CUrl ( const QString & address,
int port )

Constructor.

Definition at line 29 of file url.cpp.

◆ CUrl() [5/5]

swift::misc::network::CUrl::CUrl ( const QString & scheme,
const QString & address,
int port,
const QString & path )

Constructor.

Definition at line 31 of file url.cpp.

Member Function Documentation

◆ appendPath()

QString swift::misc::network::CUrl::appendPath ( const QString & pathToAppend)

Append path.

Definition at line 41 of file url.cpp.

◆ appendQuery() [1/2]

void swift::misc::network::CUrl::appendQuery ( const QString & key,
const QString & value )

Append query.

Definition at line 89 of file url.cpp.

◆ appendQuery() [2/2]

void swift::misc::network::CUrl::appendQuery ( const QString & queryToAppend)

Append query.

Definition at line 75 of file url.cpp.

◆ convertFromJson()

void swift::misc::network::CUrl::convertFromJson ( const QJsonObject & json)

Assign from JSON object.

Definition at line 246 of file url.cpp.

◆ convertToQString()

QString swift::misc::network::CUrl::convertToQString ( bool i18n = false) const

Cast as QString.

Definition at line 233 of file url.cpp.

◆ fromLocalFile()

CUrl swift::misc::network::CUrl::fromLocalFile ( const QString & localFile)
static

From local file path.

Definition at line 275 of file url.cpp.

◆ getFileName()

QString swift::misc::network::CUrl::getFileName ( ) const

File name.

Definition at line 135 of file url.cpp.

◆ getFileSuffix()

QString swift::misc::network::CUrl::getFileSuffix ( ) const

File appendix if any, otherwise empty, does not include the ".".

Remarks
similar to QFileInfo::suffix()

Definition at line 197 of file url.cpp.

◆ getFileSuffixPlusDot()

QString swift::misc::network::CUrl::getFileSuffixPlusDot ( ) const

Suffix plus dot.

Definition at line 206 of file url.cpp.

◆ getFullUrl()

QString swift::misc::network::CUrl::getFullUrl ( bool withQuery = true) const

Qualified name.

Definition at line 102 of file url.cpp.

◆ getHost()

const QString & swift::misc::network::CUrl::getHost ( ) const
inline

Get host.

Definition at line 55 of file url.h.

◆ getPath()

const QString & swift::misc::network::CUrl::getPath ( ) const
inline

Get path.

Definition at line 70 of file url.h.

◆ getPort()

int swift::misc::network::CUrl::getPort ( ) const

Get port.

Definition at line 52 of file url.cpp.

◆ getQuery()

QString swift::misc::network::CUrl::getQuery ( ) const
inline

Get query part.

Definition at line 94 of file url.h.

◆ getScheme()

const QString & swift::misc::network::CUrl::getScheme ( ) const
inline

Get protocl.

Definition at line 61 of file url.h.

◆ hasDefaultPort()

bool swift::misc::network::CUrl::hasDefaultPort ( ) const

Default port.

Definition at line 65 of file url.cpp.

◆ hasFragment()

bool swift::misc::network::CUrl::hasFragment ( ) const

Fragment string?

Definition at line 98 of file url.cpp.

◆ hasPath()

bool swift::misc::network::CUrl::hasPath ( ) const
inline

Has path?

Definition at line 79 of file url.h.

◆ hasPort()

bool swift::misc::network::CUrl::hasPort ( ) const

Port?

Definition at line 61 of file url.cpp.

◆ hasQuery()

bool swift::misc::network::CUrl::hasQuery ( ) const

Query string?

Definition at line 73 of file url.cpp.

◆ hasScheme()

bool swift::misc::network::CUrl::hasScheme ( ) const
inline

Protocol.

Definition at line 67 of file url.h.

◆ isDefaultPort()

bool swift::misc::network::CUrl::isDefaultPort ( const QString & protocol,
int port )
static

Default port for given protocol.

Definition at line 265 of file url.cpp.

◆ isEmpty()

bool swift::misc::network::CUrl::isEmpty ( ) const

Empty.

Definition at line 63 of file url.cpp.

◆ isExecutableFile()

bool swift::misc::network::CUrl::isExecutableFile ( ) const

Executable file (decided by appendix).

Definition at line 193 of file url.cpp.

◆ isFile()

bool swift::misc::network::CUrl::isFile ( ) const

A path ends with "/", and file is anythingy beyond that, e.g. "path/file".

See also
isFile with appendix

Definition at line 177 of file url.cpp.

◆ isFileWithSuffix()

bool swift::misc::network::CUrl::isFileWithSuffix ( const QString & suffix = {}) const

Stricter version of isFile().

Definition at line 183 of file url.cpp.

◆ isHavingHtmlSuffix()

bool swift::misc::network::CUrl::isHavingHtmlSuffix ( ) const

Likely a HTM file?

Definition at line 215 of file url.cpp.

◆ isSwiftInstaller()

bool swift::misc::network::CUrl::isSwiftInstaller ( ) const

swift installer

Definition at line 195 of file url.cpp.

◆ operator QUrl()

swift::misc::network::CUrl::operator QUrl ( ) const
inline

Convert to QUrl.

Definition at line 195 of file url.h.

◆ pathEndsWith()

bool swift::misc::network::CUrl::pathEndsWith ( const QString & ending,
Qt::CaseSensitivity cs = Qt::CaseInsensitive ) const

Path ending with?

Definition at line 175 of file url.cpp.

◆ propertyByIndex()

QVariant swift::misc::network::CUrl::propertyByIndex ( swift::misc::CPropertyIndexRef index) const

Property by index.

Definition at line 291 of file url.cpp.

◆ protocolToDefaultPort()

int swift::misc::network::CUrl::protocolToDefaultPort ( const QString & protocol)
static

Protocol to default port.

Definition at line 256 of file url.cpp.

◆ setFragment()

void swift::misc::network::CUrl::setFragment ( const QString & fragment)

Set fragment.

Definition at line 100 of file url.cpp.

◆ setFullUrl()

void swift::misc::network::CUrl::setFullUrl ( const QString & fullUrl)

Set full URL.

Definition at line 133 of file url.cpp.

◆ setHost()

void swift::misc::network::CUrl::setHost ( const QString & address)
inline

Set address (e.g. myserver.foo.com).

Definition at line 58 of file url.h.

◆ setPath()

void swift::misc::network::CUrl::setPath ( const QString & path)

Set path.

Definition at line 39 of file url.cpp.

◆ setPort()

void swift::misc::network::CUrl::setPort ( int port)
inline

Set port.

Definition at line 85 of file url.h.

◆ setPropertyByIndex()

void swift::misc::network::CUrl::setPropertyByIndex ( swift::misc::CPropertyIndexRef index,
const QVariant & variant )

Set property by index.

Definition at line 308 of file url.cpp.

◆ setQuery()

void swift::misc::network::CUrl::setQuery ( const QString & query)

Set query.

Definition at line 67 of file url.cpp.

◆ setQUrl()

void swift::misc::network::CUrl::setQUrl ( const QUrl & url)

To QUrl.

Definition at line 139 of file url.cpp.

◆ setScheme()

void swift::misc::network::CUrl::setScheme ( const QString & protocol)

Set protocol.

Definition at line 37 of file url.cpp.

◆ toJson()

QJsonObject swift::misc::network::CUrl::toJson ( ) const

Cast to JSON object.

Definition at line 239 of file url.cpp.

◆ toNetworkRequest()

QNetworkRequest swift::misc::network::CUrl::toNetworkRequest ( ) const

To request.

Definition at line 149 of file url.cpp.

◆ toQUrl()

QUrl swift::misc::network::CUrl::toQUrl ( ) const

To QUrl.

Definition at line 137 of file url.cpp.

◆ withAppendedPath()

CUrl swift::misc::network::CUrl::withAppendedPath ( const QString & path) const

Append path.

Definition at line 151 of file url.cpp.

◆ withAppendedQuery()

CUrl swift::misc::network::CUrl::withAppendedQuery ( const QString & query) const

Append path.

Definition at line 222 of file url.cpp.

◆ withSwitchedScheme()

CUrl swift::misc::network::CUrl::withSwitchedScheme ( const QString & protocol,
int port ) const

Switch protocol.

Definition at line 162 of file url.cpp.


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