Mercurial > octave
annotate liboctave/util/kpse.h @ 33658:b1d6e40ac737 stable tip
NEWS.9.md: Fix typo and minor formatting changes.
* etc/NEWS.9.md: Fix typo. Adjust whitespace. Use markdown syntax for code
snippets.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Wed, 05 Jun 2024 11:27:35 +0200 |
parents | 2e484f9f1f18 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31883
diff
changeset
|
3 // Copyright (C) 2016-2024 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #if ! defined (octave_kpse_h) |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #define octave_kpse_h 1 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include "octave-config.h" |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include <list> |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include <string> |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 // A way to step through a path, extracting one directory name at a |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 // time. |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 class kpse_path_iterator |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 { |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 public: |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
41 kpse_path_iterator () = delete; |
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
42 |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 kpse_path_iterator (const std::string& p) |
27379
3db033e86376
use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
44 : m_path (p), m_b (0), m_e (0), m_len (m_path.length ()) |
3db033e86376
use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
45 { |
3db033e86376
use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
46 set_end (); |
3db033e86376
use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
47 } |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
31883
56809fe23e53
eliminate some clang warnings about defaulted functions being deleted
John W. Eaton <jwe@octave.org>
parents:
31855
diff
changeset
|
49 OCTAVE_DEFAULT_COPY_MOVE_CTOR (kpse_path_iterator) |
56809fe23e53
eliminate some clang warnings about defaulted functions being deleted
John W. Eaton <jwe@octave.org>
parents:
31855
diff
changeset
|
50 OCTAVE_DISABLE_COPY_MOVE_ASGN (kpse_path_iterator) |
56809fe23e53
eliminate some clang warnings about defaulted functions being deleted
John W. Eaton <jwe@octave.org>
parents:
31855
diff
changeset
|
51 |
56809fe23e53
eliminate some clang warnings about defaulted functions being deleted
John W. Eaton <jwe@octave.org>
parents:
31855
diff
changeset
|
52 ~kpse_path_iterator () = default; |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 kpse_path_iterator operator ++ (int) |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 { |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 kpse_path_iterator retval (*this); |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 next (); |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 return retval; |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 } |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
61 std::string operator * () { return m_path.substr (m_b, m_e-m_b); } |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
63 bool operator != (const std::size_t sz) { return m_b != sz; } |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 private: |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 |
27379
3db033e86376
use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
67 const std::string& m_path; |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
68 std::size_t m_b; |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
69 std::size_t m_e; |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
70 std::size_t m_len; |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
72 void set_end (); |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
73 void next (); |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 }; |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
75 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
76 extern unsigned int kpse_debug; |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
78 extern std::list<std::string> |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
79 kpse_all_path_search (const std::string& path, const std::string& name); |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 extern std::list<std::string> |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 kpse_all_path_find_first_of (const std::string& path, |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 const std::list<std::string>& names); |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 extern std::string |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
86 kpse_element_dir (const std::string& elt); |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
87 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
88 extern std::list<std::string> |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 kpse_all_path_search (const std::string& path, const std::string& name); |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
90 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
91 extern std::string |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
92 kpse_path_expand (const std::string& path); |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
93 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
94 extern std::string |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
95 kpse_path_find_first_of (const std::string& path, |
21884
e8a8cb1a7258
eliminate unused parameter in kpse functions
John W. Eaton <jwe@octave.org>
parents:
21883
diff
changeset
|
96 const std::list<std::string>& names); |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
98 extern std::string |
21884
e8a8cb1a7258
eliminate unused parameter in kpse functions
John W. Eaton <jwe@octave.org>
parents:
21883
diff
changeset
|
99 kpse_path_search (const std::string& path, const std::string& name); |
21883
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
100 |
02add2f597a1
compile kpse.cc separately from pathsearch.cc
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
101 #endif |