annotate libinterp/parse-tree/comment-list.h @ 29358:0a5b15007766 stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2021 09:52:15 -0500
parents a3ea758870dc
children 796f54d4ddbf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 28510
diff changeset
3 // Copyright (C) 2000-2021 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 #if ! defined (octave_comment_list_h)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
27 #define octave_comment_list_h 1
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
30
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
31 #include <string>
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
32
22267
b80fddf2a9a0 comment-list.h: properly include "base-list.h".
Carnë Draug <carandraug@octave.org>
parents: 21244
diff changeset
33 #include "base-list.h"
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
34
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
35 namespace octave
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
36 {
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
37 extern std::string get_comment_text (void);
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
38
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
39 extern char * get_comment_text_c_str (void);
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
40
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
41 extern void save_comment_text (const std::string& text);
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
42
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
43 class
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
44 comment_elt
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
45 {
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
46 public:
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
47
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
48 enum comment_type
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
49 {
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
50 unknown,
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
51 block,
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
52 full_line,
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
53 end_of_line,
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
54 doc_string,
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
55 copyright
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
56 };
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
57
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
58 comment_elt (const std::string& s = "", comment_type t = unknown)
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
59 : m_text (s), m_type (t) { }
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
60
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
61 comment_elt (const comment_elt& oc)
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
62 : m_text (oc.m_text), m_type (oc.m_type) { }
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
63
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
64 comment_elt& operator = (const comment_elt& oc)
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
65 {
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
66 if (this != &oc)
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
67 {
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
68 m_text = oc.m_text;
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
69 m_type = oc.m_type;
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
70 }
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
71
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
72 return *this;
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
73 }
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
74
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
75 std::string text (void) const { return m_text; }
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
76
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
77 comment_type type (void) const { return m_type; }
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
78
28510
a3ea758870dc new comment_elt predicates
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
79 bool is_block (void) const { return m_type == block; }
a3ea758870dc new comment_elt predicates
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
80 bool is_full_line (void) const { return m_type == full_line; }
a3ea758870dc new comment_elt predicates
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
81 bool is_end_of_line (void) const { return m_type == end_of_line; }
a3ea758870dc new comment_elt predicates
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
82 bool is_doc_string (void) const { return m_type == doc_string; }
a3ea758870dc new comment_elt predicates
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
83 bool is_copyright (void) const { return m_type == copyright; }
a3ea758870dc new comment_elt predicates
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
84
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
85 ~comment_elt (void) = default;
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
86
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
87 private:
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
88
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
89 // The text of the comment.
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
90 std::string m_text;
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
91
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
92 // The type of comment.
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
93 comment_type m_type;
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
94 };
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
95
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
96 class
25336
389757b7b6af eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
97 comment_list : public base_list<comment_elt>
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
98 {
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
99 public:
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
100
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
101 comment_list (void) { }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
102
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
103 void append (const comment_elt& elt)
25336
389757b7b6af eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
104 { base_list<comment_elt>::append (elt); }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
105
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
106 void append (const std::string& s,
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
107 comment_elt::comment_type t = comment_elt::unknown)
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
108 { append (comment_elt (s, t)); }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
109
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
110 comment_list * dup (void) const;
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
111 };
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
112 }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
113
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
114 #endif