GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
syminfo.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2018-2024 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 () const { return m_name; }
67 
68  octave_value value () const { return m_value; }
69 
70  bool is_complex () const { return m_is_complex; }
71 
72  bool is_sparse () const { return m_is_sparse; }
73 
74  bool is_formal () const { return m_is_formal; }
75 
76  bool is_global () const { return m_is_global; }
77 
78  bool is_persistent () 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;
85  octave_value m_value;
86  bool m_is_complex;
87  bool m_is_sparse;
88  bool m_is_formal;
89  bool m_is_global;
90  bool m_is_persistent;
91 };
92 
93 class
94 OCTINTERP_API
96 {
97 public:
98 
99  symbol_info_list () = default;
100 
101  symbol_info_list (const symbol_info_list&) = default;
102 
103  symbol_info_list& operator = (const symbol_info_list&) = default;
104 
105  ~symbol_info_list () = default;
106 
107  octave_value varval (const std::string& name) const;
108 
109  std::list<std::string> names () 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 
127 OCTAVE_END_NAMESPACE(octave)
128 
129 #endif
symbol_info_list(const symbol_info_list &)=default
~symbol_info_list()=default
symbol_info_list()=default
bool is_persistent() const
Definition: syminfo.h:78
bool is_global() const
Definition: syminfo.h:76
symbol_info(const std::string &name, const octave_value &value, bool is_formal, bool is_global, bool is_persistent)
Definition: syminfo.h:59
std::string name() const
Definition: syminfo.h:66
bool is_formal() const
Definition: syminfo.h:74
bool is_complex() const
Definition: syminfo.h:70
bool is_sparse() const
Definition: syminfo.h:72
octave_value value() const
Definition: syminfo.h:68
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,...)