iRoCS Toolbox  1.1.0
BaseFile.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * This file is part of the XuV Tools suite. see http://www.xuvtools.org
4  * for more information
5  *
6  * Copyright (C) 2015 Mario Emmenlauer
7  *
8  * Image Analysis Lab, University of Freiburg, Germany
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  **************************************************************************/
25 
26 #ifndef BASEFILE_HH
27 #define BASEFILE_HH BASEFILE_HH
28 
29 #ifdef HAVE_CONFIG_H
30 #include <config.hh>
31 #endif
32 
33 #include <string>
34 #include <vector>
35 
36 #ifdef _WIN32
37  #if defined(BaseFunctions_EXPORTS)
38  #define BASEFUNCTIONSDLL_API __declspec(dllexport)
39  #elif defined(BaseFunctions_USE_DLL)
40  #define BASEFUNCTIONSDLL_API __declspec(dllimport)
41  #else
42  #define BASEFUNCTIONSDLL_API
43  #endif
44 #else
45  #define BASEFUNCTIONSDLL_API
46 #endif
47 
49 public:
57  static std::string BaseName(const std::string& aPathName);
58 
66  static std::string DirName(const std::string& aPathName);
67 
78  static std::string BaseNamePath(const std::string& aPathName);
79 
89  static bool Exists(const std::string& aPathName);
90 
99  static bool IsFile(const std::string& aPathName);
100 
109  static bool IsLink(const std::string& aPathName);
110 
119  static bool IsDirectory(const std::string& aPathName);
120 
129  static bool DirectoryCreate(const std::string& aPathName);
130 
140  static bool ListDir(
141  const std::string& aInputDir, std::vector<std::string>& aFiles,
142  const std::string& aPattern);
143 
151  static bool Remove(const std::string& aPathName);
152 
161  static bool Move(const std::string& aOldName, const std::string& aNewName);
162 
171  static bool Copy(const std::string& aOldName, const std::string& aNewName);
172 
180  static std::string
181  FindUniqueUnexistingName(std::string const &aBaseName, char aPattern);
182 
191  static std::string BeautifyFilePath(const std::string& aPath);
192 
193 private:
194 #ifdef _WIN32
195  static char* realpath(const char *source, char *target);
196 #endif
197 };
198 
199 #endif
#define BASEFUNCTIONSDLL_API
Definition: BaseFile.hh:45