Medical Imaging Interaction Toolkit
2016.11.0
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 retreiving 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.
Definition at line 102 of file usModuleResource.cpp.
Referenced by GetChildResources().
us::ModuleResource::ModuleResource | ( | const ModuleResource & | resource | ) |
Copy constructor.
resource | The object to be copied. |
Definition at line 107 of file usModuleResource.cpp.
us::ModuleResource::~ModuleResource | ( | ) |
Definition at line 130 of file usModuleResource.cpp.
std::string us::ModuleResource::GetBaseName | ( | ) | const |
Returns the base name of the resource without the path.
Example:
Definition at line 189 of file usModuleResource.cpp.
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.
Definition at line 221 of file usModuleResource.cpp.
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.
Definition at line 233 of file usModuleResource.cpp.
References GetResourcePath(), IsDir(), IsValid(), and ModuleResource().
std::string us::ModuleResource::GetCompleteBaseName | ( | ) | const |
Returns the complete base name of the resource without the path.
Example:
Definition at line 194 of file usModuleResource.cpp.
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:
Definition at line 205 of file usModuleResource.cpp.
time_t us::ModuleResource::GetLastModified | ( | ) | const |
Returns the last modified time of this resource in seconds from the epoch.
Definition at line 258 of file usModuleResource.cpp.
std::string us::ModuleResource::GetName | ( | ) | const |
Returns the name of the resource, excluding the path.
Example:
Definition at line 174 of file usModuleResource.cpp.
Referenced by mitk::AbstractToFDeviceFactory::GetCameraIntrinsics(), and mitk::OclFilter::LoadSourceFiles().
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.
Definition at line 179 of file usModuleResource.cpp.
std::string us::ModuleResource::GetResourcePath | ( | ) | const |
Returns the resource path including the file name.
Definition at line 184 of file usModuleResource.cpp.
Referenced by GetChildResources(), mitk::IOUtil::Load(), operator<(), and operator==().
int us::ModuleResource::GetSize | ( | ) | const |
Returns the size of the resource data for this ModuleResource object.
Definition at line 253 of file usModuleResource.cpp.
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:
Definition at line 199 of file usModuleResource.cpp.
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. Definition at line 211 of file usModuleResource.cpp.
Referenced by GetChildren(), and GetChildResources().
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. Definition at line 216 of file usModuleResource.cpp.
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. Definition at line 164 of file usModuleResource.cpp.
Referenced by mitk::EventConfig::AddConfig(), mitk::DICOMFileReaderSelector::AddConfigFromResource(), mitk::DICOMFileReaderSelector::AddConfigsFromResources(), mitk::EventConfig::EventConfig(), mitk::AbstractToFDeviceFactory::GetCameraIntrinsics(), GetChildren(), GetChildResources(), mitk::StateMachineContainer::LoadBehavior(), SphereInterpolator::LoadLookuptables(), mitk::OclFilter::LoadSourceFiles(), QmitkToolSelectionBox::RecreateButtons(), and mitk::XML2EventParser::XML2EventParser().
us::ModuleResource::operator bool_type | ( | ) | const |
Boolean conversion operator using IsValid().
Definition at line 169 of file usModuleResource.cpp.
bool us::ModuleResource::operator!= | ( | const ModuleResource & | resource | ) | const |
Inequality operator for ModuleResource objects.
resource | The object for testing inequality. |
!(*this == resource)
. Definition at line 159 of file usModuleResource.cpp.
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. Definition at line 148 of file usModuleResource.cpp.
References GetResourcePath().
ModuleResource & us::ModuleResource::operator= | ( | const ModuleResource & | resource | ) |
Assignment operator.
resource | The ModuleResource object which is assigned to this instance. |
Definition at line 136 of file usModuleResource.cpp.
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. Definition at line 153 of file usModuleResource.cpp.
References GetResourcePath().