comparison liboctave/pathsearch.h @ 1786:b9e8c73e154e

[project @ 1996-01-24 20:36:22 by jwe] Initial revision
author jwe
date Wed, 24 Jan 1996 20:36:22 +0000
parents
children 1b57120c997b
comparison
equal deleted inserted replaced
1785:6109184b054f 1786:b9e8c73e154e
1 // pathsearch.h -*- C++ -*-
2 /*
3
4 Copyright (C) 1996 John W. Eaton
5
6 This file is part of Octave.
7
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
11 later version.
12
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
22 */
23
24 #if !defined (octave_pathsearch_h)
25 #define octave_pathsearch_h 1
26
27 #include <string>
28
29 #include "str-vec.h"
30
31 class
32 dir_path
33 {
34 public:
35
36 dir_path (const string& s = string ()) : p (s), initialized (false)
37 {
38 if (! p.empty ())
39 init ();
40 }
41
42 dir_path (const dir_path& dp)
43 : p (dp.p), initialized (dp.initialized), pv (dp.pv) { }
44
45 dir_path& operator = (const dir_path& dp)
46 {
47 p = dp.p;
48 initialized = dp.initialized;
49 pv = dp.pv;
50 return *this;
51 }
52
53 ~dir_path (void) { }
54
55 void set (const string& s)
56 {
57 initialized = false;
58 p = s;
59 init ();
60 }
61
62 string_vector elements (void);
63 string_vector all_directories (void);
64
65 string find_first (const string&);
66 string find (const string& nm) { return find_first (nm); }
67
68 string_vector find_all (const string&);
69
70 private:
71
72 // The colon separated list.
73 string p;
74
75 // TRUE means we've unpacked p.
76 bool initialized;
77
78 // The elements of the list.
79 string_vector pv;
80
81 // TRUE means we've set the global value of kpathsea_debug.
82 static bool kpathsea_debug_initialized;
83
84 void init (void);
85 };
86
87 #endif
88
89 /*
90 ;;; Local Variables: ***
91 ;;; mode: C++ ***
92 ;;; page-delimiter: "^/\\*" ***
93 ;;; End: ***
94 */