Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglDataLoader Class Reference

#include <sglDataLoader.hpp>

Inheritance diagram for sglDataLoader::

sglImageLoader sglModelLoader List of all members.

Public Methods

virtual ~sglDataLoader ()=0

Static Public Methods

void registerDLL (const string &extension, const string &dll_name)
void getDLL (const string &extension, string &dll_name)
bool loadDLL (const string &dll_name)
void splitString (const string &str, vector< string > &vec, const string &delimiters=string(";"))
void setDataPath (const vector< string > &path)
void addToDataPath (const string &path)
void getDataPath (vector< string > &path)
string extractFilenameFromPath (const string &filepath)
string extractDirectoryFromPath (const string &filepath)
string extractExtensionFromFilename (const string &filename)
bool compareExtension (const string &filename, const string &extension)
bool searchDir (const string &directory, const string &filename, string &foundname)
bool checkFile (const string &filename)
bool findFile (const string &filepath, const string *alternate_path, string &foundname)
int strCaseCmp (const char *s1, const char *s2)
void toUpper (string &str)
void toLower (string &str)

Static Public Attributes

string s_dir_separators

Protected Methods

 sglDataLoader ()
 sglDataLoader (const sglDataLoader &)
sglDataLoader& operator= (const sglDataLoader &)

Detailed Description

Abstract base class for loading image and 3D model files. Encapsulates helper routines for file loading.

Definition at line 39 of file sglDataLoader.hpp.


Constructor & Destructor Documentation

sglDataLoader::~sglDataLoader ( ) [pure virtual]
 

Destructor.


Member Function Documentation

void sglDataLoader::registerDLL ( const string & extension,
const string & dll_name ) [static]
 

Register a DLL and the extension it supports. Note that a single dll can support multiple extensions. Registering an extension a second time will replace the existing entry.

Parameters:
extension   extension string (lower case) that the dll supports.
dll_name   name of dll supporting the extension

void sglDataLoader::getDLL ( const string & extension,
string & dll_name ) [static]
 

Get the registered dll based on extension.

Parameters:
extension   extension to search on.
dll_name   on return contains the name of the dll if successful, otherwise it is set to an empty string.

bool sglDataLoader::loadDLL ( const string & dll_name ) [static]
 

Load the dll with the given basename, and register the image/model loader functions that correspond to the extensions for which this dll_name has been registered. Note that the true name of the dll actually loaded is system dependent: libdll_name.so on unix vs dll_name.dll on WIN32.

Returns:
true if the dll was successfully loaded

void sglDataLoader::splitString ( const string & str,
vector< string > & vec,
const string & delimiters = string(";") ) [static]
 

Helper function that splits a single string into multiple strings.

Parameters:
str   the string to be split
vec   on return contains the set of substrings
delimiters   the set of characters, any one of which may be used to delimit the substrings within the input string

void sglDataLoader::setDataPath ( const vector< string > & path ) [static]
 

Set the data path used for searching for image or model files.

Parameters:
path   the path, if empty the data path will be reset to the default "."

void sglDataLoader::addToDataPath ( const string & path ) [static]
 

Add a path to the data path search list.

Parameters:
path   the path to append to the data path search list.

void sglDataLoader::getDataPath ( vector< string > & path ) [static]
 

Get the current data path.

Parameters:
path   on return contains the directories that are searched

string sglDataLoader::extractFilenameFromPath ( const string & filepath ) [static]
 

Strip the directory from the filepath.

Parameters:
filepath   string to extract filename from
Returns:
string containing just the filename without any directory

string sglDataLoader::extractDirectoryFromPath ( const string & filepath ) [static]
 

Strip the filename from the filepath.

Parameters:
filepath   string to extract directory from
Returns:
string containing just the directory without any filename

string sglDataLoader::extractExtensionFromFilename ( const string & filename ) [static]
 

Extract extension from the filename.

Parameters:
filename   string to extract extension from
Returns:
string containing just the extension.

bool sglDataLoader::compareExtension ( const string & filename,
const string & extension ) [static]
 

Check to see if string has the given extension.

Parameters:
filename   filename to check the extension of
extension   string to check for at end of filename.
Returns:
true if the extension is found at the end of filename.

bool sglDataLoader::searchDir ( const string & directory,
const string & filename,
string & foundname ) [static]
 

Performs a case insensitive search of the given directory for a file with the given name.

Parameters:
directory   name of the directory to search
filename   name of the file to find
foundname   on success is set to the name of the file found
Returns:
true if a file is found with the given name

bool sglDataLoader::checkFile ( const string & filename ) [static]
 

Check to see if the given file exists and is readable.

Parameters:
filename   name of the file to check
Returns:
true if the file exists and is readable

bool sglDataLoader::findFile ( const string & filepath,
const string * alternate_path,
string & foundname ) [static]
 

Attempts to find a file with the given name. If the file isn't found at the location given, a search will be made in the alternative_path directory. If it still isn't found, a full search will be made in the entire data path.

Parameters:
filepath   full path name to where the file should be
alternative_path   an alternative directory to look in (if NULL, this variable will be ignored)
foundname   on success is set to the full path name of the file found
Returns:
true on success

int sglDataLoader::strCaseCmp ( const char * s1,
const char * s2 ) [static]
 

Perform a case insensitive comparison of the two strings.

Parameters:
s1   a string to compare
s2   a string to compare
Returns:
an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.

void sglDataLoader::toUpper ( string & str ) [static]
 

Convert the given string to uppercase.

Parameters:
str   the string to convert

void sglDataLoader::toLower ( string & str ) [static]
 

Convert the given string to lowercase.

Parameters:
str   the string to convert


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:07 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001