From 2301f99c6175d543626d61c0bda90e80f85e7eac Mon Sep 17 00:00:00 2001 From: Matt McCutchen Date: Mon, 28 Jan 2008 21:24:30 -0500 Subject: [PATCH] Outdent public, protected, and private. --- BigInteger.hh | 22 +++++++++++----------- BigUnsigned.hh | 22 +++++++++++----------- BigUnsignedInABase.hh | 12 ++++++------ NumberlikeArray.hh | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/BigInteger.hh b/BigInteger.hh index a76335f..bfe3190 100644 --- a/BigInteger.hh +++ b/BigInteger.hh @@ -24,17 +24,17 @@ class BigInteger : public BigUnsigned { // TYPES & CONSTANTS - public: +public: enum Sign { negative = -1, zero = 0, positive = 1 }; // Enumeration for the sign of a BigInteger // FIELDS - protected: +protected: Sign sign; // The sign of this BigInteger // MANAGEMENT - protected: +protected: BigInteger(Sign s, Index c) : BigUnsigned(0, c), sign(s) {}; // Creates a BigInteger with a sign and capacity - public: +public: BigInteger() : BigUnsigned(), sign(zero) {} // Default constructor (value is 0) BigInteger(const BigInteger &x) : BigUnsigned(x), sign(x.sign) {}; // Copy constructor @@ -58,7 +58,7 @@ class BigInteger : public BigUnsigned { // automatically; this takes its absolute value. // CONVERTERS to integral types - public: +public: operator unsigned long () const; operator long () const; operator unsigned int () const; @@ -68,11 +68,11 @@ class BigInteger : public BigUnsigned { // PICKING APART // These accessors can be used to get the pieces of the number - public: +public: Sign getSign() const; // COMPARISONS - public: +public: // Compares this to x like Perl's <=> CmpRes compareTo(const BigInteger &x) const; // Normal comparison operators @@ -89,7 +89,7 @@ class BigInteger : public BigUnsigned { /* These store the result of the operation on the arguments into this. * a.add(b, c) is equivalent to, but faster than, a = b + c. * See explanation of "put-here operations" in BigUnsigned.cc . */ - public: +public: void add (const BigInteger &a, const BigInteger &b); // Addition void subtract(const BigInteger &a, const BigInteger &b); // Subtraction void multiply(const BigInteger &a, const BigInteger &b); // Multiplication @@ -125,7 +125,7 @@ class BigInteger : public BigUnsigned { // NORMAL OPERATORS // These perform the operation on this (to the left of the operator) // and x (to the right of the operator) and return a new BigInteger with the result. - public: +public: BigInteger operator +(const BigInteger &x) const; // Addition BigInteger operator -(const BigInteger &x) const; // Subtraction BigInteger operator *(const BigInteger &x) const; // Multiplication @@ -135,7 +135,7 @@ class BigInteger : public BigUnsigned { // ASSIGNMENT OPERATORS // These perform the operation on this and x, storing the result into this. - public: +public: void operator +=(const BigInteger &x); // Addition void operator -=(const BigInteger &x); // Subtraction void operator *=(const BigInteger &x); // Multiplication @@ -146,7 +146,7 @@ class BigInteger : public BigUnsigned { // INCREMENT/DECREMENT OPERATORS // These increase or decrease the number by 1. To discourage side effects, // these do not return *this, so prefix and postfix behave the same. - public: +public: void operator ++( ); // Prefix increment void operator ++(int); // Postfix decrement void operator --( ); // Prefix increment diff --git a/BigUnsigned.hh b/BigUnsigned.hh index 3af3866..d5557c7 100644 --- a/BigUnsigned.hh +++ b/BigUnsigned.hh @@ -24,7 +24,7 @@ class BigUnsigned : protected NumberlikeArray { // TYPES & CONSTANTS - public: +public: enum CmpRes { less = -1, equal = 0, greater = 1 }; // Enumeration for the result of a comparison typedef unsigned long Blk; // The number block type that BigUnsigneds are built from typedef NumberlikeArray::Index Index; // (NlA) Type for the index of a block in the array @@ -32,14 +32,14 @@ class BigUnsigned : protected NumberlikeArray { /* // FIELDS - protected: +protected: Index cap; // (NlA) The current allocated capacity of this BigUnsigned (in blocks) Index len; // (NlA) The actual length of the number stored in this BigUnsigned (in blocks) Blk *blk; // (NlA) Dynamically allocated array of the number blocks */ // MANAGEMENT - protected: +protected: // These members generally defer to those in NumberlikeArray, possibly with slight changes. // It might be nice if one could request that constructors be inherited in C++. @@ -53,7 +53,7 @@ class BigUnsigned : protected NumberlikeArray { //void allocate(Index c); // (NlA) Ensures the number array has at least the indicated capacity, maybe discarding contents //void allocateAndCopy(Index c); // (NlA) Ensures the number array has at least the indicated capacity, preserving its contents - public: +public: BigUnsigned() : NumberlikeArray() {} // Default constructor (value is 0) BigUnsigned(const BigUnsigned &x) : NumberlikeArray(x) {} // Copy constructor @@ -75,7 +75,7 @@ class BigUnsigned : protected NumberlikeArray { ~BigUnsigned() {} // Destructor // CONVERTERS to integral types - public: +public: operator unsigned long () const; operator long () const; operator unsigned int () const; @@ -85,7 +85,7 @@ class BigUnsigned : protected NumberlikeArray { // PICKING APART // These accessors can be used to get the pieces of the number - public: +public: NumberlikeArray::getCapacity; NumberlikeArray::getLength; // Note that getBlock returns 0 if the block index is beyond the length of the number. @@ -95,7 +95,7 @@ class BigUnsigned : protected NumberlikeArray { bool isZero() const { return NumberlikeArray::isEmpty(); } // Often convenient for loops // COMPARISONS - public: +public: // Compares this to x like Perl's <=> CmpRes compareTo(const BigUnsigned &x) const; // Normal comparison operators @@ -152,7 +152,7 @@ class BigUnsigned : protected NumberlikeArray { */ // PUT-HERE OPERATIONS - public: +public: /* These 3: Two read-only operands as arguments. Result left in *this. */ void add(const BigUnsigned &a, const BigUnsigned &b); // Addition void subtract(const BigUnsigned &a, const BigUnsigned &b); // Subtraction @@ -192,7 +192,7 @@ class BigUnsigned : protected NumberlikeArray { // NORMAL OPERATORS // These perform the operation on this (to the left of the operator) // and x (to the right of the operator) and return a new BigUnsigned with the result. - public: +public: BigUnsigned operator +(const BigUnsigned &x) const; // Addition BigUnsigned operator -(const BigUnsigned &x) const; // Subtraction BigUnsigned operator *(const BigUnsigned &x) const; // Multiplication @@ -209,7 +209,7 @@ class BigUnsigned : protected NumberlikeArray { // ASSIGNMENT OPERATORS // These perform the operation on this and x, storing the result into this. - public: +public: void operator +=(const BigUnsigned &x); // Addition void operator -=(const BigUnsigned &x); // Subtraction void operator *=(const BigUnsigned &x); // Multiplication @@ -227,7 +227,7 @@ class BigUnsigned : protected NumberlikeArray { // INCREMENT/DECREMENT OPERATORS // These increase or decrease the number by 1. To discourage side effects, // these do not return *this, so prefix and postfix behave the same. - public: +public: void operator ++( ); // Prefix increment void operator ++(int); // Postfix decrement void operator --( ); // Prefix increment diff --git a/BigUnsignedInABase.hh b/BigUnsignedInABase.hh index c279826..6925151 100644 --- a/BigUnsignedInABase.hh +++ b/BigUnsignedInABase.hh @@ -35,16 +35,16 @@ class BigUnsignedInABase : protected NumberlikeArray { // TYPES - public: +public: typedef unsigned short Digit; // The digit type that BigUnsignedInABases are built from typedef Digit Base; // FIELDS - protected: +protected: Base base; // The base of this BigUnsignedInABase // MANAGEMENT - protected: +protected: // These members generally defer to those in NumberlikeArray, possibly with slight changes. // It might be nice if one could request that constructors be inherited in C++. @@ -58,7 +58,7 @@ class BigUnsignedInABase : protected NumberlikeArray { //void allocate(Index c); // (NlA) Ensures the number array has at least the indicated capacity, maybe discarding contents //void allocateAndCopy(Index c); // (NlA) Ensures the number array has at least the indicated capacity, preserving its contents - public: +public: BigUnsignedInABase() : NumberlikeArray(), base(2) {} // Default constructor (value is 0 in base 2) BigUnsignedInABase(const BigUnsignedInABase &x) : NumberlikeArray(x), base(x.base) {} // Copy constructor @@ -96,7 +96,7 @@ class BigUnsignedInABase : protected NumberlikeArray { // PICKING APART // These accessors can be used to get the pieces of the number - public: +public: Base getBase() const { return base; } NumberlikeArray::getCapacity; // (NlA) NumberlikeArray::getLength; // (NlA) @@ -107,7 +107,7 @@ class BigUnsignedInABase : protected NumberlikeArray { bool isZero() const { return NumberlikeArray::isEmpty(); } // Often convenient for loops // EQUALITY TEST - public: +public: // Equality test bool operator ==(const BigUnsignedInABase &x) const { return base == x.base && NumberlikeArray::operator ==(x); diff --git a/NumberlikeArray.hh b/NumberlikeArray.hh index 7b49566..8fa52d7 100644 --- a/NumberlikeArray.hh +++ b/NumberlikeArray.hh @@ -34,7 +34,7 @@ template class NumberlikeArray { - public: +public: typedef unsigned int Index; // Type for the index of a block in the array static const unsigned int N; // The number of bits in a block, defined below. -- 2.34.1