Mercurial > hg > octave-avbm
view src/txt-eng.h @ 15466:d174210ce1ec stable
use ' instead of ` in error messages, warnings and most comments
* intro.txi, io.txi, munge-texi.cc, octave.texi, cmd-edit.cc,
data-conv.cc, file-ops.cc, glob-match.h, kpse.cc, oct-env.cc,
oct-locbuf.h, oct-md5.cc, oct-rand.cc, general/interp2.m, doc.m,
get_first_help_sentence.m, help.m, print_usage.m,
__additional_help_message__.m, type.m, unimplemented.m, which.m,
cast.m, dir.m, license.m, mkoctfile.m, recycle.m, tempdir.m,
optimset.m, pkg/pkg.m, closereq.m, colstyle.m, __fltk_print__.m,
__gnuplot_print__.m, __go_draw_figure__.m, __pie__.m, __pltopt__.m,
__print_parse_opts__.m, uigetdir.m, uigetfile.m, uiputfile.m, stft.m,
mean.m, anova.m, cor_test.m, t_test_regression.m, __magick_read__.cc,
dlmread.cc, schur.cc, data.cc, debug.cc, defun-dld.h, defun.cc,
defun.h, dynamic-ld.cc, error.cc, error.h, gl-render.cc, graphics.cc,
gripes.cc, input.cc, lex.ll, load-path.cc, load-save.cc, ls-hdf5.cc,
ls-mat-ascii.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-ascii.cc,
ls-oct-binary.cc, oct-hist.cc, oct-parse.yy, oct-stream.cc,
oct-stream.h, octave.cc, ov-base-diag.cc, ov-base.cc, ov-class.cc,
ov-colon.h, ov-struct.cc, ov-typeinfo.cc, ov.cc, pager.cc,
pr-output.cc, pt-binop.cc, pt-eval.cc, pt-id.cc, pt-idx.cc,
pt-misc.cc, pt-unop.cc, symtab.cc, symtab.h, toplev.cc, txt-eng-ft.cc,
utils.cc, variables.cc, test_eval-catch.m, test_try.m:
Use ' instead of ` in error messages, warnings, and most comments.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 01 Oct 2012 17:18:49 -0400 |
parents | 72c96de7a403 |
children |
line wrap: on
line source
/* Copyright (C) 2009-2012 Michael Goffioul This file is part of Octave. Octave is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see <http://www.gnu.org/licenses/>. */ #if ! defined (txt_eng_h) #define txt_eng_h 1 #include "base-list.h" class text_element; class text_element_string; class text_element_list; class text_subscript_element; class text_superscript_element; class text_processor; class OCTINTERP_API text_element { public: text_element (void) { } virtual ~text_element (void) { } virtual void accept (text_processor& p) = 0; private: text_element (const text_element&); }; class OCTINTERP_API text_element_string : public text_element { public: text_element_string (const std::string& s = "") : text_element (), str (s) { } ~text_element_string (void) { } std::string string_value (void) const { return str; } void accept (text_processor& p); private: std::string str; private: text_element_string (const text_element_string &); }; class OCTINTERP_API text_element_list : public text_element, public octave_base_list<text_element *> { public: text_element_list (void) : text_element (), octave_base_list<text_element*> () { } ~text_element_list (void) { while (! empty ()) { iterator it = begin (); delete (*it); erase (it); } } void accept (text_processor& p); }; class OCTINTERP_API text_subscript_element : public text_element_list { public: text_subscript_element (void) : text_element_list () { } ~text_subscript_element (void) { } void accept (text_processor& p); }; class OCTINTERP_API text_superscript_element : public text_element_list { public: text_superscript_element (void) : text_element_list () { } ~text_superscript_element (void) { } void accept (text_processor& p); }; class OCTINTERP_API text_processor { public: virtual void visit (text_element_string& e) = 0; virtual void visit (text_element_list& e) { for (text_element_list::iterator it = e.begin (); it != e.end (); ++it) { (*it)->accept (*this); } } virtual void visit (text_subscript_element& e) { visit (dynamic_cast<text_element_list&> (e)); } virtual void visit (text_superscript_element& e) { visit (dynamic_cast<text_element_list&> (e)); } virtual void reset (void) { } protected: text_processor (void) { } virtual ~text_processor (void) { } }; #define TEXT_ELEMENT_ACCEPT(cls) \ inline void \ cls::accept (text_processor& p) \ { p.visit (*this); } TEXT_ELEMENT_ACCEPT(text_element_string) TEXT_ELEMENT_ACCEPT(text_element_list) TEXT_ELEMENT_ACCEPT(text_subscript_element) TEXT_ELEMENT_ACCEPT(text_superscript_element) class OCTINTERP_API text_parser { public: text_parser (void) { } virtual ~text_parser (void) { } virtual text_element* parse (const std::string& s) = 0; }; class OCTINTERP_API text_parser_none : public text_parser { public: text_parser_none (void) : text_parser () { } ~text_parser_none (void) { } // FIXME: is it possible to use reference counting to manage the // memory for the object returned by the text parser? That would be // preferable to having to know when and where to delete the object it // creates... text_element* parse (const std::string& s) { return new text_element_string (s); } }; #endif