Switch to unified view

a/src/utils/pathut.h b/src/utils/pathut.h
...
...
14
 *   Free Software Foundation, Inc.,
14
 *   Free Software Foundation, Inc.,
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
 */
16
 */
17
#ifndef _PATHUT_H_INCLUDED_
17
#ifndef _PATHUT_H_INCLUDED_
18
#define _PATHUT_H_INCLUDED_
18
#define _PATHUT_H_INCLUDED_
19
/* @(#$Id: pathut.h,v 1.8 2006-03-29 11:18:15 dockes Exp $  (C) 2004 J.F.Dockes */
19
/* @(#$Id: pathut.h,v 1.9 2006-10-23 15:00:31 dockes Exp $  (C) 2004 J.F.Dockes */
20
20
21
#include <string>
21
#include <string>
22
#include <list>
22
#include <list>
23
23
24
#ifndef NO_NAMESPACES
25
using std::string;
26
using std::list;
27
#endif
28
24
/// Add a / at the end if none there yet.
29
/// Add a / at the end if none there yet.
25
extern void path_catslash(std::string &s);
30
extern void path_catslash(string &s);
26
/// Concatenate 2 paths
31
/// Concatenate 2 paths
27
extern std::string path_cat(const std::string &s1, const std::string &s2);
32
extern string path_cat(const string &s1, const string &s2);
28
/// Get the simple file name (get rid of any directory path prefix
33
/// Get the simple file name (get rid of any directory path prefix
29
extern std::string path_getsimple(const std::string &s);
34
extern string path_getsimple(const string &s);
30
/// Simple file name + optional suffix stripping
35
/// Simple file name + optional suffix stripping
31
extern std::string path_basename(const std::string &s, const std::string &suff="");
36
extern string path_basename(const string &s, const string &suff="");
32
/// Get the father directory
37
/// Get the father directory
33
extern std::string path_getfather(const std::string &s);
38
extern string path_getfather(const string &s);
34
/// Get the current user's home directory
39
/// Get the current user's home directory
35
extern std::string path_home();
40
extern string path_home();
36
/// Expand ~ at the beginning of string 
41
/// Expand ~ at the beginning of string 
37
extern std::string path_tildexpand(const std::string &s);
42
extern string path_tildexpand(const string &s);
38
/// Clean up path by removing duplicated / and resolving ../
43
/// Clean up path by removing duplicated / and resolving ../
39
extern std::string path_canon(const std::string &s);
44
extern string path_canon(const string &s);
40
/// Use glob(3) to return a list of file names matching pattern inside dir
45
/// Use glob(3) to return a list of file names matching pattern inside dir
41
extern std::list<std::string> path_dirglob(const std::string &dir, 
46
extern list<string> path_dirglob(const string &dir, 
42
                       const std::string pattern);
47
                       const string pattern);
43
/// Encode according to rfc 1738
48
/// Encode according to rfc 1738
44
extern std::string url_encode(const std::string url, 
49
extern string url_encode(const string url, 
45
                  std::string::size_type offs);
50
                  string::size_type offs);
51
/// Stat parameter and check if it's a directory
52
extern bool path_isdir(const string& path);
46
53
47
#endif /* _PATHUT_H_INCLUDED_ */
54
#endif /* _PATHUT_H_INCLUDED_ */