LoadableModule.h++

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002    commonc++ - A C++ Common Class Library
00003    Copyright (C) 2005-2012  Mark A Lindner
00004 
00005    This file is part of commonc++.
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public
00018    License along with this library; if not, write to the Free
00019    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020    ---------------------------------------------------------------------------
00021 */
00022 
00023 #ifndef __ccxx_LoadableModule_hxx
00024 #define __ccxx_LoadableModule_hxx
00025 
00026 #include <commonc++/Common.h++>
00027 #include <commonc++/IOException.h++>
00028 #include <commonc++/String.h++>
00029 #include <commonc++/Version.h++>
00030 
00031 namespace ccxx {
00032 
00041 class COMMONCPP_API LoadableModule
00042 {
00043   public:
00044 
00051   LoadableModule(const String &path = String::null);
00052 
00055   ~LoadableModule() throw();
00056 
00063   void open() throw(IOException);
00064 
00067   void close() throw();
00068 
00072   inline bool isOpen() const throw()
00073   { return(_open); }
00074 
00082   void *lookup(const char *symbol) throw();
00083 
00091   inline void * lookup(const String &symbol) throw()
00092   { return(lookup(symbol.c_str())); }
00093 
00101   inline void * operator[](const char *symbol) throw()
00102   { return(lookup(symbol)); }
00103 
00111   inline void * operator[](const String &symbol) throw()
00112   { return(lookup(symbol.c_str())); }
00113 
00118   inline void setPath(const String &path) throw()
00119   { if(!_open) _path = path; }
00120 
00124   inline String getPath() const throw()
00125   { return(_path); }
00126 
00132   static String getExtension() throw();
00133 
00139   static String getPrefix() throw();
00140 
00150   static String fileNameForStem(const String& stem) throw();
00151 
00165   static String fileNameForStem(const String& stem, const Version& version)
00166     throw();
00167 
00174   static bool isLoadableModuleFile(const String& fileName) throw();
00175 
00176   private:
00177 
00178   String _path;
00179   bool _open;
00180 
00181 #ifdef CCXX_OS_WINDOWS
00182   HINSTANCE _handle;
00183 #else
00184   void *_handle;
00185 #endif
00186 
00187   CCXX_COPY_DECLS(LoadableModule);
00188 };
00189 
00190 }; // namespace ccxx
00191 
00192 #endif // __ccxx_LoadableModule_hxx
00193 
00194 /* end of header file */
Generated on Sat Nov 26 16:49:07 2011 for libcommonc++ by  doxygen 1.6.3