annotate libinterp/parse-tree/comment-list.h @ 25054:6652d3823428 stable

maint: Update copyright dates in all source files.
author John W. Eaton <jwe@octave.org>
date Fri, 30 Mar 2018 09:19:05 -0400
parents 7c88cf242111
children 078b795c5219
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
1 /*
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
2
25054
6652d3823428 maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 24833
diff changeset
3 Copyright (C) 2000-2018 John W. Eaton
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
4
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
6
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23750
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
8 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23750
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 GNU General Public License for more details.
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
16
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
18 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23750
diff changeset
19 <https://www.gnu.org/licenses/>.
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
20
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
21 */
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
23 #if ! defined (octave_comment_list_h)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
24 #define octave_comment_list_h 1
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
27
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
28 #include <string>
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
29
22267
b80fddf2a9a0 comment-list.h: properly include "base-list.h".
Carnë Draug <carandraug@octave.org>
parents: 21244
diff changeset
30 #include "base-list.h"
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
31
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
32 namespace octave
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
33 {
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
34 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
35
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
36 extern char * get_comment_text_c_str (void);
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
37
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
38 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
39
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
40 class
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
41 comment_elt
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
42 {
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
43 public:
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
44
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
45 enum comment_type
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
46 {
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
47 unknown,
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
48 block,
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
49 full_line,
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
50 end_of_line,
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
51 doc_string,
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
52 copyright
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
53 };
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
54
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
55 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
56 : 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
57
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
58 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
59 : 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
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& 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
62 {
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
63 if (this != &oc)
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
64 {
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
65 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
66 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
67 }
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
68
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
69 return *this;
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
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
72 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
73
24833
7c88cf242111 use m_ prefix for data members in more classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
74 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
75
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
76 ~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
77
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
78 private:
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
79
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
80 // 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
81 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
82
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
83 // 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
84 comment_type m_type;
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
85 };
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
86
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
87 class
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
88 comment_list : public octave::base_list<comment_elt>
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
89 {
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
90 public:
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
91
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
92 comment_list (void) { }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
93
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
94 void append (const comment_elt& elt)
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
95 { octave::base_list<comment_elt>::append (elt); }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
96
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
97 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
98 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
99 { append (comment_elt (s, t)); }
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 * dup (void) const;
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
102 };
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
103 }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
104
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
105 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
106
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
107 OCTAVE_DEPRECATED (4.4, "use 'octave::comment_list' instead")
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
108 typedef octave::comment_list octave_comment_list;
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 OCTAVE_DEPRECATED (4.4, "use 'octave::comment_elt' instead")
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
111 typedef octave::comment_elt octave_comment_elt;
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
112
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents:
diff changeset
113 #endif
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
114
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23749
diff changeset
115 #endif