GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
environment.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2017-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_environment_h)
24 #define octave_environment_h 1
25 
26 #include "octave-config.h"
27 
28 #include <string>
29 
30 class octave_value;
31 class octave_value_list;
32 
33 namespace octave
34 {
36  {
37  public:
38 
39  environment (void)
40  : m_editor (init_editor ()),
43  { }
44 
45  octave_value editor (const octave_value_list& args, int nargout);
46 
47  std::string editor (void) const { return m_editor; }
48 
50  {
51  return set (m_editor, ed);
52  }
53 
55 
56  std::string exec_path (void) const { return m_exec_path; }
57 
58  std::string exec_path (const std::string& path);
59 
61 
62  std::string image_path (void) const { return m_image_path; }
63 
65  {
66  return set (m_image_path, path);
67  }
68 
69  private:
70 
72 
74 
76 
77  static std::string init_editor (void);
78 
79  static std::string init_exec_path (void);
80 
81  static std::string init_image_path (void);
82 
83  std::string set (std::string& var, const std::string& new_val)
84  {
85  std::string old_val = var;
86  var = new_val;
87  return old_val;
88  }
89  };
90 }
91 
92 #endif
std::string m_exec_path
Definition: environment.h:73
static std::string init_exec_path(void)
Definition: environment.cc:116
std::string editor(void) const
Definition: environment.h:47
var
Definition: givens.cc:88
std::string image_path(void) const
Definition: environment.h:62
std::string image_path(const std::string &path)
Definition: environment.h:64
std::string m_image_path
Definition: environment.h:75
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:997
static std::string init_editor(void)
Definition: environment.cc:104
std::string m_editor
Definition: environment.h:71
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
static std::string init_image_path(void)
Definition: environment.cc:134
std::string editor(const std::string &ed)
Definition: environment.h:49
std::string exec_path(void) const
Definition: environment.h:56