Mercurial > octave
changeset 32591:a9dbbe06ca59 stable
maint: C++ style check for src/ before 9.1 release.
* src/main.in.cc, src/octave-svgconvert.cc:
C++ style check for src/ before 9.1 release.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 12 Dec 2023 22:38:08 -0800 |
parents | 3c2c585965cc |
children | 094a296b3ba1 5383ad4d16c1 |
files | src/main.in.cc src/octave-svgconvert.cc |
diffstat | 2 files changed, 89 insertions(+), 80 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main.in.cc Tue Dec 12 21:18:18 2023 -0800 +++ b/src/main.in.cc Tue Dec 12 22:38:08 2023 -0800 @@ -304,78 +304,78 @@ switch (optc) { - case NO_GUI_LIBS_OPTION: - // Run the version of Octave that is not linked with any GUI - // libraries. It may not be possible to do plotting or any ui* - // calls, but it will be a little faster to start and require less - // memory. Don't pass the --no-gui-libs option on as that option - // is not recognized by Octave. - gui_libs = false; - file = octave_cli; - break; + case NO_GUI_LIBS_OPTION: + // Run the version of Octave that is not linked with any GUI + // libraries. It may not be possible to do plotting or any ui* + // calls, but it will be a little faster to start and require less + // memory. Don't pass the --no-gui-libs option on as that option + // is not recognized by Octave. + gui_libs = false; + file = octave_cli; + break; - case NO_GUI_OPTION: - // If we see this option, then we can just exec octave; we don't - // have to create a child process and wait for it to exit. But do - // exec "octave-gui", not "octave-cli", because even if the - // --no-gui option is given, we may be asked to do some plotting or - // ui* calls. - start_gui = false; - new_argv[k++] = argv[old_optind]; - break; + case NO_GUI_OPTION: + // If we see this option, then we can just exec octave; we don't + // have to create a child process and wait for it to exit. But do + // exec "octave-gui", not "octave-cli", because even if the + // --no-gui option is given, we may be asked to do some plotting or + // ui* calls. + start_gui = false; + new_argv[k++] = argv[old_optind]; + break; - case GUI_OPTION: - // If we see this option, then we fork and exec octave with the - // --gui option, while continuing to handle signals in the - // terminal. - // Do not copy the arg now, since we still not know if the gui - // should really be launched. Just store the index. - start_gui = true; - idx_gui = old_optind; - break; + case GUI_OPTION: + // If we see this option, then we fork and exec octave with the + // --gui option, while continuing to handle signals in the + // terminal. + // Do not copy the arg now, since we still not know if the gui + // should really be launched. Just store the index. + start_gui = true; + idx_gui = old_optind; + break; - case EXPERIMENTAL_TERMINAL_WIDGET_OPTION: - // If we see this option, then we don't fork and exec. - fork_and_exec = false; - new_argv[k++] = argv[old_optind]; - break; + case EXPERIMENTAL_TERMINAL_WIDGET_OPTION: + // If we see this option, then we don't fork and exec. + fork_and_exec = false; + new_argv[k++] = argv[old_optind]; + break; - case PERSIST_OPTION: - // FIXME: How can we reliably detect if this option appears after - // a FILE argument. In this case octave ignores the option, - // but the GUI might still be launched if --gui is also - // given. - persist_octave = true; - new_argv[k++] = argv[old_optind]; - break; + case PERSIST_OPTION: + // FIXME: How can we reliably detect if this option appears after + // a FILE argument. In this case octave ignores the option, + // but the GUI might still be launched if --gui is also + // given. + persist_octave = true; + new_argv[k++] = argv[old_optind]; + break; - case SERVER_OPTION: - server = true; - new_argv[k++] = argv[old_optind]; - break; + case SERVER_OPTION: + server = true; + new_argv[k++] = argv[old_optind]; + break; - case EVAL_OPTION: - eval_code = true; - for (int i = old_optind; i < next_optind; i++) - new_argv[k++] = argv[i]; - break; + case EVAL_OPTION: + eval_code = true; + for (int i = old_optind; i < next_optind; i++) + new_argv[k++] = argv[i]; + break; - case 'q': - // options "--silent" or "--quiet" - warn_display = false; - new_argv[k++] = argv[old_optind]; - break; + case 'q': + // options "--silent" or "--quiet" + warn_display = false; + new_argv[k++] = argv[old_optind]; + break; - case 'W': - // option "--no-window-system" - no_display = true; - new_argv[k++] = argv[old_optind]; - break; + case 'W': + // option "--no-window-system" + no_display = true; + new_argv[k++] = argv[old_optind]; + break; - default: - for (int i = old_optind; i < next_optind; i++) - new_argv[k++] = argv[i]; - break; + default: + for (int i = old_optind; i < next_optind; i++) + new_argv[k++] = argv[i]; + break; } }
--- a/src/octave-svgconvert.cc Tue Dec 12 21:18:18 2023 -0800 +++ b/src/octave-svgconvert.cc Tue Dec 12 22:38:08 2023 -0800 @@ -83,7 +83,8 @@ }; // String conversion functions+QVector<double> qstr2vectorf (QString str) -QVector<double> qstr2vectorf (QString str) +QVector<double> +qstr2vectorf (QString str) { QVector<double> pts; QStringList coords = str.split (","); @@ -95,7 +96,8 @@ // FIXME: What's the difference between qstr2vectorf and qstr2vectord? // Can one be called from the other to avoid code duplication, or deleted? -QVector<double> qstr2vectord (QString str) +QVector<double> +qstr2vectord (QString str) { QVector<double> pts; QStringList coords = str.split (","); @@ -105,7 +107,8 @@ return pts; } -QVector<QPointF> qstr2ptsvector (QString str) +QVector<QPointF> +qstr2ptsvector (QString str) { QVector<QPointF> pts; str = str.trimmed (); @@ -121,7 +124,8 @@ // FIXME: What's the difference between qstr2ptsvector and qstr2ptsvectord? // Can one be called from the other to avoid code duplication, or deleted? -QVector<QPoint> qstr2ptsvectord (QString str) +QVector<QPoint> +qstr2ptsvectord (QString str) { QVector<QPoint> pts; str = str.trimmed (); @@ -136,7 +140,8 @@ } // Extract field arguments in a style-like string, e.g. "bla field(1,34,56) bla" -QString get_field (QString str, QString field) +QString +get_field (QString str, QString field) { QRegularExpression rx (field + "\\(([^\\)]*)\\)"); QRegularExpressionMatch match = rx.match (str); @@ -331,12 +336,13 @@ QList<QPolygonF> m_polygons; }; -void draw (QDomElement& parent_elt, pdfpainter& painter) +void +draw (QDomElement& parent_elt, pdfpainter& painter) { QDomNodeList nodes = parent_elt.childNodes (); static QString clippath_id; - static QMap< QString, QVector<QPoint> > clippath; + static QMap< QString, QVector<QPoint>> clippath; // tspan elements must have access to the font and position extracted from // their parent text element @@ -726,8 +732,9 @@ // Append a list of reconstructed child polygons to a QDomElement and remove // the original nodes -void replace_polygons (QDomElement& parent_elt, QList<QDomNode> orig, - QList<QPolygonF> polygons) +void +replace_polygons (QDomElement& parent_elt, QList<QDomNode> orig, + QList<QPolygonF> polygons) { if (! orig.count () || (orig.count () == polygons.count ())) return; @@ -757,7 +764,8 @@ parent_elt.removeChild (orig.at (ii)); } -void reconstruct_polygons (QDomElement& parent_elt, int reconstruct_level) +void +reconstruct_polygons (QDomElement& parent_elt, int reconstruct_level) { QDomNodeList nodes = parent_elt.childNodes (); QColor current_color; @@ -765,7 +773,7 @@ octave_polygon current_polygon; // Collection of child nodes to be removed and polygons to be added - QList< QPair<QList<QDomNode>,QList<QPolygonF> > > collection; + QList< QPair<QList<QDomNode>, QList<QPolygonF>>> collection; for (int ii = 0; ii < nodes.count (); ii++) { @@ -797,7 +805,7 @@ // Reconstruct the previous series of triangles QList<QPolygonF> polygons = current_polygon.reconstruct (reconstruct_level); - collection.push_back (QPair<QList<QDomNode>,QList<QPolygonF> > + collection.push_back (QPair<QList<QDomNode>, QList<QPolygonF>> (replaced_nodes, polygons)); replaced_nodes.clear (); @@ -816,7 +824,7 @@ if (current_polygon.count ()) { QList<QPolygonF> polygons = current_polygon.reconstruct (reconstruct_level); - collection.push_back (QPair<QList<QDomNode>,QList<QPolygonF> > + collection.push_back (QPair<QList<QDomNode>, QList<QPolygonF>> (replaced_nodes, polygons)); replaced_nodes.clear (); current_polygon.reset (); @@ -826,15 +834,16 @@ } // Finish - collection.push_back (QPair<QList<QDomNode>,QList<QPolygonF> > - (replaced_nodes, - current_polygon.reconstruct (reconstruct_level))); + collection.push_back (QPair<QList<QDomNode>, QList<QPolygonF>> + (replaced_nodes, + current_polygon.reconstruct (reconstruct_level))); for (int ii = 0; ii < collection.count (); ii++) replace_polygons (parent_elt, collection[ii].first, collection[ii].second); } -void add_custom_properties (QDomElement& parent_elt) +void +add_custom_properties (QDomElement& parent_elt) { QDomNodeList nodes = parent_elt.childNodes ();