Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
FileHandler Namespace Reference

Handles data regarding files. More...

Functions

KACTUS2_API QMultiMap< QString, QString > constructFileSuffixTable ()
 
KACTUS2_API bool filePathExists (QString const &relativeTo, QString const &filePath)
 
KACTUS2_API QString getFileTypeForSuffix (QMultiMap< QString, QString > const &fileSuffixTable, QString const &suffix)
 
KACTUS2_API bool isURI (QString const &uri)
 
KACTUS2_API bool isValidURI (QString const &relativeTo, QString const &ipxactURI)
 
KACTUS2_API QString resolvePath (QString const &ipxactURI)
 
KACTUS2_API QString resolveURI (QString const &ipxactURI)
 

Variables

const QRegularExpression URL_VALIDITY_REG_EXP
 Regular expression to validate URLs.
 

Detailed Description

Handles data regarding files.

Function Documentation

◆ constructFileSuffixTable()

KACTUS2_API QMultiMap< QString, QString > FileHandler::constructFileSuffixTable ( )

Construct a table for file types.

Returns
Table with file extension as key and file type as value.

◆ filePathExists()

KACTUS2_API bool FileHandler::filePathExists ( QString const & relativeTo,
QString const & filePath )

Check if given file path exists in the file system.

Parameters
[in]relativeToPath to resolve relative file paths from.
[in]filePathThe path to check.
Returns
True, if the path exists, otherwise false.

◆ getFileTypeForSuffix()

KACTUS2_API QString FileHandler::getFileTypeForSuffix ( QMultiMap< QString, QString > const & fileSuffixTable,
QString const & suffix )

Get a file type for the selected file extension.

Parameters
[in]fileSuffixTableTable containing file types combined with file name extensions.
[in]suffixThe selected extension.
Returns
File type matching the selected extension.

◆ isURI()

KACTUS2_API bool FileHandler::isURI ( QString const & uri)

Check if given input is a URI.

Parameters
[in]uriThe input to check.
Returns
True, if the input is a URI, otherwise false.

◆ isValidURI()

KACTUS2_API bool FileHandler::isValidURI ( QString const & relativeTo,
QString const & ipxactURI )

Check if given ipxactURI is valid.

Parameters
[in]relativeToPath to resolve relative file paths from.
[in]ipxactURIThe URI to check.
Returns
True, if the ipxactURI is valid, otherwise false.

◆ resolvePath()

KACTUS2_API QString FileHandler::resolvePath ( QString const & ipxactURI)

Resolve environment variables in a given URI to form a file path.

Parameters
[in]ipxactURI
Returns
The resolved file path.

◆ resolveURI()

KACTUS2_API QString FileHandler::resolveURI ( QString const & ipxactURI)

Resolve environment variables in a given URI to form a URI.

Parameters
[in]ipxactURI
Returns
The resolved URI.

Variable Documentation

◆ URL_VALIDITY_REG_EXP

const QRegularExpression FileHandler::URL_VALIDITY_REG_EXP
Initial value:
= QRegularExpression(
"^[a-z]{3,9}[:][/]{2}[a-z0-9]+([-.][a-z0-9]+)*([/][-a-z0-9_.;,?=&%#~+]*)*$",
QRegularExpression::CaseInsensitiveOption)

Regular expression to validate URLs.

Definition at line 27 of file FileHandler.h.