Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGImageFileHandler.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef OSGIMAGEFILEHANDLER_CLASS_DECLARATION
00040 #define OSGIMAGEFILEHANDLER_CLASS_DECLARATION
00041 #ifdef  __sgi
00042 #pragma  once
00043 #endif
00044 
00045 #include <list>
00046 #include <map>
00047 
00048 #include <OSGSystemDef.h>
00049 #include <OSGBaseTypes.h>
00050 #include <OSGIDStringLink.h>
00051 #include <OSGImageFileType.h>
00052 
00053 
00054 OSG_BEGIN_NAMESPACE
00055 
00056 class PathHandler;
00057 
00062 class OSG_SYSTEMLIB_DLLMAPPING ImageFileHandler {
00063 
00064     friend class ImageFileType;
00065 
00066     /*==========================  PUBLIC  =================================*/
00067   public:
00068     /*---------------------------------------------------------------------*/
00072     virtual ~ImageFileHandler (void);
00073 
00075     /*---------------------------------------------------------------------*/
00079     virtual ImagePtr read  ( const char *fileName, const char *mimeType = 0);
00080 
00081     virtual bool     read  ( ImagePtr &image,
00082                              const char *fileName, const char *mimeType = 0);
00083 
00084     virtual bool    write ( const ImagePtr &image,
00085                             const char *fileName, const char *mimeType = 0);
00086     
00088     /*---------------------------------------------------------------------*/
00092     virtual PathHandler* getPathHandler(void                     );
00093     virtual void         setPathHandler(PathHandler *pPathHandler);
00094     
00096     /*---------------------------------------------------------------------*/
00100     virtual UInt64 restore ( ImagePtr &image,
00101                              const UChar8 *buffer, Int32 memSize = -1 );
00102 
00103     virtual UInt64 store   ( const ImagePtr &image, const char *mimeType,
00104                              UChar8 *buffer, Int32 memSize = -1 );
00105 
00106     virtual UChar8* store  ( const ImagePtr &image, UInt64 &memSize,
00107                              const char *mimeType = 0);
00109     /*---------------------------------------------------------------------*/
00113     ImageFileType * getFileType    ( const char *mimeType,
00114                                      const char *fileName = 0,
00115                                      bool validateHeader = false);
00116 
00117     ImageFileType * getDefaultType (void);
00118 
00119     virtual int getSuffixList(std::list<const Char8*> & suffixList,
00120                             UInt32 flags = ImageFileType::OSG_READ_SUPPORTED |
00121                                            ImageFileType::OSG_WRITE_SUPPORTED);
00122 
00124     /*---------------------------------------------------------------------*/
00128     void dump (void);
00129 
00131     /*---------------------------------------------------------------------*/
00135     static ImageFileHandler & the (void);
00136 
00139     /*=========================  PROTECTED  ===============================*/
00140   protected:
00141 
00142     /*==========================  PRIVATE  ================================*/
00143 private:
00144 
00145     static ImageFileHandler             *_the;
00146 
00147     std::map<IDString, ImageFileType *>  _suffixTypeMap;
00148 
00149     static bool addImageFileType (ImageFileType &fileType);
00150 
00151     PathHandler* _pPathHandler;
00152 
00153     static const std::string _fileNameKey;
00154 
00155     static const std::string _fullFilePathKey;
00156 
00157     /*---------------------------------------------------------------------*/
00161     ImageFileHandler (void);
00162     ImageFileHandler(const ImageFileHandler &obj);
00163 
00165 };
00166 
00167 typedef ImageFileHandler* ImageFileHandlerP;
00168 
00169 OSG_END_NAMESPACE
00170 
00171 #endif // OSGIMAGEFILEHANDLER_CLASS_DECLARATION

Generated on Thu Aug 25 04:06:20 2005 for OpenSG by  doxygen 1.4.3