GNU Octave  4.4.1
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-2018 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_pathsearch_h)
24 #define octave_pathsearch_h 1
25 
26 #include "octave-config.h"
27 
28 #include <list>
29 #include <string>
30 
31 namespace octave
32 {
33  class
34  OCTAVE_API
36  {
37  public:
38 
39  directory_path (const std::string& s = "", const std::string& d = "");
40 
41  directory_path (const directory_path&) = default;
42 
43  directory_path& operator = (const directory_path&) = default;
44 
45  ~directory_path (void) = default;
46 
47  void set (const std::string& s)
48  {
49  m_initialized = false;
50  m_orig_path = s;
51  init ();
52  }
53 
54  std::list<std::string> elements (void);
55 
56  std::list<std::string> all_directories (void);
57 
58  std::string find_first (const std::string&);
59 
60  std::string find (const std::string& nm) { return find_first (nm); }
61 
62  std::list<std::string> find_all (const std::string&);
63 
64  std::string find_first_of (const std::list<std::string>& names);
65 
66  std::list<std::string>
67  find_all_first_of (const std::list<std::string>& names);
68 
69  void rehash (void)
70  {
71  m_initialized = false;
72  init ();
73  }
74 
75  static char path_sep_char (void);
76 
77  // static void path_sep_char (char c);
78 
79  static std::string path_sep_str (void);
80 
81  static bool is_path_sep (char c) { return c == path_sep_char (); }
82 
83  private:
84 
85  // The colon separated list that we were given.
87 
88  // The default path. If specified, replaces leading, trailing, or
89  // doubled colons in p_orig.
91 
92  // TRUE means we've unpacked the path p.
94 
95  // A version of the colon separate list on which we have performed
96  // tilde, variable, and possibly default path expansion.
98 
99  // The elements of the list.
100  std::list<std::string> m_path_elements;
101 
102  void init (void);
103  };
104 }
105 
106 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
107 
108 OCTAVE_DEPRECATED (4.2, "use 'octave::directory_path' instead")
109 typedef octave::directory_path dir_path;
110 
111 #endif
112 
113 #endif
static bool is_path_sep(char c)
Definition: pathsearch.h:81
std::string m_expanded_path
Definition: pathsearch.h:97
std::string m_orig_path
Definition: pathsearch.h:86
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
s
Definition: file-io.cc:2729
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:975
std::string find(const std::string &nm)
Definition: pathsearch.h:60
std::string m_default_path
Definition: pathsearch.h:90
static std::list< std::string > find_first_of(const std::string &path, const std::list< std::string > &names, bool all)
Definition: kpse.cc:548
std::list< std::string > m_path_elements
Definition: pathsearch.h:100
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888