Mercurial > octave
annotate liboctave/system/oct-env.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 | f75d289645ec |
rev | line source |
---|---|
2926 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
3 Copyright (C) 1996-2016 John W. Eaton |
2926 | 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. |
2926 | 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. |
2926 | 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/>. | |
2926 | 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_oct_env_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
24 #define octave_oct_env_h 1 |
2926 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
27 |
2926 | 28 #include <string> |
29 | |
21734
11af9c03400c
write namespace keyword and name on same line in C++ files
John W. Eaton <jwe@octave.org>
parents:
21732
diff
changeset
|
30 namespace octave |
2926 | 31 { |
21734
11af9c03400c
write namespace keyword and name on same line in C++ files
John W. Eaton <jwe@octave.org>
parents:
21732
diff
changeset
|
32 namespace sys |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
33 { |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
34 class |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
35 OCTAVE_API |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
36 env |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
37 { |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
38 protected: |
2926 | 39 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
40 env (void); |
2926 | 41 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
42 public: |
2926 | 43 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
44 static std::string polite_directory_format (const std::string& name); |
6838 | 45 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
46 static bool absolute_pathname (const std::string& s); |
2926 | 47 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
48 static bool rooted_relative_pathname (const std::string& s); |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
49 |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
50 static std::string base_pathname (const std::string& s); |
2926 | 51 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
52 static std::string |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
53 make_absolute (const std::string& s, |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
54 const std::string& dot_path = get_current_directory ()); |
2926 | 55 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
56 static std::string get_current_directory (void); |
19458
d8fd3842a507
Use gnulib gen_tempname to create temporary names (Bug #43872).
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
57 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
58 static std::string get_home_directory (void); |
2926 | 59 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
60 static std::string get_temp_directory (void); |
2926 | 61 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
62 static std::string get_program_name (void); |
2926 | 63 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
64 static std::string get_program_invocation_name (void); |
2926 | 65 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
66 static std::string get_user_name (void); |
2926 | 67 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
68 static std::string get_host_name (void); |
2926 | 69 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
70 static std::string getenv (const std::string& name); |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
71 |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
72 static void putenv (const std::string& name, const std::string& value); |
5489 | 73 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
74 static bool have_x11_display (void); |
2926 | 75 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
76 static bool chdir (const std::string& newdir); |
2926 | 77 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
78 static void set_program_name (const std::string& s); |
2926 | 79 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
80 private: |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
81 |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
82 static bool instance_ok (void); |
2926 | 83 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
84 std::string do_polite_directory_format (const std::string& name) const; |
2926 | 85 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
86 bool do_absolute_pathname (const std::string& s) const; |
2926 | 87 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
88 bool do_rooted_relative_pathname (const std::string& s) const; |
6838 | 89 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
90 std::string do_base_pathname (const std::string& s) const; |
2926 | 91 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
92 std::string do_make_absolute (const std::string& s, |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
93 const std::string& dot_path) const; |
2926 | 94 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
95 std::string do_getcwd (void) const; |
2926 | 96 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
97 std::string do_get_home_directory (void) const; |
2926 | 98 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
99 std::string do_get_temp_directory (void) const; |
19458
d8fd3842a507
Use gnulib gen_tempname to create temporary names (Bug #43872).
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
100 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
101 std::string do_get_user_name (void) const; |
2926 | 102 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
103 std::string do_get_host_name (void) const; |
2926 | 104 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
105 std::string do_getenv (const std::string& name) const; |
2926 | 106 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
107 void do_putenv (const std::string& name, const std::string& value) const; |
2926 | 108 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
109 bool do_chdir (const std::string& newdir); |
2926 | 110 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
111 void do_set_program_name (const std::string& s) const; |
2926 | 112 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
113 void pathname_backup (std::string& path, int n) const; |
2926 | 114 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
115 void error (int) const; |
2926 | 116 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
117 void error (const std::string&) const; |
2926 | 118 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
119 // No copying! |
2926 | 120 |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
121 env (const env&) = delete; |
2926 | 122 |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
123 env& operator = (const env&) = delete; |
2926 | 124 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
125 // The real thing. |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
126 static env *instance; |
2926 | 127 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
128 static void cleanup_instance (void) { delete instance; instance = 0; } |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
129 |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
130 // TRUE means follow symbolic links that point to directories just |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
131 // as if they are real directories. |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
132 bool follow_symbolic_links; |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
133 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
134 // TRUE means that pwd always give verbatim directory, regardless |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
135 // of symbolic link following. |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
136 bool verbatim_pwd; |
2926 | 137 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
138 // Where are we? |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
139 mutable std::string current_directory; |
2926 | 140 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
141 // Etc. |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
142 mutable std::string prog_name; |
2926 | 143 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
144 mutable std::string prog_invocation_name; |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
145 |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
146 mutable std::string user_name; |
2926 | 147 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
148 mutable std::string host_name; |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
149 }; |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
150 } |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
151 } |
2926 | 152 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
153 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) |
2926 | 154 |
21752
949cb46e6bdb
use consistent style for deprecated function/class messages
John W. Eaton <jwe@octave.org>
parents:
21734
diff
changeset
|
155 OCTAVE_DEPRECATED ("use 'octave::sys::env' instead") |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
156 typedef octave::sys::env octave_env; |
2926 | 157 |
158 #endif | |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
159 |
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
160 #endif |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
161 |