source: rrlib_util/sFileIOUtils.cpp @ 142:9fdf72ae3cdd

Last change on this file since 142:9fdf72ae3cdd was 142:9fdf72ae3cdd, checked in by Jens Wettach <wettach@…>, 4 years ago

reorganized sFileIOUtils (now only functions from rrlib/util/fileio.h should be used); added unit tests for fileio

File size: 5.8 KB
Line 
1//
2// You received this file as part of RRLib
3// Robotics Research Library
4//
5// Copyright (C) Finroc GbR (finroc.org)
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License along
18// with this program; if not, write to the Free Software Foundation, Inc.,
19// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20//
21//----------------------------------------------------------------------
22/*!\file    rrlib/util/sFileIOUtils.cpp
23 *
24 * \author  Bernd Helge Schaefer
25 * \author  Jens Wettach
26 * \author  Tim Braun
27 *
28 * \date    2005-11-15
29 *
30 */
31//----------------------------------------------------------------------
32// Includes
33//----------------------------------------------------------------------
34#include "rrlib/util/sFileIOUtils.h"
35
36#include "rrlib/util/fileio.h"
37
38//----------------------------------------------------------------------
39// Debug
40//----------------------------------------------------------------------
41
42//----------------------------------------------------------------------
43// Namespace usage
44//----------------------------------------------------------------------
45
46//----------------------------------------------------------------------
47// Namespace declaration
48//----------------------------------------------------------------------
49namespace rrlib
50{
51namespace util
52{
53
54//----------------------------------------------------------------------
55// class sFileIOUtils::GetAllFilesInDirectory()
56//----------------------------------------------------------------------
57bool sFileIOUtils::GetAllFilesInDirectory(std::string dir, std::vector<std::string> &files)
58{
59  return fileio::GetAllFilesInDirectory(dir, files);
60}
61
62
63//----------------------------------------------------------------------
64// class sFileIOUtils::GetCurrentDirectory()
65//----------------------------------------------------------------------
66std::string sFileIOUtils::GetCurrentDirectory()
67{
68  return fileio::GetCurrentDirectory();
69}
70
71
72//----------------------------------------------------------------------
73// class sFileIOUtils::ChangeCurrentDirectory()
74//----------------------------------------------------------------------
75bool sFileIOUtils::ChangeCurrentDirectory(const std::string& dir)
76{
77  return fileio::ChangeCurrentDirectory(dir);
78}
79
80
81//----------------------------------------------------------------------
82// class sFileIOUtils::CreateDirectory()
83//----------------------------------------------------------------------
84bool sFileIOUtils::CreateDirectory(const std::string& path)
85{
86  return fileio::CreateDirectory(path);
87}
88
89
90//----------------------------------------------------------------------
91// class sFileIOUtils::CreateTempfile()
92//----------------------------------------------------------------------
93std::string sFileIOUtils::CreateTempfile()
94{
95  return fileio::CreateTempFile();
96} // CreateTempfile()
97
98
99//----------------------------------------------------------------------
100// class sFileIOUtils::DeleteFile()
101//----------------------------------------------------------------------
102void sFileIOUtils::DeleteFile(const std::string& filename)
103{
104  fileio::DeleteFile(filename);
105} // DeleteFile()
106
107
108//----------------------------------------------------------------------
109// class sFileIOUtils::FileExists()
110//----------------------------------------------------------------------
111bool sFileIOUtils::FileExists(const std::string &filename)
112{
113  return fileio::FileExists(filename);
114} // FileExists()
115
116
117//----------------------------------------------------------------------
118// class sFileIOUtils::CountLineNumbers()
119//----------------------------------------------------------------------
120size_t sFileIOUtils::CountLineNumbers(const std::string &filename)
121{
122  return fileio::CountLineNumbers(filename);
123} // CountLineNumbers()
124
125
126//----------------------------------------------------------------------
127// class sFileIOUtils::ShellExpandFilename()
128//----------------------------------------------------------------------
129bool sFileIOUtils::ShellExpandFilename(std::string &file_name)
130{
131  return fileio::ShellExpandFilename(file_name);
132} // ShellExpandFilename()
133
134
135//----------------------------------------------------------------------
136// class sFileIOUtils::ShellExpandFilename()
137//----------------------------------------------------------------------
138std::string sFileIOUtils::ShellExpandFilename(const std::string &file_name)
139{
140  return fileio::ShellExpandFilename(file_name);
141} // ShellExpandFilename()
142
143
144//----------------------------------------------------------------------
145// class sFileIOUtils::ShellExpandFilename()
146//----------------------------------------------------------------------
147bool sFileIOUtils::ShellExpandFilename(std::string &result, const std::string &file_name)
148{
149  return fileio::ShellExpandFilename(result, file_name);
150} // ShellExpandFilename()
151
152
153//----------------------------------------------------------------------
154// class sFileIOUtils::SplitFullQualifiedFilename()
155//----------------------------------------------------------------------
156void sFileIOUtils::SplitFullQualifiedFilename(const std::string& complete_name, std::string& file_dir, std::string& file_base, std::string& file_ext)
157{
158  return fileio::SplitFullQualifiedFilename(complete_name, file_dir, file_base, file_ext);
159} // SplitFullQualifiedFilename()
160
161
162//----------------------------------------------------------------------
163// End of namespace declaration
164//----------------------------------------------------------------------
165}
166}
Note: See TracBrowser for help on using the repository browser.