Back to index

salome-gui  6.5.0
LightApp_Driver.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
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 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef LIGHTAPP_DRIVER_H
00024 #define LIGHTAPP_DRIVER_H
00025 
00026 #include "LightApp.h"
00027 
00028 #include "string"
00029 #include "vector"
00030 #include "map"
00031 
00032 #ifdef WIN32
00033 #pragma warning( disable:4251 )
00034 #endif
00035 
00038 class LIGHTAPP_EXPORT LightApp_Driver
00039 {
00040 public:
00041   LightApp_Driver();
00042   virtual ~LightApp_Driver();
00043 
00044 
00045   typedef std::vector<std::string> ListOfFiles;
00046 
00047   virtual bool        SaveDatasInFile   (const char* theFileName, bool isMultiFile);
00048   virtual bool        ReadDatasFromFile (const char* theFileName, bool isMultiFile);
00049   virtual std::string GetTmpDir      (const char* theURL, const bool isMultiFile);
00050 
00051   ListOfFiles         GetListOfFiles (const char* theModuleName);
00052   virtual void        SetListOfFiles (const char* theModuleName, const ListOfFiles theListOfFiles);
00053   virtual void        RemoveTemporaryFiles(const char* theModuleName, const bool IsDirDeleted);
00054   void                RemoveFiles( const ListOfFiles& theFiles, const bool IsDirDeleted);
00055 
00056   virtual void        ClearDriverContents();
00057 
00058 protected:
00059   void                PutFilesToStream(const std::string& theModuleName, unsigned char*& theBuffer,
00060                                        long& theBufferSize, bool theNamesOnly = false);
00061   ListOfFiles         PutStreamToFiles(const unsigned char* theBuffer,
00062                                        const long theBufferSize, bool theNamesOnly = false);
00063 
00064   std::string GetTmpDir();
00065   std::string GetDirFromPath(const std::string& thePath);
00066 
00067   void                SetIsTemporary( bool theFlag ) { myIsTemp = theFlag; }
00068   bool                IsTemporary() const { return myIsTemp; }
00069 
00070 protected:
00071   typedef std::map<std::string, ListOfFiles> MapOfListOfFiles;
00072   MapOfListOfFiles                           myMap;
00073   std::string                                myTmpDir;
00074 
00075 private:
00076   bool                                       myIsTemp;
00077 };
00078 
00079 #endif