GNU Octave 7.1.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-2022 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{
39public:
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 std::size_t sz) { return m_b != sz; }
65
66private:
67
68 const std::string& m_path;
69 std::size_t m_b;
70 std::size_t m_e;
71 std::size_t m_len;
72
73 void set_end (void);
74 void next (void);
75};
76
77extern unsigned int kpse_debug;
78
79extern std::list<std::string>
80kpse_all_path_search (const std::string& path, const std::string& name);
81
82extern std::list<std::string>
83kpse_all_path_find_first_of (const std::string& path,
84 const std::list<std::string>& names);
85
86extern std::string
87kpse_element_dir (const std::string& elt);
88
89extern std::list<std::string>
90kpse_all_path_search (const std::string& path, const std::string& name);
91
92extern std::string
93kpse_path_expand (const std::string& path);
94
95extern std::string
96kpse_path_find_first_of (const std::string& path,
97 const std::list<std::string>& names);
98
99extern std::string
100kpse_path_search (const std::string& path, const std::string& name);
101
102#endif
const std::string & m_path
Definition: kpse.h:68
~kpse_path_iterator(void)=default
kpse_path_iterator operator++(int)
Definition: kpse.h:55
std::size_t m_e
Definition: kpse.h:70
void next(void)
Definition: kpse.cc:114
void set_end(void)
Definition: kpse.cc:95
std::string operator*(void)
Definition: kpse.h:62
bool operator!=(const std::size_t sz)
Definition: kpse.h:64
kpse_path_iterator(const kpse_path_iterator &)=default
kpse_path_iterator(const std::string &p)
Definition: kpse.h:41
std::size_t m_len
Definition: kpse.h:71
std::size_t m_b
Definition: kpse.h:69
kpse_path_iterator & operator=(const kpse_path_iterator &)=delete
QString path
QString name
std::string kpse_path_find_first_of(const std::string &path, const std::list< std::string > &names)
Definition: kpse.cc:731
std::string kpse_element_dir(const std::string &elt)
Definition: kpse.cc:1037
std::string kpse_path_expand(const std::string &path)
Definition: kpse.cc:758
unsigned int kpse_debug
Definition: kpse.cc:92
std::list< std::string > kpse_all_path_find_first_of(const std::string &path, const std::list< std::string > &names)
Definition: kpse.cc:747
std::list< std::string > kpse_all_path_search(const std::string &path, const std::string &name)
Definition: kpse.cc:567
std::string kpse_path_search(const std::string &path, const std::string &name)
Definition: kpse.cc:556