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