GNU Octave  6.2.0
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-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_kpse_h)
27 #define octave_kpse_h 1
28 
29 #include "octave-config.h"
30 
31 #include <list>
32 #include <string>
33 
34 // A way to step through a path, extracting one directory name at a
35 // time.
36 
38 {
39 public:
40 
41  kpse_path_iterator (const std::string& p)
42  : m_path (p), m_b (0), m_e (0), m_len (m_path.length ())
43  {
44  set_end ();
45  }
46 
48 
49  // No assignment!
50 
52 
53  ~kpse_path_iterator (void) = default;
54 
56  {
57  kpse_path_iterator retval (*this);
58  next ();
59  return retval;
60  }
61 
62  std::string operator * (void) { return m_path.substr (m_b, m_e-m_b); }
63 
64  bool operator != (const size_t sz) { return m_b != sz; }
65 
66 private:
67 
68  const std::string& m_path;
69  size_t m_b;
70  size_t m_e;
71  size_t m_len;
72 
73  void set_end (void);
74  void next (void);
75 };
76 
77 extern unsigned int kpse_debug;
78 
79 extern std::list<std::string>
80 kpse_all_path_search (const std::string& path, const std::string& name);
81 
82 extern std::list<std::string>
83 kpse_all_path_find_first_of (const std::string& path,
84  const std::list<std::string>& names);
85 
86 extern std::string
87 kpse_element_dir (const std::string& elt);
88 
89 extern std::list<std::string>
90 kpse_all_path_search (const std::string& path, const std::string& name);
91 
92 extern std::string
93 kpse_path_expand (const std::string& path);
94 
95 extern std::string
96 kpse_path_find_first_of (const std::string& path,
97  const std::list<std::string>& names);
98 
99 extern std::string
100 kpse_path_search (const std::string& path, const std::string& name);
101 
102 #endif
const std::string & m_path
Definition: kpse.h:68
size_t m_b
Definition: kpse.h:69
~kpse_path_iterator(void)=default
size_t m_len
Definition: kpse.h:71
size_t m_e
Definition: kpse.h:70
kpse_path_iterator operator++(int)
Definition: kpse.h:55
void next(void)
Definition: kpse.cc:114
void set_end(void)
Definition: kpse.cc:95
std::string operator*(void)
Definition: kpse.h:62
kpse_path_iterator(const kpse_path_iterator &)=default
kpse_path_iterator & operator=(const kpse_path_iterator &)=delete
kpse_path_iterator(const std::string &p)
Definition: kpse.h:41
bool operator!=(const size_t sz)
Definition: kpse.h:64
QString path
QString name
std::string kpse_path_find_first_of(const std::string &path, const std::list< std::string > &names)
Definition: kpse.cc:719
std::string kpse_element_dir(const std::string &elt)
Definition: kpse.cc:1022
std::string kpse_path_expand(const std::string &path)
Definition: kpse.cc:746
std::list< std::string > kpse_all_path_find_first_of(const std::string &path, const std::list< std::string > &names)
Definition: kpse.cc:735
unsigned int kpse_debug
Definition: kpse.cc:92
std::list< std::string > kpse_all_path_search(const std::string &path, const std::string &name)
Definition: kpse.cc:558
std::string kpse_path_search(const std::string &path, const std::string &name)
Definition: kpse.cc:547
octave_value::octave_value(const Array< char > &chm, char type) return retval
Definition: ov.cc:811