#include <CeylanLoadable.h>
Public Member Functions | |
LoadableWithContent (const std::string &contentFilePath) | |
Creates a new loadable instance, whose content file is designated by the specified filename, but does not load anything. | |
virtual | ~LoadableWithContent () throw () |
Virtual destructor. | |
virtual bool | load ()=0 |
Loads the content of this instance from file. | |
virtual bool | unload ()=0 |
Unloads the content of this instance. | |
virtual bool | reload (bool forceLoad=false) |
Reloads the content of this instance. | |
virtual bool | hasContent () const |
Returns true iff the content is already loaded. | |
virtual Content & | getExistingContent () |
Returns the already loaded content. | |
virtual const Content & | getExistingContentAsConst () const |
Returns a constant reference to the already loaded content. | |
virtual Content & | getContent () |
Returns the loaded content, either directly (if already available), otherwise after having loaded it. | |
virtual const Content & | getContentAsConst () |
Returns a constant reference to the loaded content, either directly (if already available), otherwise after having loaded it. | |
virtual const std::string & | getContentPath () const |
Returns the path to the associated content file. | |
Protected Attributes | |
Content * | _content |
The loaded content, if any. | |
std::string | _contentPath |
The path to the file used for content loading. | |
Private Member Functions | |
LoadableWithContent (const LoadableWithContent &source) | |
Copy constructor made private to ensure that it will never be called. | |
LoadableWithContent & | operator= (const LoadableWithContent &source) |
Assignment operator made private to ensure that it will never be called. |
Definition at line 198 of file CeylanLoadable.h.
Ceylan::LoadableWithContent< Content >::LoadableWithContent | ( | const std::string & | contentFilePath | ) | [inline, explicit] |
Creates a new loadable instance, whose content file is designated by the specified filename, but does not load anything.
LoadableException | if the creation failed. |
Definition at line 391 of file CeylanLoadable.h.
Ceylan::LoadableWithContent< Content >::~LoadableWithContent | ( | ) | throw () [inline, virtual] |
Virtual destructor.
Definition at line 411 of file CeylanLoadable.h.
References Ceylan::LoadableWithContent< Content >::_content, and Ceylan::Log::LogPlug::error().
Ceylan::LoadableWithContent< Content >::LoadableWithContent | ( | const LoadableWithContent< Content > & | source | ) | [private] |
Copy constructor made private to ensure that it will never be called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
Content & Ceylan::LoadableWithContent< Content >::getContent | ( | ) | [inline, virtual] |
Returns the loaded content, either directly (if already available), otherwise after having loaded it.
LoadableException | if the operation failed. |
Definition at line 505 of file CeylanLoadable.h.
References Ceylan::LoadableWithContent< Content >::_content, Ceylan::LoadableWithContent< Content >::hasContent(), and Ceylan::LoadableWithContent< Content >::load().
const Content & Ceylan::LoadableWithContent< Content >::getContentAsConst | ( | ) | [inline, virtual] |
Returns a constant reference to the loaded content, either directly (if already available), otherwise after having loaded it.
LoadableException | if the operation failed. |
The method cannot be const as it may have to load the content.
Definition at line 518 of file CeylanLoadable.h.
References Ceylan::LoadableWithContent< Content >::_content, Ceylan::LoadableWithContent< Content >::hasContent(), and Ceylan::LoadableWithContent< Content >::load().
const std::string & Loadable::getContentPath | ( | ) | const [virtual, inherited] |
Returns the path to the associated content file.
Definition at line 70 of file CeylanLoadable.cc.
References Ceylan::Loadable::_contentPath.
Content & Ceylan::LoadableWithContent< Content >::getExistingContent | ( | ) | [inline, virtual] |
Returns the already loaded content.
LoadableException | if the operation failed, including if there is no available content to be returned (it will not be loaded if lacking). |
Definition at line 474 of file CeylanLoadable.h.
References Ceylan::LoadableWithContent< Content >::_content, and Ceylan::LoadableWithContent< Content >::hasContent().
const Content & Ceylan::LoadableWithContent< Content >::getExistingContentAsConst | ( | ) | const [inline, virtual] |
Returns a constant reference to the already loaded content.
LoadableException | if the operation failed, including if there is no available content to be returned (it will not be loaded if lacking). |
Definition at line 489 of file CeylanLoadable.h.
References Ceylan::LoadableWithContent< Content >::_content, and Ceylan::LoadableWithContent< Content >::hasContent().
bool Ceylan::LoadableWithContent< Content >::hasContent | ( | ) | const [inline, virtual] |
Returns true iff the content is already loaded.
Definition at line 464 of file CeylanLoadable.h.
References Ceylan::LoadableWithContent< Content >::_content.
Referenced by Ceylan::LoadableWithContent< Content >::getContent(), Ceylan::LoadableWithContent< Content >::getContentAsConst(), Ceylan::LoadableWithContent< Content >::getExistingContent(), Ceylan::LoadableWithContent< Content >::getExistingContentAsConst(), and Ceylan::LoadableWithContent< Content >::reload().
virtual bool Ceylan::LoadableWithContent< Content >::load | ( | ) | [pure virtual] |
Loads the content of this instance from file.
LoadableException | whenever the loading fails. |
Implements Ceylan::Loadable.
Referenced by Ceylan::LoadableWithContent< Content >::getContent(), Ceylan::LoadableWithContent< Content >::getContentAsConst(), and Ceylan::LoadableWithContent< Content >::reload().
LoadableWithContent& Ceylan::LoadableWithContent< Content >::operator= | ( | const LoadableWithContent< Content > & | source | ) | [private] |
Assignment operator made private to ensure that it will never be called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
bool Ceylan::LoadableWithContent< Content >::reload | ( | bool | forceLoad = false |
) | [inline, virtual] |
Reloads the content of this instance.
forceLoad | if true, then any previously loaded content will be deleted before an unconditional loading is performed. If false, then if there were no content already loaded, no loading will be performed (content availability will be kept as was), but if the content was loaded, it will be unloaded and reloaded. |
LoadableException | whenever the reloading fails. |
Definition at line 435 of file CeylanLoadable.h.
References Ceylan::LoadableWithContent< Content >::hasContent(), Ceylan::LoadableWithContent< Content >::load(), generalUtils::true, and Ceylan::LoadableWithContent< Content >::unload().
virtual bool Ceylan::LoadableWithContent< Content >::unload | ( | ) | [pure virtual] |
Unloads the content of this instance.
LoadableException | whenever the unloading fails. |
Implements Ceylan::Loadable.
Referenced by Ceylan::LoadableWithContent< Content >::reload().
Content* Ceylan::LoadableWithContent< Content >::_content [protected] |
The loaded content, if any.
Definition at line 354 of file CeylanLoadable.h.
Referenced by Ceylan::LoadableWithContent< Content >::getContent(), Ceylan::LoadableWithContent< Content >::getContentAsConst(), Ceylan::LoadableWithContent< Content >::getExistingContent(), Ceylan::LoadableWithContent< Content >::getExistingContentAsConst(), Ceylan::LoadableWithContent< Content >::hasContent(), and Ceylan::LoadableWithContent< Content >::~LoadableWithContent().
std::string Ceylan::Loadable::_contentPath [protected, inherited] |
The path to the file used for content loading.
Definition at line 153 of file CeylanLoadable.h.
Referenced by Ceylan::Loadable::getContentPath().