Resource implementation for a local file. More...
#include <resource_locator.h>
Public Types | |
using | ConstPtr = std::shared_ptr< const SimpleLocatedResource > |
using | Ptr = std::shared_ptr< SimpleLocatedResource > |
![]() | |
using | ConstPtr = std::shared_ptr< const Resource > |
using | Ptr = std::shared_ptr< Resource > |
![]() | |
using | ConstPtr = std::shared_ptr< const ResourceLocator > |
using | Ptr = std::shared_ptr< ResourceLocator > |
Public Member Functions | |
std::string | getFilePath () const override final |
Get the file path of the resource. Only valid if isFile() is true. More... | |
std::vector< uint8_t > | getResourceContents () const override final |
Get the resource as bytes. This function may block. More... | |
std::shared_ptr< std::istream > | getResourceContentStream () const override final |
Get the resource as a std::istream. This function and the returned stream may block. More... | |
std::string | getUrl () const override final |
Get the original URL used to locate the file. More... | |
bool | isFile () const override final |
Returns true if the located resource is a local file. More... | |
Resource::Ptr | locateResource (const std::string &url) const override final |
Locate a resource based on a URL. More... | |
bool | operator!= (const SimpleLocatedResource &rhs) const |
SimpleLocatedResource & | operator= (const SimpleLocatedResource &)=default |
SimpleLocatedResource & | operator= (SimpleLocatedResource &&)=default |
bool | operator== (const SimpleLocatedResource &rhs) const |
SimpleLocatedResource ()=default | |
This is for boost serialization do not use directly. More... | |
SimpleLocatedResource (const SimpleLocatedResource &)=default | |
SimpleLocatedResource (SimpleLocatedResource &&)=default | |
SimpleLocatedResource (std::string url, std::string filename, ResourceLocator::ConstPtr parent=nullptr) | |
A generic resource. More... | |
~SimpleLocatedResource () override=default | |
![]() | |
bool | operator!= (const Resource &rhs) const |
bool | operator== (const Resource &rhs) const |
![]() | |
bool | operator!= (const ResourceLocator &rhs) const |
bool | operator== (const ResourceLocator &rhs) const |
virtual | ~ResourceLocator ()=default |
Private Member Functions | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Private Attributes | |
std::string | filename_ |
ResourceLocator::ConstPtr | parent_ |
std::string | url_ |
Friends | |
class | boost::serialization::access |
struct | tesseract_common::Serialization |
Resource implementation for a local file.
Definition at line 201 of file resource_locator.h.
using tesseract_common::SimpleLocatedResource::ConstPtr = std::shared_ptr<const SimpleLocatedResource> |
Definition at line 205 of file resource_locator.h.
using tesseract_common::SimpleLocatedResource::Ptr = std::shared_ptr<SimpleLocatedResource> |
Definition at line 204 of file resource_locator.h.
|
default |
This is for boost serialization do not use directly.
tesseract_common::SimpleLocatedResource::SimpleLocatedResource | ( | std::string | url, |
std::string | filename, | ||
ResourceLocator::ConstPtr | parent = nullptr |
||
) |
A generic resource.
url | The url to the resource |
filename | The file path to the resource |
parent | The locator used to locate the resource |
Definition at line 228 of file resource_locator.cpp.
|
overridedefault |
|
default |
|
default |
|
finaloverridevirtual |
Get the file path of the resource. Only valid if isFile() is true.
Implements tesseract_common::Resource.
Definition at line 237 of file resource_locator.cpp.
|
finaloverridevirtual |
Get the resource as bytes. This function may block.
Implements tesseract_common::Resource.
Definition at line 239 of file resource_locator.cpp.
|
finaloverridevirtual |
Get the resource as a std::istream. This function and the returned stream may block.
Implements tesseract_common::Resource.
Definition at line 259 of file resource_locator.cpp.
|
finaloverridevirtual |
Get the original URL used to locate the file.
Implements tesseract_common::Resource.
Definition at line 235 of file resource_locator.cpp.
|
finaloverridevirtual |
Returns true if the located resource is a local file.
Implements tesseract_common::Resource.
Definition at line 233 of file resource_locator.cpp.
|
finaloverridevirtual |
Locate a resource based on a URL.
url | The URL of the resource |
Implements tesseract_common::ResourceLocator.
Definition at line 270 of file resource_locator.cpp.
bool tesseract_common::SimpleLocatedResource::operator!= | ( | const SimpleLocatedResource & | rhs | ) | const |
Definition at line 311 of file resource_locator.cpp.
|
default |
|
default |
bool tesseract_common::SimpleLocatedResource::operator== | ( | const SimpleLocatedResource & | rhs | ) | const |
Definition at line 301 of file resource_locator.cpp.
|
private |
Definition at line 314 of file resource_locator.cpp.
|
friend |
Definition at line 243 of file resource_locator.h.
|
friend |
Definition at line 244 of file resource_locator.h.
|
private |
Definition at line 240 of file resource_locator.h.
|
private |
Definition at line 241 of file resource_locator.h.
|
private |
Definition at line 239 of file resource_locator.h.