Salome HOME
c2cbaa98d7c75eb9acdba07008069235a6d817b8
[tools/medcoupling.git] / src / MEDLoader / MEDLoaderBase.hxx
1 // Copyright (C) 2007-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __MEDLOADERBASE_HXX__
22 #define __MEDLOADERBASE_HXX__
23
24 #include "MEDLoaderDefines.hxx"
25 #include "InterpKernelException.hxx"
26
27 #include <string>
28
29 class MEDLOADER_EXPORT MEDLoaderBase
30 {
31 public:
32   static int getStatusOfFile(const std::string& fileName);
33   static char *buildEmptyString(std::size_t lgth);
34   static void getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName);
35   static std::string getPathSep();
36   static std::string joinPath(const std::string& dirName, const std::string& baseName);
37   static std::string buildUnionUnit(const char *name, int nameLgth, const char *unit, int unitLgth);
38   static void splitIntoNameAndUnit(const std::string& s, std::string& name, std::string& unit);
39   static void strip(std::string& s);
40   static void safeStrCpy(const char *src, int maxLgth, char *dest, int behaviour);
41   static void safeStrCpy2(const char *src, int maxLgth, char *dest, int behaviour);
42   static std::string buildStringFromFortran(const char *expr, int lgth);
43   static void zipEqualConsChar(std::string& s, int minConsSmChar);
44   static std::string zipString(const std::string& src, int sizeToRespect);
45 public:
46   static const int EXIST_RW=0;
47   static const int NOT_EXIST=1;
48   static const int EXIST_RDONLY=2;
49   static const int EXIST_WRONLY=3;
50   static const int DIR_LOCKED=4;
51   static const char WHITE_SPACES[];
52 };
53
54 #endif