Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_Tool.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File      : SALOMEDSImpl_Tool.hxx
21 //  Created   : Mon Oct 21 16:24:50 2002
22 //  Author    : Sergey RUIN
23
24 //  Project   : SALOME
25 //  Module    : SALOMEDSImpl
26
27
28 #ifndef __SALOMEDSIMPL_TOOL_H__
29 #define __SALOMEDSIMPL_TOOL_H__
30
31 #include <string>
32 #include <vector>
33 #include "DF_Label.hxx"
34
35 class SALOMEDSImpl_Tool                                
36 {
37
38 public:
39  
40   // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
41   // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
42   static std::string GetTmpDir();
43
44  
45   // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
46   // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
47   static void RemoveTemporaryFiles(const std::string& theDirectory,
48                                    const std::vector<std::string>& theFiles,
49                                    const bool IsDirDeleted);
50
51   // Returns the name by the path
52   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
53   static std::string GetNameFromPath(const std::string& thePath);
54
55   // Returns the directory by the path
56   // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
57   static std::string GetDirFromPath(const std::string& thePath);
58
59   //The functions returns a list of substring of initial string divided by given separator
60   static std::vector<std::string> splitString(const std::string& theValue, char separator);
61
62   //Returns a system date  
63   static void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds);
64
65   //Returns a name of the user
66   static std::string GetUserName();
67
68 };
69 #endif
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89