KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
l_filesystem.h
Go to the documentation of this file.
1 /* $Id: l_filesystem.h 15826 2013-10-21 18:24:31Z ksimek $ */
2 
3 /* =========================================================================== *
4 |
5 | Copyright (c) 1994-2008 by Kobus Barnard (author).
6 |
7 | Personal and educational use of this code is granted, provided that this
8 | header is kept intact, and that the authorship is not misrepresented, that
9 | its use is acknowledged in publications, and relevant papers are cited.
10 |
11 | For other use contact the author (kobus AT cs DOT arizona DOT edu).
12 |
13 | Please note that the code in this file has not necessarily been adequately
14 | tested. Naturally, there is no guarantee of performance, support, or fitness
15 | for any particular task. Nonetheless, I am interested in hearing about
16 | problems that you encounter.
17 |
18 | Authors:
19 | Ernesto Brau
20 |
21 * =========================================================================== */
22 
23 
24 #ifndef L_FILESYSTEM_H
25 #define L_FILESYSTEM_H
26 
27 #include <string>
28 #include <vector>
29 #include <limits>
30 
31 namespace kjb {
32 
34 std::vector<std::string> file_names_from_format
35 (
36  const std::string& name_format,
37  size_t first = 1,
38  size_t num_files = std::numeric_limits<size_t>::max()
39 );
40 
42 std::vector<std::string> dir_names_from_format
43 (
44  const std::string& name_format,
45  size_t first = 1
46 );
47 
49 std::vector<std::string> strings_from_format
50 (
51  const std::string& str_format,
52  size_t num_strings,
53  size_t first = 1
54 );
55 
56 
60 inline std::string get_extension(const std::string& fname)
61 {
62  return fname.substr(fname.find_last_of(".") + 1);
63 }
64 
65 
67 std::string realpath(const std::string& path);
68 
69 
70 } //namespace kjb
71 
72 #endif
73 
std::vector< std::string > file_names_from_format(const std::string &name_format, size_t first, size_t num_files)
Expands the format into a set of (existing) file names.
Definition: l_filesystem.cpp:34
std::string realpath(const std::string &path)
return a canonicalized path, by wrapping kjb_c::kjb_realpath().
Definition: l_filesystem.cpp:115
Int_matrix::Value_type max(const Int_matrix &mat)
Return the maximum value in this matrix.
Definition: l_int_matrix.h:1397
std::string get_extension(const std::string &fname)
Definition: l_filesystem.h:60
std::vector< std::string > dir_names_from_format(const std::string &name_format, size_t first)
Expands the format into a set of (existing) file names.
Definition: l_filesystem.cpp:65
std::vector< std::string > strings_from_format(const std::string &str_format, size_t num_strings, size_t first)
Expands the format into a set strings.
Definition: l_filesystem.cpp:95