annotate libinterp/parse-tree/comment-list.h @ 33292:2e840d58dba7

comment_list: don't inherit from std::list * comment-list.h (class comment_list): Store std::list<comment_elt> as data member instead of using inheritance. Adjust member functions. (comment_list::reference, comment_list::const_reference, comment_list::iterator, comment_list::const_iterator): New typedefs. (comment_list::clear, comment_list::front, comment_list::back, comment_list::begin, comment_list::end, comment_list::empty): New methods.
author John W. Eaton <jwe@octave.org>
date Thu, 28 Mar 2024 13:00:25 -0400
parents 0b5f3219b650
children
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 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31855
diff changeset
3 // Copyright (C) 2000-2024 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
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32931
diff changeset
31 #include <list>
33292
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
32 #include <memory>
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
33 #include <string>
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
34
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
35 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
36
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
37 extern std::string get_comment_text ();
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
38
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
39 extern char * get_comment_text_c_str ();
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
40
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
41 extern void save_comment_text (const std::string& text);
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
42
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 31855
diff changeset
43 class comment_elt
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
44 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
45 public:
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
46
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
47 enum comment_type
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
48 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
49 unknown,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
50 block,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
51 full_line,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
52 end_of_line,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
53 copyright
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
54 };
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
55
32917
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
56 comment_elt (const std::string& s = "", comment_type t = unknown, bool uses_hash_char = false)
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
57 : m_text (s), m_type (t), m_uses_hash_char (uses_hash_char) { }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
58
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
59 comment_elt (const comment_elt& oc)
32917
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
60 : m_text (oc.m_text), m_type (oc.m_type), m_uses_hash_char (oc.m_uses_hash_char)
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
61 { }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
62
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
63 comment_elt& operator = (const comment_elt& oc)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
64 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
65 if (this != &oc)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
66 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
67 m_text = oc.m_text;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
68 m_type = oc.m_type;
32917
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
69 m_uses_hash_char = oc.m_uses_hash_char;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
70 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
71
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
72 return *this;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
73 }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
74
32917
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
75 bool empty () const { return m_text.empty (); }
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
76
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
77 std::string text () const { return m_text; }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
78
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
79 comment_type type () const { return m_type; }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
80
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
81 bool is_block () const { return m_type == block; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
82 bool is_full_line () const { return m_type == full_line; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
83 bool is_end_of_line () const { return m_type == end_of_line; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
84 bool is_copyright () const { return m_type == copyright; }
32917
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
85 bool uses_hash_char () const { return m_uses_hash_char; }
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
86
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
87 void reset ()
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
88 {
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
89 m_text = "";
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
90 m_type = unknown;
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
91 m_uses_hash_char = false;
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
92 }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
93
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
94 ~comment_elt () = default;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
95
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
96 private:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
97
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
98 // The text of the comment.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
99 std::string m_text;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
100
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
101 // The type of comment.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
102 comment_type m_type;
32917
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
103
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
104 // TRUE means a line comment uses '#' or a block comment used at least
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
105 // one '#' delimiter.
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
106 bool m_uses_hash_char;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
107 };
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
108
33292
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
109 class comment_list
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
110 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
111 public:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
112
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
113 OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE_DELETE (comment_list)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
114
33292
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
115 typedef std::list<comment_elt>::reference reference;
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
116 typedef std::list<comment_elt>::const_reference const_reference;
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
117
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
118 typedef std::list<comment_elt>::iterator iterator;
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
119 typedef std::list<comment_elt>::const_iterator const_iterator;
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
120
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
121 void append (const comment_elt& elt)
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32931
diff changeset
122 {
33292
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
123 m_list.push_back (elt);
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32931
diff changeset
124 }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
125
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
126 void append (const std::string& s,
32917
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
127 comment_elt::comment_type t = comment_elt::unknown,
f41297ca3e1a when parsing, record whether a comment uses a '#' delimeter
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
128 bool uses_hash_char = false)
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32931
diff changeset
129 {
33292
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
130 m_list.push_back (comment_elt (s, t, uses_hash_char));
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32931
diff changeset
131 }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
132
33292
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
133 void clear () { m_list.clear (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
134
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
135 bool empty () const { return m_list.empty (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
136
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
137 reference front () { return m_list.front (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
138 reference back () { return m_list.back (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
139
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
140 const_reference front () const { return m_list.front (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
141 const_reference back () const { return m_list.back (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
142
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
143 iterator begin () { return m_list.begin (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
144 iterator end () { return m_list.end (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
145
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
146 const_iterator begin () const { return m_list.begin (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
147 const_iterator end () const { return m_list.end (); }
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
148
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
149 comment_list * dup () const;
32930
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
150
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
151 // Documentation for functions is typically the first block of
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
152 // comments that doesn't look like a copyright statement.
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
153 comment_elt find_doc_comment () const
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
154 {
33292
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
155 for (const auto& elt : m_list)
32930
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
156 {
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
157 // FIXME: should we also omit end-of-line comments?
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
158 if (! elt.is_copyright ())
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
159 return elt;
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
160 }
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
161
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
162 return comment_elt ();
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
163 }
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
164
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
165 std::string find_doc_string () const
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
166 {
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
167 return find_doc_comment().text ();
ab4b7e516ff3 allow help for ordinary functions to work again (bug #65220)
John W. Eaton <jwe@octave.org>
parents: 32917
diff changeset
168 }
33292
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
169
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
170 private:
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
171
2e840d58dba7 comment_list: don't inherit from std::list
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
172 std::list<comment_elt> m_list;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
173 };
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
174
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
175 OCTAVE_END_NAMESPACE(octave)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
176
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
177 #endif