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

sglDataLoader.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglDataLoader.hpp
00021  *   Author: Scott McMillan
00022  *  Created: 12 February 2001
00023  *  Summary: base class for model and image loaders
00024  *****************************************************************************/
00025 
00026 #ifndef SGL_DATA_LOADER
00027 #define SGL_DATA_LOADER
00028 
00029 #include <sgldb.h>
00030 #include <sglLock.hpp>
00031 #include <string>
00032 #include <map>
00033 
00034 
00039 class SGLDB_DLL_API sglDataLoader
00040 {
00041 public:
00043    virtual ~sglDataLoader() = 0;
00044 
00051    static void registerDLL(const string &extension, const string &dll_name);
00052 
00058    static void getDLL(const string &extension, string &dll_name);
00059 
00067    static bool loadDLL(const string &dll_name);
00068 
00075    static void splitString(const string &str,
00076                            vector<string> &vec,
00077                            const string &delimiters = string(";"));
00078 
00083    static void setDataPath(const vector<string> &path);
00084 
00088    static void addToDataPath(const string &path);
00089 
00093    static void getDataPath(vector<string> &path);
00094 
00099    static string extractFilenameFromPath(const string &filepath);
00100 
00105    static string extractDirectoryFromPath(const string &filepath);
00106 
00111    static string extractExtensionFromFilename(const string &filename);
00112 
00118    static bool compareExtension(const string &filename,
00119                                 const string &extension);
00120 
00128    static bool searchDir(const string &directory,
00129                          const string &filename,
00130                          string &foundname);
00131 
00136    static bool checkFile(const string &filename);
00137 
00149    static bool findFile(const string &filepath,
00150                         const string *alternate_path,
00151                         string &foundname);
00152 
00160    static int strCaseCmp(const char *s1, const char *s2);
00161 
00165    static void toUpper(string &str);
00166 
00170    static void toLower(string &str);
00171 
00172 protected:
00173    sglDataLoader();
00174    sglDataLoader(const sglDataLoader &);             // Not implemented.
00175    sglDataLoader &operator=(const sglDataLoader &);  // Not implemented.
00176 
00177 public:
00178    static string              s_dir_separators;
00179 
00180 private:
00181    static vector<string>      s_data_path;
00182 
00183    static map<string, string> s_extension_dll_map;
00184    static map<string, bool>   s_dll_loaded_map;
00185    static sglLock             s_lock;
00186 };
00187 
00188 #endif

Generated at Mon Jul 1 18:00:04 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001