GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
syminfo.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2018-2025 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 <iosfwd>
32#include <list>
33#include <string>
34
35#include "ov.h"
36
37class octave_map;
38
40
42{
43 char command;
48 std::string text;
49 std::string line;
50};
51
52class OCTINTERP_API symbol_info
53{
54public:
55
56 symbol_info (const std::string& name, const octave_value& value,
57 bool is_formal, bool is_global, bool is_persistent)
58 : m_name (name), m_value (value), m_is_complex (value.iscomplex ()),
59 m_is_sparse (value.issparse ()), m_is_formal (is_formal),
60 m_is_global (is_global), m_is_persistent (is_persistent)
61 { }
62
63 std::string name () const { return m_name; }
64
65 octave_value value () const { return m_value; }
66
67 bool is_complex () const { return m_is_complex; }
68
69 bool is_sparse () const { return m_is_sparse; }
70
71 bool is_formal () const { return m_is_formal; }
72
73 bool is_global () const { return m_is_global; }
74
75 bool is_persistent () const { return m_is_persistent; }
76
77 void display_line (std::ostream& os,
78 const std::list<whos_parameter>& params) const;
79private:
80
81 std::string m_name;
82 octave_value m_value;
83 bool m_is_complex;
84 bool m_is_sparse;
85 bool m_is_formal;
86 bool m_is_global;
87 bool m_is_persistent;
88};
89
90class OCTINTERP_API symbol_info_list : public std::list<symbol_info>
91{
92public:
93
94 symbol_info_list () = default;
95
97
98 symbol_info_list& operator = (const symbol_info_list&) = default;
99
100 ~symbol_info_list () = default;
101
102 octave_value varval (const std::string& name) const;
103
104 std::list<std::string> names () const;
105
106 octave_map map_value (const std::string& caller_function_name,
107 int nesting_level) const;
108
109 // Print a line of information for a given symbol.
110 void print_descriptor (std::ostream& os,
111 const std::list<whos_parameter> params) const;
112
113 void display (std::ostream& os, const std::string& format) const;
114
115 // Parse FORMAT, and return a parameter list,
116 // containing all information needed to print the given
117 // attributes of the symbols.
118 std::list<whos_parameter>
119 parse_whos_line_format (const std::string& format) const;
120};
121
122OCTAVE_END_NAMESPACE(octave)
123
124#endif
symbol_info_list(const symbol_info_list &)=default
~symbol_info_list()=default
symbol_info_list()=default
bool is_persistent() const
Definition syminfo.h:75
bool is_global() const
Definition syminfo.h:73
symbol_info(const std::string &name, const octave_value &value, bool is_formal, bool is_global, bool is_persistent)
Definition syminfo.h:56
std::string name() const
Definition syminfo.h:63
bool is_formal() const
Definition syminfo.h:71
bool is_complex() const
Definition syminfo.h:67
bool is_sparse() const
Definition syminfo.h:69
octave_value value() const
Definition syminfo.h:65
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
char modifier
Definition syminfo.h:44
int parameter_length
Definition syminfo.h:45
std::string line
Definition syminfo.h:49
std::string text
Definition syminfo.h:48
int first_parameter_length
Definition syminfo.h:46
std::size_t format(std::ostream &os, const char *fmt,...)
Definition utils.cc:1514