GNU Octave  6.2.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-2021 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 
40 namespace octave
41 {
43  {
44  char command;
45  char modifier;
48  int balance;
49  std::string text;
50  std::string line;
51  };
52 
54  {
55  public:
56 
57  symbol_info (const std::string& name, const octave_value& value,
58  bool is_formal, bool is_global, bool is_persistent)
59  : m_name (name), m_value (value), m_is_complex (value.iscomplex ()),
62  { }
63 
64  std::string name (void) const { return m_name; }
65 
66  octave_value value (void) const { return m_value; }
67 
68  bool is_complex (void) const { return m_is_complex; }
69 
70  bool is_formal (void) const { return m_is_formal; }
71 
72  bool is_global (void) const { return m_is_global; }
73 
74  bool is_persistent (void) const { return m_is_persistent; }
75 
76  void display_line (std::ostream& os,
77  const std::list<whos_parameter>& params) const;
78  private:
79 
80  std::string m_name;
86  };
87 
88  class symbol_info_list : public base_list<symbol_info>
89  {
90  public:
91 
92  symbol_info_list (void) = default;
93 
94  symbol_info_list (const symbol_info_list&) = default;
95 
97 
98  ~symbol_info_list (void) = default;
99 
100  octave_value varval (const std::string& name) const;
101 
102  std::list<std::string> names (void) const;
103 
104  octave_map map_value (const std::string& caller_function_name,
105  int nesting_level) const;
106 
107  // Print a line of information for a given symbol.
108  void print_descriptor (std::ostream& os,
109  const std::list<whos_parameter> params) const;
110 
111  void display (std::ostream& os, const std::string& format) const;
112 
113  // Parse FORMAT, and return a parameter list,
114  // containing all information needed to print the given
115  // attributes of the symbols.
116  std::list<whos_parameter>
117  parse_whos_line_format (const std::string& format) const;
118  };
119 }
120 
121 #endif
~symbol_info_list(void)=default
octave_map map_value(const std::string &caller_function_name, int nesting_level) const
Definition: syminfo.cc:190
symbol_info_list & operator=(const symbol_info_list &)=default
std::list< whos_parameter > parse_whos_line_format(const std::string &format) const
Definition: syminfo.cc:362
octave_value varval(const std::string &name) const
Definition: syminfo.cc:168
void print_descriptor(std::ostream &os, const std::list< whos_parameter > params) const
Definition: syminfo.cc:246
void display(std::ostream &os, const std::string &format) const
Definition: syminfo.cc:330
std::list< std::string > names(void) const
Definition: syminfo.cc:179
symbol_info_list(void)=default
symbol_info_list(const symbol_info_list &)=default
octave_value value(void) const
Definition: syminfo.h:66
octave_value m_value
Definition: syminfo.h:81
std::string m_name
Definition: syminfo.h:80
symbol_info(const std::string &name, const octave_value &value, bool is_formal, bool is_global, bool is_persistent)
Definition: syminfo.h:57
bool is_global(void) const
Definition: syminfo.h:72
bool m_is_persistent
Definition: syminfo.h:85
bool is_persistent(void) const
Definition: syminfo.h:74
bool is_complex(void) const
Definition: syminfo.h:68
bool is_formal(void) const
Definition: syminfo.h:70
std::string name(void) const
Definition: syminfo.h:64
void display_line(std::ostream &os, const std::list< whos_parameter > &params) const
Definition: syminfo.cc:46
QString name
size_t format(std::ostream &os, const char *fmt,...)
Definition: utils.cc:1329
std::string text
Definition: syminfo.h:49
std::string line
Definition: syminfo.h:50