Mercurial > hg > octave-lojdl
changeset 1879:1b43d3c06c04
[project @ 1996-02-05 16:24:56 by jwe]
author | jwe |
---|---|
date | Mon, 05 Feb 1996 16:31:44 +0000 |
parents | aa2bcaefbc5a |
children | cbdbec67ad60 |
files | liboctave/base-de.h liboctave/base-min.h liboctave/dir-ops.h liboctave/file-ops.h liboctave/idx-vector.h liboctave/oct-glob.h liboctave/str-vec.h |
diffstat | 7 files changed, 103 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/base-de.h +++ b/liboctave/base-de.h @@ -27,18 +27,16 @@ #include "dColVector.h" #include "dMatrix.h" -class base_diff_eqn +class +base_diff_eqn { public: - base_diff_eqn (void) - : x (), t (0.0) { } + base_diff_eqn (void) : x (), t (0.0) { } - base_diff_eqn (const ColumnVector& xx, double tt) - : x (xx), t (tt) { } + base_diff_eqn (const ColumnVector& xx, double tt) : x (xx), t (tt) { } - base_diff_eqn (const base_diff_eqn& a) - : x (a.x), t (a.t) { } + base_diff_eqn (const base_diff_eqn& a) : x (a.x), t (a.t) { } virtual ~base_diff_eqn (void) { }
--- a/liboctave/base-min.h +++ b/liboctave/base-min.h @@ -26,24 +26,24 @@ #include "dColVector.h" -class base_minimizer +class +base_minimizer { public: - base_minimizer (void) - : x () { } + base_minimizer (void) : x () { } - base_minimizer (const ColumnVector& xx) - : x (xx) { } + base_minimizer (const ColumnVector& xx) : x (xx) { } - base_minimizer (const base_minimizer& a) - : x (a.x) { } + base_minimizer (const base_minimizer& a) : x (a.x) { } virtual ~base_minimizer (void) { } base_minimizer& operator = (const base_minimizer& a) { - x = a.x; + if (this != &a) + x = a.x; + return *this; }
--- a/liboctave/dir-ops.h +++ b/liboctave/dir-ops.h @@ -36,10 +36,10 @@ public: dir_entry (const string& n = string ()) : name (n), dir (0) - { - if (! name.empty ()) - open (); - } + { + if (! name.empty ()) + open (); + } dir_entry (const dir_entry& d) { copy (d); }
--- a/liboctave/file-ops.h +++ b/liboctave/file-ops.h @@ -42,7 +42,9 @@ file_stat& operator = (const file_stat& f) { - copy (f); + if (this != &f) + copy (f); + return *this; }
--- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -38,95 +38,97 @@ { private: - struct + class idx_vector_rep - { - idx_vector_rep::idx_vector_rep (void) - { - colon = 0; - len = 0; - num_zeros = 0; - num_ones = 0; - one_zero = 0; - orig_nr = 0; - orig_nc = 0; - initialized = 0; - frozen = 0; - colon_equiv_checked = 0; - colon_equiv = 0; - data = 0; - } + { + public: + + idx_vector_rep::idx_vector_rep (void) + { + colon = 0; + len = 0; + num_zeros = 0; + num_ones = 0; + one_zero = 0; + orig_nr = 0; + orig_nc = 0; + initialized = 0; + frozen = 0; + colon_equiv_checked = 0; + colon_equiv = 0; + data = 0; + } - idx_vector_rep (const ColumnVector& v); + idx_vector_rep (const ColumnVector& v); - idx_vector_rep (const Matrix& m); + idx_vector_rep (const Matrix& m); + + idx_vector_rep (const Range& r); - idx_vector_rep (const Range& r); + idx_vector_rep (char c); - idx_vector_rep (char c); + idx_vector_rep (const idx_vector_rep& a); - idx_vector_rep (const idx_vector_rep& a); + idx_vector_rep::~idx_vector_rep (void) { delete [] data; } - idx_vector_rep::~idx_vector_rep (void) { delete [] data; } + idx_vector_rep& operator = (const idx_vector_rep& a); - idx_vector_rep& operator = (const idx_vector_rep& a); + int ok (void) { return initialized; } - int ok (void) { return initialized; } + int capacity (void) const { return len; } + int length (int colon_len) const { return colon ? colon_len : len; } - int capacity (void) const { return len; } - int length (int colon_len) const { return colon ? colon_len : len; } + int elem (int n) const { return colon ? n : data[n]; } - int elem (int n) const { return colon ? n : data[n]; } + int checkelem (int n) const; + int operator () (int n) const { return checkelem (n); } - int checkelem (int n) const; - int operator () (int n) const { return checkelem (n); } - - int max (void) const { return max_val; } - int min (void) const { return min_val; } - - int one_zero_only (void) const { return one_zero; } - int zeros_count (void) const { return num_zeros; } - int ones_count (void) const { return num_ones; } + int max (void) const { return max_val; } + int min (void) const { return min_val; } + + int one_zero_only (void) const { return one_zero; } + int zeros_count (void) const { return num_zeros; } + int ones_count (void) const { return num_ones; } + + int is_colon (void) const { return colon; } + int is_colon_equiv (int n, int sort); - int is_colon (void) const { return colon; } - int is_colon_equiv (int n, int sort); + int orig_rows (void) const { return orig_nr; } + int orig_columns (void) const { return orig_nc; } - int orig_rows (void) const { return orig_nr; } - int orig_columns (void) const { return orig_nc; } + // other stuff - // other stuff - - void shorten (int n); // Unsafe. Avoid at all cost. + void shorten (int n); // Unsafe. Avoid at all cost. - int freeze (int z_len, const char *tag, int prefer_zero_one, - int resize_ok); + int freeze (int z_len, const char *tag, int prefer_zero_one, + int resize_ok); - // i/o + // i/o - ostream& print (ostream& os) const; + ostream& print (ostream& os) const; - int *data; - int len; - int num_zeros; - int num_ones; - int max_val; - int min_val; - int orig_nr; - int orig_nc; - int count; - int frozen_at_z_len; - int frozen_len; - unsigned int colon : 1; - unsigned int one_zero : 1; - unsigned int initialized : 1; - unsigned int frozen : 1; - unsigned int colon_equiv_checked : 1; - unsigned int colon_equiv : 1; + int *data; + int len; + int num_zeros; + int num_ones; + int max_val; + int min_val; + int orig_nr; + int orig_nc; + int count; + int frozen_at_z_len; + int frozen_len; + unsigned int colon : 1; + unsigned int one_zero : 1; + unsigned int initialized : 1; + unsigned int frozen : 1; + unsigned int colon_equiv_checked : 1; + unsigned int colon_equiv : 1; - void init_state (void); + void init_state (void); - void maybe_convert_one_zero_to_idx (int z_len, int prefer_zero_one); - }; + void maybe_convert_one_zero_to_idx (int z_len, int prefer_zero_one); + }; public:
--- a/liboctave/oct-glob.h +++ b/liboctave/oct-glob.h @@ -46,8 +46,11 @@ glob_match& operator = (const glob_match& gm) { - pat = gm.pat; - flags = gm.flags; + if (this != &gm) + { + pat = gm.pat; + flags = gm.flags; + } return *this; }
--- a/liboctave/str-vec.h +++ b/liboctave/str-vec.h @@ -40,15 +40,22 @@ string_vector : public Array<string> { public: + string_vector (void) : Array<string> () { } + string_vector (int n) : Array<string> (n) { } + string_vector (const char *s) : Array<string> (1, s) { } + string_vector (const string& s) : Array<string> (1, s) { } + string_vector (const string_vector& s) : Array<string> (s) { } string_vector& operator = (const string_vector& s) { - Array<string>::operator = (s); + if (this != &s) + Array<string>::operator = (s); + return *this; }