swift
Public Types | Public Member Functions | Static Public Member Functions | List of all members
swift::misc::network::CUrl Class Reference

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

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

Public Types

enum  ColumnIndex {
  IndexScheme = CPropertyIndexRef::GlobalIndexCUrl , IndexHost , IndexPort , IndexPath ,
  IndexQuery
}
 Properties by index.
 
- Public Types inherited from swift::misc::CValueObject< CUrl >
using base_type = CEmpty
 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< Derived >
enum  ColumnIndex { IndexPixmap = 10 , IndexIcon , IndexString }
 Base class enums.
 

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". More...
 
bool isFileWithSuffix (const QString &suffix={}) const
 Stricter version of isFile()
 
QString getFileSuffix () const
 File appendix if any, otherwise empty, does not include the ".". More...
 
QString getFileSuffixPlusDot () const
 Suffix plus dot.
 
bool isHavingHtmlSuffix () const
 Likely a HTM file?
 
bool isExecutableFile () const
 Executable file (decided by appendix) More...
 
bool isSwiftInstaller () const
 swift installer More...
 
QVariant propertyByIndex (swift::misc::CPropertyIndexRef index) const
 Property by index. More...
 
void setPropertyByIndex (swift::misc::CPropertyIndexRef index, const QVariant &variant)
 Set property by index. More...
 
QString convertToQString (bool i18n=false) const
 Cast as QString. More...
 
QJsonObject toJson () const
 Cast to JSON object. More...
 
void convertFromJson (const QJsonObject &json)
 Assign from JSON object. More...
 
 operator QUrl () const
 Convert to QUrl.
 
- Public Member Functions inherited from swift::misc::mixin::MetaType< Derived >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object. More...
 
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< Derived, Tags >
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< Derived >
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< Derived >
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.
 
void convertFromJson (const QString &jsonString, bool acceptCacheFormat=false)
 Assign from JSON object string.
 
- Public Member Functions inherited from swift::misc::mixin::String< Derived >
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< Derived >
CPropertyIndexList apply (const CPropertyIndexVariantMap &indexMap, bool skipEqualValues=false)
 Update by variant map. More...
 
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
 
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
 
int comparePropertyByIndex (CPropertyIndexRef index, const Derived &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< Derived, IconIndex >
CIcons::IconIndex 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< Derived >
static void registerMetadata ()
 Register metadata.
 
- Static Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< Derived >
template<class DerivedObj = Derived>
static DerivedObj fromJson (const QJsonObject &json)
 Get object from QJsonObject.
 
template<class DerivedObj = Derived>
static DerivedObj fromJson (const QString &jsonString, bool acceptCacheJson=false)
 Get object from JSON string.
 
template<class DerivedObj = Derived>
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 >
 CValueObject ()=default
 Default constructor.
 
 CValueObject (const CValueObject &)=default
 Copy constructor.
 
CValueObjectoperator= (const CValueObject &)=default
 Copy assignment operator.
 
 ~CValueObject ()=default
 Destructor.
 
 CEmpty ()=default
 Inheriting constructors.
 
 CEmpty (const CEmpty &)=default
 Inheriting constructors.
 
- Protected Member Functions inherited from swift::misc::CEmpty
 CEmpty ()=default
 Protected default constructor.
 
 CEmpty (const CEmpty &)=default
 Protected copy constructor.
 
CEmptyoperator= (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 Function Documentation

◆ convertFromJson()

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

Assign from JSON object.

Definition at line 198 of file url.cpp.

◆ convertToQString()

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

Cast as QString.

Definition at line 185 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 152 of file url.cpp.

◆ isExecutableFile()

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

Executable file (decided by appendix)

Definition at line 148 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 135 of file url.cpp.

◆ isSwiftInstaller()

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

swift installer

Definition at line 150 of file url.cpp.

◆ propertyByIndex()

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

Property by index.

Definition at line 231 of file url.cpp.

◆ setPropertyByIndex()

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

Set property by index.

Definition at line 245 of file url.cpp.

◆ toJson()

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

Cast to JSON object.

Definition at line 191 of file url.cpp.


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