GNU Octave  4.4.1
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-2018 John W. Eaton
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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_comment_list_h)
24 #define octave_comment_list_h 1
25 
26 #include "octave-config.h"
27 
28 #include <string>
29 
30 #include "base-list.h"
31 
32 namespace octave
33 {
34  extern std::string get_comment_text (void);
35 
36  extern char * get_comment_text_c_str (void);
37 
38  extern void save_comment_text (const std::string& text);
39 
40  class
42  {
43  public:
44 
46  {
52  copyright
53  };
54 
55  comment_elt (const std::string& s = "", comment_type t = unknown)
56  : m_text (s), m_type (t) { }
57 
59  : m_text (oc.m_text), m_type (oc.m_type) { }
60 
61  comment_elt& operator = (const comment_elt& oc)
62  {
63  if (this != &oc)
64  {
65  m_text = oc.m_text;
66  m_type = oc.m_type;
67  }
68 
69  return *this;
70  }
71 
72  std::string text (void) const { return m_text; }
73 
74  comment_type type (void) const { return m_type; }
75 
76  ~comment_elt (void) = default;
77 
78  private:
79 
80  // The text of the comment.
82 
83  // The type of comment.
85  };
86 
87  class
89  {
90  public:
91 
92  comment_list (void) { }
93 
94  void append (const comment_elt& elt)
96 
97  void append (const std::string& s,
99  { append (comment_elt (s, t)); }
100 
101  comment_list * dup (void) const;
102  };
103 }
104 
105 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
106 
107 OCTAVE_DEPRECATED (4.4, "use 'octave::comment_list' instead")
108 typedef octave::comment_list octave_comment_list;
109 
110 OCTAVE_DEPRECATED (4.4, "use 'octave::comment_elt' instead")
111 typedef octave::comment_elt octave_comment_elt;
112 
113 #endif
114 
115 #endif
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:997
void save_comment_text(const std::string &text)
s
Definition: file-io.cc:2729
std::string text(void) const
Definition: comment-list.h:72
comment_elt(const std::string &s="", comment_type t=unknown)
Definition: comment-list.h:55
std::string get_comment_text(void)
std::string m_text
Definition: comment-list.h:81
bool append
Definition: load-save.cc:1618
void append(const std::string &s, comment_elt::comment_type t=comment_elt::unknown)
Definition: comment-list.h:97
comment_type type(void) const
Definition: comment-list.h:74
comment_type m_type
Definition: comment-list.h:84
void append(const comment_elt &elt)
Definition: comment-list.h:94
comment_elt(const comment_elt &oc)
Definition: comment-list.h:58
char * get_comment_text_c_str(void)
void append(const elt_type &s)
Definition: base-list.h:110
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888