GNU Octave
8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
comment-list.h
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (C) 2000-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_comment_list_h)
27
#define octave_comment_list_h 1
28
29
#include "octave-config.h"
30
31
#include <string>
32
33
#include "
base-list.h
"
34
35
OCTAVE_BEGIN_NAMESPACE
(
octave
)
36
37
extern std::
string
get_comment_text
(
void
);
38
39
extern
char
*
get_comment_text_c_str
(
void
);
40
41
extern
void
save_comment_text
(const std::
string
& text);
42
43
class
44
comment_elt
45
{
46
public
:
47
48
enum
comment_type
49
{
50
unknown
,
51
block
,
52
full_line
,
53
end_of_line
,
54
doc_string
,
55
copyright
56
};
57
58
comment_elt
(
const
std::string& s =
""
,
comment_type
t = unknown)
59
: m_text (s), m_type (t) { }
60
61
comment_elt
(
const
comment_elt
& oc)
62
: m_text (oc.m_text), m_type (oc.m_type) { }
63
64
comment_elt
& operator = (
const
comment_elt
& oc)
65
{
66
if
(
this
!= &oc)
67
{
68
m_text = oc.
m_text
;
69
m_type = oc.
m_type
;
70
}
71
72
return
*
this
;
73
}
74
75
std::string
text
(
void
)
const
{
return
m_text; }
76
77
comment_type
type
(
void
)
const
{
return
m_type; }
78
79
bool
is_block
(
void
)
const
{
return
m_type == block; }
80
bool
is_full_line
(
void
)
const
{
return
m_type == full_line; }
81
bool
is_end_of_line
(
void
)
const
{
return
m_type == end_of_line; }
82
bool
is_doc_string
(
void
)
const
{
return
m_type == doc_string; }
83
bool
is_copyright
(
void
)
const
{
return
m_type == copyright; }
84
85
~comment_elt
(
void
) =
default
;
86
87
private
:
88
89
// The text of the comment.
90
std::string
m_text
;
91
92
// The type of comment.
93
comment_type
m_type
;
94
};
95
96
class
97
comment_list
:
public
base_list<comment_elt>
98
{
99
public
:
100
101
comment_list
(
void
) { }
102
103
void
append
(
const
comment_elt
& elt)
104
{
base_list<comment_elt>::append
(elt); }
105
106
void
append
(
const
std::string& s,
107
comment_elt::comment_type
t =
comment_elt::unknown
)
108
{ append (
comment_elt
(s, t)); }
109
110
comment_list
* dup (
void
)
const
;
111
};
112
113
OCTAVE_END_NAMESPACE
(
octave
)
114
115
#endif
OCTAVE_END_NAMESPACE
OCTAVE_END_NAMESPACE(octave)
base-list.h
base_list< comment_elt >
base_list::append
void append(const elt_type &s)
Definition:
base-list.h:92
comment_elt
Definition:
comment-list.h:45
comment_elt::text
std::string text(void) const
Definition:
comment-list.h:75
comment_elt::comment_elt
comment_elt(const comment_elt &oc)
Definition:
comment-list.h:61
comment_elt::comment_type
comment_type
Definition:
comment-list.h:49
comment_elt::unknown
@ unknown
Definition:
comment-list.h:50
comment_elt::block
@ block
Definition:
comment-list.h:51
comment_elt::full_line
@ full_line
Definition:
comment-list.h:52
comment_elt::end_of_line
@ end_of_line
Definition:
comment-list.h:53
comment_elt::doc_string
@ doc_string
Definition:
comment-list.h:54
comment_elt::is_full_line
bool is_full_line(void) const
Definition:
comment-list.h:80
comment_elt::is_block
bool is_block(void) const
Definition:
comment-list.h:79
comment_elt::type
comment_type type(void) const
Definition:
comment-list.h:77
comment_elt::m_text
std::string m_text
Definition:
comment-list.h:90
comment_elt::m_type
comment_type m_type
Definition:
comment-list.h:93
comment_elt::comment_elt
comment_elt(const std::string &s="", comment_type t=unknown)
Definition:
comment-list.h:58
comment_elt::is_doc_string
bool is_doc_string(void) const
Definition:
comment-list.h:82
comment_elt::is_end_of_line
bool is_end_of_line(void) const
Definition:
comment-list.h:81
comment_elt::~comment_elt
~comment_elt(void)=default
comment_elt::is_copyright
bool is_copyright(void) const
Definition:
comment-list.h:83
comment_list
Definition:
comment-list.h:98
comment_list::comment_list
comment_list(void)
Definition:
comment-list.h:101
comment_list::append
void append(const comment_elt &elt)
Definition:
comment-list.h:103
comment_list::append
void append(const std::string &s, comment_elt::comment_type t=comment_elt::unknown)
Definition:
comment-list.h:106
save_comment_text
void save_comment_text(const std::string &text)
get_comment_text
std::string get_comment_text(void)
get_comment_text_c_str
char * get_comment_text_c_str(void)
OCTAVE_BEGIN_NAMESPACE
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
octave
Definition:
QTerminal.h:41
libinterp
parse-tree
comment-list.h
Generated on Sun Mar 12 2023 22:37:19 for GNU Octave by
1.9.1