Wt  4.12.1
Public Member Functions | List of all members
Wt::WAbstractDataInfo Class Reference

An abstract base class storing information of a resource. More...

Inheritance diagram for Wt::WAbstractDataInfo:
[legend]

Public Member Functions

virtual std::string filePath () const
 Returns a path to a file containing the data. More...
 
virtual std::string url () const
 Returns the URL of the data. More...
 
virtual std::string dataUri () const
 Returns the data in data URI format. More...
 
virtual std::string name () const
 Returns the name of the Data. More...
 
virtual bool hasFilePath () const
 Returns whether this contains a path to a file. More...
 
virtual bool hasUrl () const
 Returns whether this contains a URL. More...
 
virtual bool hasDataUri () const
 Returns whether this can return the data in data URI format. More...
 

Detailed Description

An abstract base class storing information of a resource.

This is an abstract class which is meant to store/compute information about a resource/file. Its primary use is to map URIs to file paths. This is to avoid confusion when rendering out these resources, so that depending on the context the resources is created under, locating the file correctly happens.

Member Function Documentation

◆ dataUri()

std::string Wt::WAbstractDataInfo::dataUri ( ) const
virtual

Returns the data in data URI format.

This returns the data in data URI format (see: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data).

By default this will throw an exception.

Warning
If you reimplement this function, you must also reimplement hasDataUri()
See also
hasDataUri()

Reimplemented in Wt::WDataInfo.

◆ filePath()

std::string Wt::WAbstractDataInfo::filePath ( ) const
virtual

Returns a path to a file containing the data.

This returns a path to a file containing the data. This should point to a path that exists on the system.

By default this will throw an exception.

Warning
If you reimplement this function, you must also reimplement hasFilePath()
See also
hasFilePath()

Reimplemented in Wt::WDocRootDataInfo, and Wt::WDataInfo.

◆ hasDataUri()

virtual bool Wt::WAbstractDataInfo::hasDataUri ( ) const
virtual

Returns whether this can return the data in data URI format.

This returns whether dataUri() returns the data in data URI format.

By default this returns false.

See also
dataUri()

Reimplemented in Wt::WDataInfo.

◆ hasFilePath()

virtual bool Wt::WAbstractDataInfo::hasFilePath ( ) const
virtual

Returns whether this contains a path to a file.

This returns whether filePath returns a path to a file containing the data.

By default this returns false.

See also
filePath()

Reimplemented in Wt::WDocRootDataInfo, and Wt::WDataInfo.

◆ hasUrl()

virtual bool Wt::WAbstractDataInfo::hasUrl ( ) const
virtual

Returns whether this contains a URL.

This returns whether url() returns a URL of the data.

By default this returns false.

See also
url()

Reimplemented in Wt::WDocRootDataInfo, and Wt::WDataInfo.

◆ name()

std::string Wt::WAbstractDataInfo::name ( ) const
virtual

Returns the name of the Data.

This returns the name of the data. This is mainly use for error reporting.

By default this will return url() if hasUrl() is true. In case it is false, it will return filePath() if hasFilePath() is true, and it will return an empty string otherwise.

◆ url()

std::string Wt::WAbstractDataInfo::url ( ) const
virtual

Returns the URL of the data.

This returns the URL of the data. This can be both an absolute URL or a URL relative to the application's base URL.

By default this will throw an exception.

Warning
If you reimplement this function, you must also reimplement hasUrl()
See also
hasUrl()

Reimplemented in Wt::WDocRootDataInfo, and Wt::WDataInfo.