Mercurial > octave
annotate liboctave/util/pathsearch.h @ 22865:89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
* octave-gui.h, resource-manager.h, shortcut-manager.h,
base-text-renderer.h, c-file-ptr-stream.h, dynamic-ld.cc,
dynamic-ld.h, event-queue.h, ft-text-renderer.cc, gl-render.cc,
gl-render.h, graphics.cc, graphics.in.h, interpreter.h, mex.cc,
mxarray.in.h, oct-fstrm.h, oct-iostrm.h, oct-prcstrm.h, oct-procbuf.h,
oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.h,
octave-link.h, pager.h, profiler.h, sighandlers.cc, symtab.h,
text-renderer.h, zfstream.h, __init_fltk__.cc, ov-builtin.h,
ov-dld-fcn.h, ov-fcn.h, ov-mex-fcn.h, ov-typeinfo.h, ov-usr-fcn.h,
octave.h, lex.h, parse.h, pt-arg-list.h, pt-array-list.h, pt-assign.h,
pt-binop.h, pt-bp.h, pt-cbinop.h, pt-cell.h, pt-check.h,
pt-classdef.h, pt-cmd.h, pt-colon.h, pt-const.h, pt-decl.h, pt-eval.h,
pt-except.h, pt-exp.h, pt-fcn-handle.h, pt-funcall.h, pt-id.h,
pt-idx.h, pt-jump.h, pt-loop.h, pt-mat.h, pt-misc.h, pt-pr-code.h,
pt-select.h, pt-stmt.h, pt-unop.h, pt-walk.h, pt.h, token.h, Array.cc,
idx-vector.h, oct-fftw.h, sparse-chol.cc, sparse-qr.cc, file-ops.h,
mach-info.h, oct-env.h, action-container.h, cmd-edit.cc, cmd-edit.h,
cmd-hist.h, oct-locbuf.h, oct-mutex.h, oct-shlib.cc, oct-sort.h,
pathsearch.h, singleton-cleanup.h, unwind-prot.h, url-transfer.cc,
url-transfer.h:
Use C++11 style "= delete" declaration to declare copy constructors
and assignment operators for classes that should not be copied.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 05 Dec 2016 22:59:37 -0500 |
parents | 3a2b891d0b33 |
children | 87e3163f6c87 |
rev | line source |
---|---|
1786 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
21867
diff
changeset
|
3 Copyright (C) 1996-2016 John W. Eaton |
1786 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
10 (at your option) any later version. |
1786 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
15 GNU General Public License for more details. |
1786 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1786 | 20 |
21 */ | |
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 | 24 #define octave_pathsearch_h 1 |
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 | 29 #include <string> |
30 | |
21745
bf1121302404
use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
31 namespace octave |
1786 | 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 () |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
42 { |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
43 if (! m_orig_path.empty ()) |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
44 init (); |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
45 } |
21745
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) |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
53 { } |
21745
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) |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
56 { |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
57 if (this != &dp) |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
58 { |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
59 m_orig_path = dp.m_orig_path; |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
60 m_default_path = dp.m_default_path; |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
61 m_initialized = dp.m_initialized; |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
62 m_expanded_path = dp.m_expanded_path; |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
63 m_path_elements = dp.m_path_elements; |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
64 } |
21867
0cdfd6d230e6
use std::list<std::string> instead of string_vector in pathsearch functions
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
65 |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
66 return *this; |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
67 } |
21745
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 | 104 static void path_sep_char (char c) |
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 | 107 } |
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 | 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 |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
176 static_members (const static_members&) = delete; |
21745
bf1121302404
use namespace for dir_path class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
177 |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
178 static_members& operator = (const static_members&) = delete; |
21745
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 | 191 |
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 |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
195 |