radarlib  1.4.6
io.hpp
Go to the documentation of this file.
1 /*
2  * Radar Library
3  *
4  * Copyright (C) 2009-2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  * Author: Guido Billi <guidobilli@gmail.com>
21  */
22 
27 #ifndef __RADAR_IO_HPP__
28 #define __RADAR_IO_HPP__
29 
30 #include <string>
31 #include <vector>
32 #include <fstream>
33 #include <stdexcept>
34 
35 #include <radarlib/defs.h>
36 
37 namespace Radar {
38 
39 /*===========================================================================*/
40 
46 class RADAR_API FileSystem
47 {
48 public:
54  static bool fileExists (const std::string& path);
60  static bool dirExists (const std::string& path);
66  static void changeDir (const std::string& path);
71  static std::string getCurrentDir ();
78  static void mkDirTree (const std::string& path);
84  static void rmDirTree (const std::string& path);
92  static void listFiles(std::vector<std::string>& result, const std::string& path, bool completePath = false);
100  static void listDirs(std::vector<std::string>& result, const std::string& path, bool completePath = false);
106  static void createFile(const std::string& path);
113  static void createFile(const std::string& path, const std::string& msg);
117  static size_t getFileSize(const std::string& path);
118 };
119 
125 class RADAR_API Path
126 {
127 public:
133  static std::string getBasePath(const std::string& path);
139  static std::string getFileName(const std::string& path);
145  static std::string getFileExt(const std::string& path);
152  static std::string changeExt(const std::string& path, const std::string& newext);
158  static std::string removeExt(const std::string& path);
159 
160 };
161 
162 /*===========================================================================*/
163 
164 }
165 
166 #endif
167 
168 
169 
170 
171 
172 
173 
174 
175 
176 
177 
178 
179 
180 
181 
182 
183 
184 
185 
186 
187 
188 
189 
190 
191 
192 
FileSystem class.
Definition: io.hpp:46
Internal library macros.
File path manipulation routines.
Definition: io.hpp:125
Definition: base64.cpp:29