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