GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
syminfo.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2018-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_syminfo_h)
27 #define octave_syminfo_h 1
28 
29 #include "octave-config.h"
30 
31 #include <string>
32 #include <iosfwd>
33 
34 #include "base-list.h"
35 
36 #include "ov.h"
37 
38 class octave_map;
39 
41 
43 {
44  char command;
45  char modifier;
48  int balance;
49  std::string text;
50  std::string line;
51 };
52 
53 class
54 OCTINTERP_API
56 {
57 public:
58 
59  symbol_info (const std::string& name, const octave_value& value,
60  bool is_formal, bool is_global, bool is_persistent)
61  : m_name (name), m_value (value), m_is_complex (value.iscomplex ()),
62  m_is_sparse (value.issparse ()), m_is_formal (is_formal),
63  m_is_global (is_global), m_is_persistent (is_persistent)
64  { }
65 
66  std::string name (void) const { return m_name; }
67 
68  octave_value value (void) const { return m_value; }
69 
70  bool is_complex (void) const { return m_is_complex; }
71 
72  bool is_sparse (void) const { return m_is_sparse; }
73 
74  bool is_formal (void) const { return m_is_formal; }
75 
76  bool is_global (void) const { return m_is_global; }
77 
78  bool is_persistent (void) const { return m_is_persistent; }
79 
80  void display_line (std::ostream& os,
81  const std::list<whos_parameter>& params) const;
82 private:
83 
84  std::string m_name;
91 };
92 
93 class
94 OCTINTERP_API
96 {
97 public:
98 
99  symbol_info_list (void) = default;
100 
101  symbol_info_list (const symbol_info_list&) = default;
102 
104 
105  ~symbol_info_list (void) = default;
106 
107  octave_value varval (const std::string& name) const;
108 
109  std::list<std::string> names (void) const;
110 
111  octave_map map_value (const std::string& caller_function_name,
112  int nesting_level) const;
113 
114  // Print a line of information for a given symbol.
115  void print_descriptor (std::ostream& os,
116  const std::list<whos_parameter> params) const;
117 
118  void display (std::ostream& os, const std::string& format) const;
119 
120  // Parse FORMAT, and return a parameter list,
121  // containing all information needed to print the given
122  // attributes of the symbols.
123  std::list<whos_parameter>
124  parse_whos_line_format (const std::string& format) const;
125 };
126 
128 
129 #endif
OCTAVE_END_NAMESPACE(octave)
octave_map & operator=(const octave_map &m)
Definition: oct-map.h:303
symbol_info_list(const symbol_info_list &)=default
symbol_info_list(void)=default
~symbol_info_list(void)=default
octave_value value(void) const
Definition: syminfo.h:68
bool is_persistent(void) const
Definition: syminfo.h:78
bool is_global(void) const
Definition: syminfo.h:76
bool m_is_persistent
Definition: syminfo.h:90
bool is_complex(void) const
Definition: syminfo.h:70
symbol_info(const std::string &name, const octave_value &value, bool is_formal, bool is_global, bool is_persistent)
Definition: syminfo.h:59
bool m_is_global
Definition: syminfo.h:89
bool m_is_sparse
Definition: syminfo.h:87
octave_value m_value
Definition: syminfo.h:85
bool m_is_formal
Definition: syminfo.h:88
bool m_is_complex
Definition: syminfo.h:86
std::string name(void) const
Definition: syminfo.h:66
std::string m_name
Definition: syminfo.h:84
bool is_sparse(void) const
Definition: syminfo.h:72
bool is_formal(void) const
Definition: syminfo.h:74
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
char modifier
Definition: syminfo.h:45
int parameter_length
Definition: syminfo.h:46
std::string line
Definition: syminfo.h:50
std::string text
Definition: syminfo.h:49
int first_parameter_length
Definition: syminfo.h:47
char command
Definition: syminfo.h:44
std::size_t format(std::ostream &os, const char *fmt,...)
Definition: utils.cc:1473