Medical Imaging Interaction Toolkit
2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
|
#include <usModuleResource.h>
Public Member Functions | |
ModuleResource () | |
ModuleResource (const ModuleResource &resource) | |
~ModuleResource () | |
ModuleResource & | operator= (const ModuleResource &resource) |
bool | operator< (const ModuleResource &resource) const |
bool | operator== (const ModuleResource &resource) const |
bool | operator!= (const ModuleResource &resource) const |
bool | IsValid () const |
operator bool_type () const | |
std::string | GetName () const |
std::string | GetPath () const |
std::string | GetResourcePath () const |
std::string | GetBaseName () const |
std::string | GetCompleteBaseName () const |
std::string | GetSuffix () const |
std::string | GetCompleteSuffix () const |
bool | IsDir () const |
bool | IsFile () const |
std::vector< std::string > | GetChildren () const |
std::vector< ModuleResource > | GetChildResources () const |
int | GetSize () const |
time_t | GetLastModified () const |
Represents a resource (text file, image, etc.) embedded in a CppMicroServices module.
A ModuleResource
object provides information about a resource (external file) which was embedded into this module's shared library. ModuleResource
objects can be obtained be calling Module::GetResource or Module::FindResources.
Example code for retrieving a resource object and reading its contents:
ModuleResource objects have value semantics and copies are very inexpensive.
Definition at line 55 of file usModuleResource.h.
us::ModuleResource::ModuleResource | ( | ) |
Creates in invalid ModuleResource object.
us::ModuleResource::ModuleResource | ( | const ModuleResource & | resource | ) |
Copy constructor.
resource | The object to be copied. |
us::ModuleResource::~ModuleResource | ( | ) |
std::string us::ModuleResource::GetBaseName | ( | ) | const |
Returns the base name of the resource without the path.
Example:
std::vector<std::string> us::ModuleResource::GetChildren | ( | ) | const |
Returns a list of resource names which are children of this object.
The returned names are relative to the path of this ModuleResource object and may contain file as well as directory entries.
std::vector<ModuleResource> us::ModuleResource::GetChildResources | ( | ) | const |
Returns a list of resource objects which are children of this object.
The return ModuleResource objects may contain files as well as directory resources.
std::string us::ModuleResource::GetCompleteBaseName | ( | ) | const |
Returns the complete base name of the resource without the path.
Example:
std::string us::ModuleResource::GetCompleteSuffix | ( | ) | const |
Returns the complete suffix of the resource.
The suffix consists of all characters in the resource name after (but not including) the first '.'.
Example:
time_t us::ModuleResource::GetLastModified | ( | ) | const |
Returns the last modified time of this resource in seconds from the epoch.
std::string us::ModuleResource::GetName | ( | ) | const |
Returns the name of the resource, excluding the path.
Example:
std::string us::ModuleResource::GetPath | ( | ) | const |
Returns the resource's path, without the file name.
Example:
The path with always begin and end with a forward slash.
std::string us::ModuleResource::GetResourcePath | ( | ) | const |
int us::ModuleResource::GetSize | ( | ) | const |
Returns the size of the resource data for this ModuleResource object.
std::string us::ModuleResource::GetSuffix | ( | ) | const |
Returns the suffix of the resource.
The suffix consists of all characters in the resource name after (but not including) the last '.'.
Example:
bool us::ModuleResource::IsDir | ( | ) | const |
Returns true
if this ModuleResource object points to a directory and thus may have child resources.
true
if this object points to a directory, false
otherwise. bool us::ModuleResource::IsFile | ( | ) | const |
Returns true
if this ModuleResource object points to a file resource.
true
if this object points to an embedded file, false
otherwise. bool us::ModuleResource::IsValid | ( | ) | const |
Tests this ModuleResource object for validity.
Invalid ModuleResource objects are created by the default constructor or can be returned by the Module class if the resource path is not found.
true
if this ModuleReource object is valid and can safely be used, false
otherwise. us::ModuleResource::operator bool_type | ( | ) | const |
Boolean conversion operator using IsValid().
bool us::ModuleResource::operator!= | ( | const ModuleResource & | resource | ) | const |
Inequality operator for ModuleResource objects.
resource | The object for testing inequality. |
!(*this == resource)
. bool us::ModuleResource::operator< | ( | const ModuleResource & | resource | ) | const |
A less then operator using the full resource path as returned by GetResourcePath() to define the ordering.
resource | The object to which this ModuleResource object is compared to. |
true
if this ModuleResource object is less then resource
, false
otherwise. ModuleResource& us::ModuleResource::operator= | ( | const ModuleResource & | resource | ) |
Assignment operator.
resource | The ModuleResource object which is assigned to this instance. |
bool us::ModuleResource::operator== | ( | const ModuleResource & | resource | ) | const |
Equality operator for ModuleResource objects.
resource | The object for testing equality. |
true
if this ModuleResource object is equal to resource
, i.e. they are coming from the same module (shared or static) and have an equal resource path, false
otherwise.