GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
kpse.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2016-2018 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 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
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_kpse_h)
24 #define octave_kpse_h 1
25 
26 #include "octave-config.h"
27 
28 #include <list>
29 #include <string>
30 
31 // A way to step through a path, extracting one directory name at a
32 // time.
33 
35 {
36 public:
37 
39  : path (p), b (0), e (0), len (path.length ()) { set_end (); }
40 
42  : path (pi.path), b (pi.b), e (pi.e), len (pi.len) { }
43 
45  {
46  kpse_path_iterator retval (*this);
47  next ();
48  return retval;
49  }
50 
51  std::string operator * (void) { return path.substr (b, e-b); }
52 
53  bool operator != (const size_t sz) { return b != sz; }
54 
55 private:
56 
57  const std::string& path;
58  size_t b;
59  size_t e;
60  size_t len;
61 
62  void set_end (void);
63  void next (void);
64 
65  // No assignment.
67 };
68 
69 extern unsigned int kpse_debug;
70 
71 extern std::list<std::string>
72 kpse_all_path_search (const std::string& path, const std::string& name);
73 
74 extern std::list<std::string>
76  const std::list<std::string>& names);
77 
78 extern std::string
79 kpse_element_dir (const std::string& elt);
80 
81 extern std::list<std::string>
82 kpse_all_path_search (const std::string& path, const std::string& name);
83 
84 extern std::string
85 kpse_expand_default (const std::string& path, const std::string& fallback);
86 
87 extern std::string
88 kpse_path_expand (const std::string& path);
89 
90 extern std::string
92  const std::list<std::string>& names);
93 
94 extern std::string
95 kpse_path_search (const std::string& path, const std::string& name);
96 
97 #endif
size_t len
Definition: kpse.h:60
const std::string & path
Definition: kpse.h:57
std::string operator*(void)
Definition: kpse.h:51
unsigned int kpse_debug
Definition: kpse.cc:88
kpse_path_iterator & operator=(const kpse_path_iterator &)
kpse_path_iterator(const kpse_path_iterator &pi)
Definition: kpse.h:41
std::string kpse_element_dir(const std::string &elt)
Definition: kpse.cc:1203
kpse_path_iterator operator++(int)
Definition: kpse.h:44
size_t e
Definition: kpse.h:59
void set_end(void)
Definition: kpse.cc:95
std::string kpse_path_search(const std::string &path, const std::string &name)
Definition: kpse.cc:456
nd deftypefn *std::string name
Definition: sysdep.cc:647
std::list< std::string > kpse_all_path_find_first_of(const std::string &path, const std::list< std::string > &names)
Definition: kpse.cc:644
kpse_path_iterator(const std::string &p)
Definition: kpse.h:38
octave_value retval
Definition: data.cc:6246
std::string kpse_expand_default(const std::string &path, const std::string &fallback)
Definition: kpse.cc:1136
void next(void)
Definition: kpse.cc:114
sz
Definition: data.cc:5264
std::string kpse_path_expand(const std::string &path)
Definition: kpse.cc:865
p
Definition: lu.cc:138
bool operator!=(const size_t sz)
Definition: kpse.h:53
std::string kpse_path_find_first_of(const std::string &path, const std::list< std::string > &names)
Definition: kpse.cc:628
size_t b
Definition: kpse.h:58
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888
std::list< std::string > kpse_all_path_search(const std::string &path, const std::string &name)
Definition: kpse.cc:467
static const double pi
Definition: lo-specfun.cc:1996