changeset 30160:14b098a6ba46

maint: Use public: qualifier in structs that are really classes. * __eigs__.cc, graphics.in.h, load-path.h, ls-hdf5.h, ov-base-int.cc, bp-table.h, profiler.h, token.h, Array-util.cc, MArray.cc, Sparse-diag-op-defs.h, lo-ieee.h, oct-sort.cc, oct-sort.h: Use public: qualifier in structs that are really classes.
author Rik <rik@octave.org>
date Fri, 10 Sep 2021 07:02:04 -0700
parents 868156b5027b
children c8d5ec1f5618
files libinterp/corefcn/__eigs__.cc libinterp/corefcn/graphics.in.h libinterp/corefcn/load-path.h libinterp/corefcn/ls-hdf5.h libinterp/octave-value/ov-base-int.cc libinterp/parse-tree/bp-table.h libinterp/parse-tree/profiler.h libinterp/parse-tree/token.h liboctave/array/Array-util.cc liboctave/array/MArray.cc liboctave/operators/Sparse-diag-op-defs.h liboctave/util/lo-ieee.h liboctave/util/oct-sort.cc liboctave/util/oct-sort.h
diffstat 14 files changed, 83 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/__eigs__.cc	Thu Sep 09 21:08:44 2021 -0700
+++ b/libinterp/corefcn/__eigs__.cc	Fri Sep 10 07:02:04 2021 -0700
@@ -49,18 +49,23 @@
 
 #if defined (HAVE_ARPACK)
 
