Mercurial > octave
annotate libinterp/corefcn/comment-list.h @ 22323:bac0d6f07a3e
maint: Update copyright notices for 2016.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 17 Aug 2016 01:05:19 -0400 |
parents | b80fddf2a9a0 |
children | 2758af148ced |
rev | line source |
---|---|
3665 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22267
diff
changeset
|
3 Copyright (C) 2000-2016 John W. Eaton |
3665 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3665 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3665 | 20 |
21 */ | |
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 | 24 #define octave_comment_list_h 1 |
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 | 28 #include <string> |
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 | 31 |
32 extern std::string get_comment_text (void); | |
33 | |
34 extern char *get_comment_text_c_str (void); | |
35 | |
36 extern void save_comment_text (const std::string& text); | |
37 | |
38 class | |
39 octave_comment_elt | |
40 { | |
41 public: | |
42 | |
43 enum comment_type | |
44 { | |
45 unknown, | |
46 block, | |
16228
e19b1632d7c1
revamp most comment handling
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
47 full_line, |
3665 | 48 end_of_line, |
49 doc_string, | |
50 copyright | |
51 }; | |
52 | |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
53 octave_comment_elt (const std::string& s = "", |
10313 | 54 comment_type t = unknown) |
3665 | 55 : txt (s), typ (t) { } |
56 | |
57 octave_comment_elt (const octave_comment_elt& oc) | |
58 : txt (oc.txt), typ (oc.typ) { } | |
59 | |
60 octave_comment_elt& operator = (const octave_comment_elt& oc) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
62 if (this != &oc) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
63 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 txt = oc.txt; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 typ = oc.typ; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 } |
3665 | 67 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 } |
3665 | 70 |
71 std::string text (void) const { return txt; } | |
72 | |
73 comment_type type (void) const { return typ; } | |
74 | |
75 ~octave_comment_elt (void) { } | |
76 | |
77 private: | |
78 | |
79 // The text of the comment. | |
80 std::string txt; | |
81 | |
82 // The type of comment. | |
83 comment_type typ; | |
84 }; | |
85 | |
86 class | |
4219 | 87 octave_comment_list : public octave_base_list<octave_comment_elt> |
3665 | 88 { |
89 public: | |
90 | |
5861 | 91 octave_comment_list (void) { } |
92 | |
4219 | 93 void append (const octave_comment_elt& elt) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
94 { octave_base_list<octave_comment_elt>::append (elt); } |
3665 | 95 |
4212 | 96 void append (const std::string& s, |
10313 | 97 octave_comment_elt::comment_type t = octave_comment_elt::unknown) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
98 { append (octave_comment_elt (s, t)); } |
5861 | 99 |
8913
35cd375d4bb3
make tree::dup functions const
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
100 octave_comment_list *dup (void) const; |
3665 | 101 }; |
102 | |
103 #endif |