GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
pathsearch.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2025 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_pathsearch_h)
27#define octave_pathsearch_h 1
28
29#include "octave-config.h"
30
31#include <list>
32#include <string>
33
35
37{
38public:
39
40 directory_path (const std::string& s = "");
41
42 directory_path (const directory_path&) = default;
43
44 directory_path& operator = (const directory_path&) = default;
45
46 ~directory_path () = default;
47
48 void set (const std::string& s)
49 {
50 m_initialized = false;
51 m_orig_path = s;
52 init ();
53 }
54
55 std::list<std::string> elements ();
56
57 std::list<std::string> all_directories ();
58
59 std::string find_first (const std::string&);
60
61 std::string find (const std::string& nm) { return find_first (nm); }
62
63 std::list<std::string> find_all (const std::string&);
64
65 std::string find_first_of (const std::list<std::string>& names);
66
67 std::list<std::string>
68 find_all_first_of (const std::list<std::string>& names);
69
70 void rehash ()
71 {
72 m_initialized = false;
73 init ();
74 }
75
76 static char path_sep_char ();
77
78 // static void path_sep_char (char c);
79
80 static std::string path_sep_str ();
81
82 static bool is_path_sep (char c) { return c == path_sep_char (); }
83
84private:
85
86 // The colon separated list that we were given.
87 std::string m_orig_path;
88
89 // TRUE means we've unpacked the path p.
90 bool m_initialized;
91
92 // A version of the colon separate list on which we have performed
93 // tilde, variable, and possibly default path expansion.
94 std::string m_expanded_path;
95
96 // The elements of the list.
97 std::list<std::string> m_path_elements;
98
99 void init ();
100};
101
102OCTAVE_END_NAMESPACE(octave)
103
104#endif
void set(const std::string &s)
Definition pathsearch.h:48
static bool is_path_sep(char c)
Definition pathsearch.h:82
std::string find(const std::string &nm)
Definition pathsearch.h:61
directory_path(const directory_path &)=default
~directory_path()=default
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition main.in.cc:55