GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
kpse.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2016-2017 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://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:1205
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
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
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:6294
std::string kpse_expand_default(const std::string &path, const std::string &fallback)
Definition: kpse.cc:1138
void next(void)
Definition: kpse.cc:114
sz
Definition: data.cc:5342
std::string kpse_path_expand(const std::string &path)
Definition: kpse.cc:867
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:854
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:3610