Back to index

salome-kernel  6.5.0
SALOMEDSImpl_Tool.hxx
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 //  File      : SALOMEDSImpl_Tool.hxx
00024 //  Created   : Mon Oct 21 16:24:50 2002
00025 //  Author    : Sergey RUIN
00026 //  Project   : SALOME
00027 //  Module    : SALOMEDSImpl
00028 //
00029 #ifndef __SALOMEDSIMPL_TOOL_H__
00030 #define __SALOMEDSIMPL_TOOL_H__
00031 
00032 #include "SALOMEDSImpl_Defines.hxx"
00033 
00034 #include <string>
00035 #include <vector>
00036 #include "DF_Label.hxx"
00037 
00038 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Tool
00039 {
00040 
00041 public:
00042  
00043   // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
00044   // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
00045   static std::string GetTmpDir();
00046 
00047  
00048   // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
00049   // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
00050   static void RemoveTemporaryFiles(const std::string& theDirectory,
00051                                    const std::vector<std::string>& theFiles,
00052                                    const bool IsDirDeleted);
00053 
00054   // Returns the name by the path
00055   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
00056   static std::string GetNameFromPath(const std::string& thePath);
00057 
00058   // Returns the directory by the path
00059   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
00060   static std::string GetDirFromPath(const std::string& thePath);
00061 
00062   //The functions returns a list of substring of initial string divided by given separator
00063   static std::vector<std::string> splitString(const std::string& theValue, char separator);
00064 
00065   //The functions returns a list of substring of initial string divided by given separator, 
00066   //include empty strings
00067   static std::vector<std::string> splitStringWithEmpty(const std::string& theValue, char separator);
00068   
00069   //The functions returns a list of substring of initial string divided by given separator, 
00070   //include empty strings
00071   static std::vector< std::vector<std::string> > splitStringWithEmpty(const std::string& theValue,
00072                                                                       char separator1,
00073                                                                       char separator2);
00074   
00075 
00076   //Returns a system date  
00077   static void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds);
00078 
00079   //Returns a name of the user
00080   static std::string GetUserName();
00081 
00082 };
00083 #endif
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103