- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ufo::UFileArchive Class Reference

A simple abstraction to read files. More...

#include <ufilearchive.hpp>

Inheritance diagram for ufo::UFileArchive:

ufo::UObject ufo::UCollectable List of all members.

Public Member Functions

 UFileArchive ()
 UFileArchive (const std::string &searchPath)
void addArchive (const std::string &arc)
bool removeArchive (const std::string &arc)
void removeAllArchives ()
void addSearchPath (const std::string &searchPath)
std::string getSearchPath () const
std::vector< std::string > getSearchPathAsVector () const
bool existsInArchive (const std::string &fileName)
std::string getAbsolutePath (const std::string &fileName) const

Static Public Member Functions

bool exists (const std::string &fileName)
std::vector< std::string > readDir (const std::string &path)
std::string dirName (const std::string &path)
bool isDirectory (const std::string &path)
UFileArchivegetDefault ()
void setDefault (UFileArchive *archive)

Detailed Description

A simple abstraction to read files.

This class provides two static methods to check the content of a directory and to check whether a file exists. Furthermore, there is one default instance for file archives to load data from.

Author:
Johannes Schmidt


Constructor & Destructor Documentation

ufo::UFileArchive::UFileArchive  ) 
 

Creates an empty file archive.

ufo::UFileArchive::UFileArchive const std::string &  searchPath  ) 
 

Creates a file archive with the given colon separated search path.


Member Function Documentation

void ufo::UFileArchive::addArchive const std::string &  arc  ) 
 

adds a further directory to the search path.

void ufo::UFileArchive::addSearchPath const std::string &  searchPath  ) 
 

Adds a colon (i.e. ':') separated list to the search path.

std::string ufo::UFileArchive::dirName const std::string &  path  )  [static]
 

Determins the directory component of a given path. Example:

 dirNname ("/usr/local/foobar");  --> Returns: "/usr/local"
Returns:
The directory name

bool ufo::UFileArchive::exists const std::string &  fileName  )  [static]
 

Checks if a file exists

Parameters:
fileName file to check
Returns:
true if the file exists

bool ufo::UFileArchive::existsInArchive const std::string &  fileName  ) 
 

Checks if a file with the given file name exists in the search path

Parameters:
fileName file to check
Returns:
true if the file exists

std::string ufo::UFileArchive::getAbsolutePath const std::string &  fileName  )  const
 

Parameters:
fileName file to search for
Returns:
The full path name of the given file name if found in the search path, otherwise an empty string.

std::string ufo::UFileArchive::getSearchPath  )  const
 

Returns a colon separated list of the search path. Can be tokenized via UString tokenizer.

See also:
UString

std::vector<std::string> ufo::UFileArchive::getSearchPathAsVector  )  const
 

Returns the search path as vector.

See also:
UString

bool ufo::UFileArchive::isDirectory const std::string &  path  )  [static]
 

Determines if the given path is really a directory.

Returns:
True if path is a directory, otherwise false.

std::vector<std::string> ufo::UFileArchive::readDir const std::string &  path  )  [static]
 

Reads the contents of the given directory.

Returns:
A vector with all files found in the given directory

void ufo::UFileArchive::removeAllArchives  ) 
 

cleans up the search path

bool ufo::UFileArchive::removeArchive const std::string &  arc  ) 
 

removes the given directory from the search path


The documentation for this class was generated from the following file:
The libUFO Project - written by Johannes Schmidt