#include <CeylanFileLocator.h>
Public Types | |
enum | TextOutputFormat { rawText, html } |
Defines what text output formats for TextDisplayable instances are available. More... | |
Public Member Functions | |
FileLocator () | |
Creates a new empty file locator. | |
FileLocator (const std::string &variableName, char separator= ':') | |
Creates a new file locator, whose first registered paths come from specified environment variable, parsed according to the chosen separator. | |
virtual | ~FileLocator () throw () |
Virtual destructor. | |
virtual bool | addPath (const std::string &newPath) |
Adds a new path to the set of directories gathered by the file locator. | |
virtual bool | addPaths (const std::list< std::string > &paths) |
Adds all paths in specified list to the set of directories gathered by the file locator. | |
virtual bool | addPathsFromEnvironmentVariable (const std::string &variableName, char separator= ':') |
Adds the set of directories specified by an environment variable, which are aggregated thanks to the specified separator. | |
virtual bool | removePath (const std::string &pathToRemove) |
Removes specified path from the set of directories of the file locator, if present. | |
virtual std::string | find (const std::string &filename) const |
Finds the specified file in directories listed by the locator, and returns the full path of the first match in the list. | |
virtual const std::list < std::string > & | getPaths () const |
Returns the internal list of paths managed by the locator. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns an user-friendly description of the state of this object. | |
Static Public Member Functions | |
static const std::string | ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high) |
Returns a user-friendly description of this list of pointers to text displayable instances. | |
static TextOutputFormat | GetOutputFormat () |
Returns the current overall text format to be used by TextDisplayable instances. | |
static void | SetOutputFormat (TextOutputFormat newOutputFormat) |
Sets the current overall text format to be used by TextDisplayable instances. | |
Protected Attributes | |
std::list< std::string > | _paths |
The internal list of paths of the locator. | |
Static Protected Attributes | |
static TextOutputFormat | _OutputFormat = rawText |
The text format to be used currently by TextDisplayable instances. | |
Private Member Functions | |
FileLocator (const FileLocator &source) | |
Copy constructor made private to ensure that it will be never called. | |
FileLocator & | operator= (const FileLocator &source) |
Assignment operator made private to ensure that it will be never called. |
Directories are searched in turn from the first registered one to the last.
The user may register non-existing directories in the locator. A given directory can be referenced at most one time in the locator.
Definition at line 76 of file CeylanFileLocator.h.
enum Ceylan::TextDisplayable::TextOutputFormat [inherited] |
Defines what text output formats for TextDisplayable instances are available.
Definition at line 124 of file CeylanTextDisplayable.h.
FileLocator::FileLocator | ( | ) |
FileLocator::FileLocator | ( | const std::string & | variableName, | |
char | separator = ':' | |||
) | [explicit] |
Creates a new file locator, whose first registered paths come from specified environment variable, parsed according to the chosen separator.
Definition at line 86 of file CeylanFileLocator.cc.
References addPathsFromEnvironmentVariable().
FileLocator::~FileLocator | ( | ) | throw () [virtual] |
Ceylan::System::FileLocator::FileLocator | ( | const FileLocator & | source | ) | [private] |
Copy constructor made private to ensure that it will be never called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
bool FileLocator::addPath | ( | const std::string & | newPath | ) | [virtual] |
Adds a new path to the set of directories gathered by the file locator.
newPath | a new path to add. |
Definition at line 121 of file CeylanFileLocator.cc.
References _paths, and generalUtils::true.
Referenced by addPaths().
bool FileLocator::addPaths | ( | const std::list< std::string > & | paths | ) | [virtual] |
Adds all paths in specified list to the set of directories gathered by the file locator.
paths | the list of paths to add. |
Definition at line 137 of file CeylanFileLocator.cc.
References addPath(), and generalUtils::false.
Referenced by addPathsFromEnvironmentVariable().
bool FileLocator::addPathsFromEnvironmentVariable | ( | const std::string & | variableName, | |
char | separator = ':' | |||
) | [virtual] |
Adds the set of directories specified by an environment variable, which are aggregated thanks to the specified separator.
For example, addPathsFromEnvironmentVariable( "PATH" ), with PATH = "/bin:/usr/bin:/usr/local/bin:/usr/local" adds the corresponding four directories to this file locator.
Definition at line 152 of file CeylanFileLocator.cc.
References addPaths(), Ceylan::System::getEnvironmentVariable(), and Ceylan::split().
Referenced by FileLocator().
string FileLocator::find | ( | const std::string & | filename | ) | const [virtual] |
Finds the specified file in directories listed by the locator, and returns the full path of the first match in the list.
filename | the name of the file to look for, be it a regular file or a symbolic link. |
FileLocatorException | if nothing matches, i.e. if this file is not found through recorded directories. |
Definition at line 181 of file CeylanFileLocator.cc.
References _paths, Ceylan::System::File::ExistsAsFileOrSymbolicLink(), Ceylan::System::Directory::JoinPath(), and toString().
TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat | ( | ) | [static, inherited] |
Returns the current overall text format to be used by TextDisplayable instances.
Definition at line 63 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::formatStringList(), Ceylan::formatStringMap(), Ceylan::XML::XMLMarkup::toString(), Ceylan::Maths::Linear::Vector3::toString(), Ceylan::Maths::Linear::Vector2::toString(), Ceylan::Maths::Linear::Tripoint::toString(), Ceylan::Module::toString(), Ceylan::Maths::Linear::Matrix3::toString(), Ceylan::Maths::Linear::Matrix2::toString(), Ceylan::Maths::Linear::HomogeneousMatrix3::toString(), and Ceylan::Maths::Linear::Bipoint::toString().
const std::list< std::string > & FileLocator::getPaths | ( | ) | const [virtual] |
Returns the internal list of paths managed by the locator.
Definition at line 205 of file CeylanFileLocator.cc.
References _paths.
Referenced by Ceylan::Plugin::Plugin().
FileLocator& Ceylan::System::FileLocator::operator= | ( | const FileLocator & | source | ) | [private] |
Assignment operator made private to ensure that it will be never called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
bool FileLocator::removePath | ( | const std::string & | pathToRemove | ) | [virtual] |
Removes specified path from the set of directories of the file locator, if present.
pathToRemove | the path to remove. |
Definition at line 163 of file CeylanFileLocator.cc.
References _paths, generalUtils::false, and generalUtils::true.
void TextDisplayable::SetOutputFormat | ( | TextOutputFormat | newOutputFormat | ) | [static, inherited] |
Sets the current overall text format to be used by TextDisplayable instances.
newOutputFormat | the new output format. |
Definition at line 72 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::Log::LogHolder::LogHolder().
const std::string TextDisplayable::ToString | ( | std::list< TextDisplayable * > | displayables, | |
Ceylan::VerbosityLevels | level = Ceylan::high | |||
) | [static, inherited] |
Returns a user-friendly description of this list of pointers to text displayable instances.
displayables | a list of pointers to TextDisplayable instances/ | |
level | the requested verbosity level. |
Definition at line 45 of file CeylanTextDisplayable.cc.
References Ceylan::formatStringList().
const string FileLocator::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Implements Ceylan::TextDisplayable.
Definition at line 214 of file CeylanFileLocator.cc.
References _paths, and Ceylan::formatStringList().
Referenced by find().
TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited] |
The text format to be used currently by TextDisplayable instances.
Definition at line 158 of file CeylanTextDisplayable.h.
Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().
std::list<std::string> Ceylan::System::FileLocator::_paths [protected] |
The internal list of paths of the locator.
Definition at line 222 of file CeylanFileLocator.h.
Referenced by addPath(), find(), getPaths(), removePath(), and toString().