annotate liboctave/util/pathsearch.h @ 21867:0cdfd6d230e6

use std::list<std::string> instead of string_vector in pathsearch functions * kpse.cc, pathsearch.cc, pathsearch.h: Use std::list<std::string> instead of string_vector in pathsearch functions. * ls-mat5.cc, utils.cc, ov-fcn-handle.cc: Update to match.
author John W. Eaton <jwe@octave.org>
date Sat, 11 Jun 2016 18:44:07 -0400
parents 949cb46e6bdb
children bac0d6f07a3e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
1 /*
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17769
diff changeset
3 Copyright (C) 1996-2015 John W. Eaton
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
4
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
6
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
10 option) any later version.
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
11
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
15 for more details.
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
16
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
19 <http://www.gnu.org/licenses/>.
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
20
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
21 */
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
23 #if ! defined (octave_pathsearch_h)
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
24 #define octave_pathsearch_h 1
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
27
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
28 #include <list>
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
29 #include <string>
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
30
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
31 namespace octave
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
32 {
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
33 class
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
34 OCTAVE_API
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
35 directory_path
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
36 {
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
37 public:
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
38
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
39 directory_path (const std::string& s = "", const std::string& d = "")
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
40 : m_orig_path (s), m_default_path (d), m_initialized (false),
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
41 m_expanded_path (), m_path_elements ()
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
42 {
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
43 if (! m_orig_path.empty ())
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
44 init ();
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
45 }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
46
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
47 directory_path (const directory_path& dp)
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
48 : m_orig_path (dp.m_orig_path),
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
49 m_default_path (dp.m_default_path),
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
50 m_initialized (dp.m_initialized),
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
51 m_expanded_path (dp.m_expanded_path),
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
52 m_path_elements (dp.m_path_elements)
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
53 { }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
54
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
55 directory_path& operator = (const directory_path& dp)
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
56 {
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
57 if (this != &dp)
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
58 {
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
59 m_orig_path = dp.m_orig_path;
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
60 m_default_path = dp.m_default_path;
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
61 m_initialized = dp.m_initialized;
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
62 m_expanded_path = dp.m_expanded_path;
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
63 m_path_elements = dp.m_path_elements;
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
64 }
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
65
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
66 return *this;
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
67 }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
68
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
69 ~directory_path (void) { }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
70
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
71 void set (const std::string& s)
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
72 {
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
73 m_initialized = false;
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
74 m_orig_path = s;
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
75 init ();
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
76 }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
77
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
78 std::list<std::string> elements (void);
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
79
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
80 std::list<std::string> all_directories (void);
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
81
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
82 std::string find_first (const std::string&);
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
83
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
84 std::string find (const std::string& nm) { return find_first (nm); }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
85
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
86 std::list<std::string> find_all (const std::string&);
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
87
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
88 std::string find_first_of (const std::list<std::string>& names);
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
89
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
90 std::list<std::string>
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
91 find_all_first_of (const std::list<std::string>& names);
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
92
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
93 void rehash (void)
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
94 {
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
95 m_initialized = false;
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
96 init ();
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
97 }
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
98
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
99 static char path_sep_char (void)
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
100 {
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
101 return static_members::path_sep_char ();
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
102 }
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
103
9266
1d3b91166b9c allow pathsep to be set
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
104 static void path_sep_char (char c)
1d3b91166b9c allow pathsep to be set
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
105 {
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
106 static_members::path_sep_char (c);
9266
1d3b91166b9c allow pathsep to be set
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
107 }
1d3b91166b9c allow pathsep to be set
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
108
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
109 static std::string path_sep_str (void)
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
110 {
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
111 return static_members::path_sep_str ();
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
112 }
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
113
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
114 static bool is_path_sep (char c) { return c == path_sep_char (); }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
115
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
116 private:
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
117
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
118 // The colon separated list that we were given.
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
119 std::string m_orig_path;
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
120
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
121 // The default path. If specified, replaces leading, trailing, or
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
122 // doubled colons in p_orig.
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
123 std::string m_default_path;
5777
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5307
diff changeset
124
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
125 // TRUE means we've unpacked the path p.
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
126 bool m_initialized;
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
127
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
128 // A version of the colon separate list on which we have performed
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
129 // tilde, variable, and possibly default path expansion.
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
130 std::string m_expanded_path;
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
131
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
132 // The elements of the list.
21867
0cdfd6d230e6 use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
133 std::list<std::string> m_path_elements;
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
134
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
135 void init (void);
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
136
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
137 // Use a singleton class for these data members instead of just
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
138 // making them static members of the directory_path class so that
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
139 // we can ensure proper initialization.
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
140
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
141 class OCTAVE_API static_members
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
142 {
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
143 public:
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
144
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
145 static_members (void);
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
146
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
147 static char path_sep_char (void)
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
148 {
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
149 return instance_ok () ? instance->xpath_sep_char : 0;
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
150 }
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
151
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
152 static void path_sep_char (char c)
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
153 {
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
154 if (instance_ok ())
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
155 {
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
156 instance->xpath_sep_char = c;
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
157 instance->xpath_sep_str = std::string (1, c);
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
158 }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
159 }
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
160
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
161 static std::string path_sep_str (void)
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
162 {
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
163 return instance_ok () ? instance->xpath_sep_str : "";
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
164 }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
165
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
166 private:
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
167
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
168 static static_members *instance;
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
169
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
170 static void cleanup_instance (void) { delete instance; instance = 0; }
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
171
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
172 static bool instance_ok (void);
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
173
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
174 // No copying!
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
175
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
176 static_members (const static_members&);
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
177
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
178 static_members& operator = (const static_members&);
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
179
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
180 char xpath_sep_char;
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
181
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
182 std::string xpath_sep_str;
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
183 };
8008
4d13a7a2f6ab dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
184 };
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
185 }
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
186
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
187 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
188
21752
949cb46e6bdb use consistent style for deprecated function/class messages
John W. Eaton <jwe@octave.org>
parents: 21745
diff changeset
189 OCTAVE_DEPRECATED ("use 'octave::directory_path' instead")
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
190 typedef octave::directory_path dir_path;
1786
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
191
b9e8c73e154e [project @ 1996-01-24 20:36:22 by jwe]
jwe
parents:
diff changeset
192 #endif
21745
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
193
bf1121302404 use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
194 #endif