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

A class that stores information of a file in the docroot. More...

Inheritance diagram for Wt::WDocRootDataInfo:
[legend]

Public Member Functions

 WDocRootDataInfo (const std::string &path)
 Creates a WDocRootDataInfo. More...
 
void setRelativePath (const std::string &path)
 Set the path, which should be relative to the WApplication's docroot.
 
std::string filePath () const override
 Returns a path to a file containing the data. More...
 
std::string url () const override
 Returns the URL of the data. More...
 
bool hasFilePath () const override
 Returns whether this contains a file path. More...
 
bool hasUrl () const override
 Returns whether this contains a url. More...
 
- Public Member Functions inherited from Wt::WAbstractDataInfo
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 hasDataUri () const
 Returns whether this can return the data in data URI format. More...
 

Detailed Description

A class that stores information of a file in the docroot.

This class stores the URL and the file path of a file inside of the docroot.

When providing a path to the constructor, the path ought to be relative to the docroot of the WApplication.

The URL will contain the URL relative to the application's base URL, and the file path will contain the absolute path to the file in the docroot.

See also
WDocRootDataInfo

Constructor & Destructor Documentation

◆ WDocRootDataInfo()

Wt::WDocRootDataInfo::WDocRootDataInfo ( const std::string &  path)

Creates a WDocRootDataInfo.

Creates a WDocRootDataInfo with the given path. The path must be relative to the WApplication's docroot.

Member Function Documentation

◆ filePath()

std::string Wt::WDocRootDataInfo::filePath ( ) const
overridevirtual

Returns a path to a file containing the data.

Throws if the path provided to the constructor or set with setRelativePath() was an empty string.

See also
hasFilePath()

Reimplemented from Wt::WAbstractDataInfo.

◆ hasFilePath()

bool Wt::WDocRootDataInfo::hasFilePath ( ) const
overridevirtual

Returns whether this contains a file path.

This returns whether the path provided to the constructor or set with setRelativePath() was a non-empty string.

See also
filePath()

Reimplemented from Wt::WAbstractDataInfo.

◆ hasUrl()

bool Wt::WDocRootDataInfo::hasUrl ( ) const
overridevirtual

Returns whether this contains a url.

This returns whether the path provided to the constructor or set with setRelativePath() was a non-empty string.

See also
url()

Reimplemented from Wt::WAbstractDataInfo.

◆ url()

std::string Wt::WDocRootDataInfo::url ( ) const
overridevirtual

Returns the URL of the data.

Throws if the path provided to the constructor or set with setRelativePath() was an empty string.

See also
hasUrl()

Reimplemented from Wt::WAbstractDataInfo.