-struct eigs_callback {
-  // Pointer for user defined function.
-  octave_value m_eigs_fcn;
-
-  // Have we warned about imaginary values returned from user function?
-  bool m_warned_imaginary = false;
+struct eigs_callback
+{
+public:
 
   ColumnVector
   eigs_func (const ColumnVector& x, int& eigs_error);
 
   ComplexColumnVector
   eigs_complex_func (const ComplexColumnVector& x, int& eigs_error);
+
+  //--------
+
+  // Pointer for user defined function.
+  octave_value m_eigs_fcn;
+
+  // Have we warned about imaginary values returned from user function?
+  bool m_warned_imaginary = false;
 };
 
 // Is this a recursive call?
--- a/libinterp/corefcn/graphics.in.h	Thu Sep 09 21:08:44 2021 -0700
+++ b/libinterp/corefcn/graphics.in.h	Fri Sep 10 07:02:04 2021 -0700
@@ -2433,6 +2433,7 @@
 protected:
   struct cmp_caseless_str
   {
+  public:
     bool operator () (const caseless_str& a, const caseless_str& b) const
     {
       std::string a1 = a;
--- a/libinterp/corefcn/load-path.h	Thu Sep 09 21:08:44 2021 -0700
+++ b/libinterp/corefcn/load-path.h	Fri Sep 10 07:02:04 2021 -0700
@@ -229,6 +229,7 @@
 
       struct class_info
       {
+      public:
         class_info (void) : method_file_map (), private_file_map () { }
 
         class_info (const class_info& ci)
--- a/libinterp/corefcn/ls-hdf5.h	Thu Sep 09 21:08:44 2021 -0700
+++ b/libinterp/corefcn/ls-hdf5.h	Fri Sep 10 07:02:04 2021 -0700
@@ -99,6 +99,7 @@
 
 struct hdf5_callback_data
 {
+public:
   hdf5_callback_data (void)
     : name (), global (false), tc (), doc () { }
 
--- a/libinterp/octave-value/ov-base-int.cc	Thu Sep 09 21:08:44 2021 -0700
+++ b/libinterp/octave-value/ov-base-int.cc	Fri Sep 10 07:02:04 2021 -0700
@@ -80,6 +80,7 @@
 template <typename T, bool is_signed = true, bool can_be_too_big = true>
 struct octave_base_int_helper
 {
+public:
   static bool
   char_value_out_of_range (T val)
   {
@@ -90,12 +91,14 @@
 template <typename T>
 struct octave_base_int_helper<T, false, false>
 {
+public:
   static bool char_value_out_of_range (T) { return false; }
 };
 
 template <typename T>
 struct octave_base_int_helper<T, false, true>
 {
+public:
   static bool char_value_out_of_range (T val)
   {
     return val > std::numeric_limits<unsigned char>::max ();
@@ -105,6 +108,7 @@
 template <typename T>
 struct octave_base_int_helper<T, true, false>
 {
+public:
   static bool char_value_out_of_range (T val) { return val < 0; }
 };
 
--- a/libinterp/parse-tree/bp-table.h	Thu Sep 09 21:08:44 2021 -0700
+++ b/libinterp/parse-tree/bp-table.h	Fri Sep 10 07:02:04 2021 -0700
@@ -43,10 +43,13 @@
 
   struct bp_type
   {
+  public:
+    bp_type (int l, const std::string& c) : line (l), cond (c) { }
+
+    //--------
+
     int line;
     std::string cond;
-
-    bp_type (int l, const std::string& c) : line (l), cond (c) { }
   };
 
   // Interface to breakpoints.
--- a/libinterp/parse-tree/profiler.h	Thu Sep 09 21:08:44 2021 -0700
+++ b/libinterp/parse-tree/profiler.h	Fri Sep 10 07:02:04 2021 -0700
@@ -114,19 +114,23 @@
     // hierarchical call tree.
     struct stats
     {
+    public:
       stats (void);
 
+      typedef std::set<octave_idx_type> function_set;
+
+      // Convert a function_set list to an Octave array of indices.
+      static octave_value function_set_value (const function_set&);
+
+      //--------
+
       double m_time;
       std::size_t m_calls;
 
       bool m_recursive;
 
-      typedef std::set<octave_idx_type> function_set;
       function_set m_parents;
       function_set m_children;
-
-      // Convert a function_set list to an Octave array of indices.
-      static octave_value function_set_value (const function_set&);
     };
 
     typedef std::vector<stats> flat_profile;
--- a/libinterp/parse-tree/token.h	Thu Sep 09 21:08:44 2021 -0700
+++ b/libinterp/parse-tree/token.h	Fri Sep 10 07:02:04 2021 -0700
@@ -176,19 +176,21 @@
 
       struct superclass_info
       {
-        superclass_info (void) = delete;
-
-        superclass_info (const std::string& meth,
-                         const std::string& cls)
+      public:
+        superclass_info (const std::string& meth, const std::string& cls)
           : m_method_name (meth), m_class_name (cls)
         { }
 
+        superclass_info (void) = delete;
+
         superclass_info (const superclass_info&) = delete;
 
         superclass_info& operator = (const superclass_info&) = delete;
 
         ~superclass_info (void) = default;
 
+        //--------
+
         // The name of the method to call.  This is the text before the
         // "@" and may be of the form "object.method".
         std::string m_method_name;
--- a/liboctave/array/Array-util.cc	Thu Sep 09 21:08:44 2021 -0700
+++ b/liboctave/array/Array-util.cc	Fri Sep 10 07:02:04 2021 -0700
@@ -523,12 +523,14 @@
 // A helper class.
 struct sub2ind_helper
 {
-  octave_idx_type *ind, n;
-
+public:
   sub2ind_helper (octave_idx_type *_ind, octave_idx_type _n)
-    : ind(_ind), n(_n) { }
+    : ind (_ind), n (_n) { }
 
-  void operator ()(octave_idx_type k) { (*ind++ *= n) += k; }
+  void operator () (octave_idx_type k) { (*ind++ *= n) += k; }
+
+  //--------
+  octave_idx_type *ind, n;
 };
 
 octave::idx_vector
--- a/liboctave/array/MArray.cc	Thu Sep 09 21:08:44 2021 -0700
+++ b/liboctave/array/MArray.cc	Fri Sep 10 07:02:04 2021 -0700
@@ -34,21 +34,31 @@
 template <typename T>
 struct _idxadds_helper
 {
+public:
+  _idxadds_helper (T *a, T v) : array (a), val (v) { }
+
+  void operator () (octave_idx_type i)
+  { array[i] += val; }
+
+  //--------
+
   T *array;
   T val;
-  _idxadds_helper (T *a, T v) : array (a), val (v) { }
-  void operator () (octave_idx_type i)
-  { array[i] += val; }
 };
 
 template <typename T>
 struct _idxadda_helper
 {
+public:
+  _idxadda_helper (T *a, const T *v) : array (a), vals (v) { }
+
+  void operator () (octave_idx_type i)
+  { array[i] += *vals++; }
+
+  //--------
+
   T *array;
   const T *vals;
-  _idxadda_helper (T *a, const T *v) : array (a), vals (v) { }
-  void operator () (octave_idx_type i)
-  { array[i] += *vals++; }
 };
 
 template <typename T>
@@ -91,11 +101,16 @@
                             typename ref_param<T>::type)>
 struct _idxbinop_helper
 {
+public:
+  _idxbinop_helper (T *a, const T *v) : array (a), vals (v) { }
+
+  void operator () (octave_idx_type i)
+  { array[i] = op (array[i], *vals++); }
+
+  //--------
+
   T *array;
   const T *vals;
-  _idxbinop_helper (T *a, const T *v) : array (a), vals (v) { }
-  void operator () (octave_idx_type i)
-  { array[i] = op (array[i], *vals++); }
 };
 
 template <typename T>
--- a/liboctave/operators/Sparse-diag-op-defs.h	Thu Sep 09 21:08:44 2021 -0700
+++ b/liboctave/operators/Sparse-diag-op-defs.h	Fri Sep 10 07:02:04 2021 -0700
@@ -106,6 +106,7 @@
 struct identity_val
   : public std::unary_function <T, T>
 {
+public:
   T operator () (const T x) { return x; }
 };
 
--- a/liboctave/util/lo-ieee.h	Thu Sep 09 21:08:44 2021 -0700
+++ b/liboctave/util/lo-ieee.h	Fri Sep 10 07:02:04 2021 -0700
@@ -128,6 +128,7 @@
   template <typename T>
   struct numeric_limits
   {
+  public:
     static T NA (void) { return static_cast<T> (0); }
     static T NaN (void) { return static_cast<T> (0); }
     static T Inf (void) { return static_cast<T> (0); }
@@ -136,6 +137,7 @@
   template <>
   struct numeric_limits<double>
   {
+  public:
     static double NA (void) { return octave_NA; }
     static double NaN (void) { return octave_NaN; }
     static double Inf (void) { return octave_Inf; }
@@ -144,6 +146,7 @@
   template <>
   struct numeric_limits<float>
   {
+  public:
     static float NA (void) { return octave_Float_NA; }
     static float NaN (void) { return octave_Float_NaN; }
     static float Inf (void) { return octave_Float_Inf; }
--- a/liboctave/util/oct-sort.cc	Thu Sep 09 21:08:44 2021 -0700
+++ b/liboctave/util/oct-sort.cc	Fri Sep 10 07:02:04 2021 -0700
@@ -1596,8 +1596,10 @@
 // FIXME: is there really no way to make this local to the following function?
 struct sortrows_run_t
 {
+public:
   sortrows_run_t (octave_idx_type c, octave_idx_type o, octave_idx_type n)
     : col (c), ofs (o), nel (n) { }
+  //--------
   octave_idx_type col, ofs, nel;
 };
 
--- a/liboctave/util/oct-sort.h	Thu Sep 09 21:08:44 2021 -0700
+++ b/liboctave/util/oct-sort.h	Fri Sep 10 07:02:04 2021 -0700
@@ -196,6 +196,8 @@
 
   struct MergeState
   {
+  public:
+
     MergeState (void)
       : m_min_gallop (), m_a (nullptr), m_ia (nullptr), m_alloced (0), m_n (0)
     { reset (); }
@@ -216,10 +218,11 @@
 
     void getmemi (octave_idx_type need);
 
-    // This controls when we get *into* galloping mode.  It's
-    // initialized to MIN_GALLOP.  merge_lo and merge_hi tend to nudge
-    // it higher for random data, and lower for highly structured
-    // data.
+    //--------
+
+    // This controls when we get *into* galloping mode.  It's initialized to
+    // MIN_GALLOP.  merge_lo and merge_hi tend to nudge it higher for random
+    // data, and lower for highly structured data.
     octave_idx_type m_min_gallop;
 
     // 'a' is temp storage to help with merges.  It contains room for
@@ -228,9 +231,9 @@
     octave_idx_type *m_ia;
     octave_idx_type m_alloced;
 
-    // A stack of n pending runs yet to be merged.  Run #i starts at
-    // address base[i] and extends for len[i] elements.  It's always
-    // true (so long as the indices are in bounds) that
+    // A stack of n pending runs yet to be merged.  Run #i starts at address
+    // base[i] and extends for len[i] elements.  It's always true (so long as
+    // the indices are in bounds) that
     //
     //   pending[i].base + pending[i].len == pending[i+1].base
     //