Outdent public, protected, and private.
authorMatt McCutchen <matt@mattmccutchen.net>
Tue, 29 Jan 2008 02:24:30 +0000 (21:24 -0500)
committerMatt McCutchen <matt@mattmccutchen.net>
Tue, 29 Jan 2008 02:24:30 +0000 (21:24 -0500)
BigInteger.hh
BigUnsigned.hh
BigUnsignedInABase.hh
NumberlikeArray.hh

index a76335f..bfe3190 100644 (file)
 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
index 3af3866..d5557c7 100644 (file)
@@ -24,7 +24,7 @@
 class BigUnsigned : protected NumberlikeArray<unsigned long> {
 
        // 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<Blk>::Index Index; // (NlA) Type for the index of a block in the array
@@ -32,14 +32,14 @@ class BigUnsigned : protected NumberlikeArray<unsigned long> {
 
        /*
        // 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<unsigned long> {
        //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<Blk>() {} // Default constructor (value is 0)
        BigUnsigned(const BigUnsigned &x) : NumberlikeArray<Blk>(x) {} // Copy constructor
 
@@ -75,7 +75,7 @@ class BigUnsigned : protected NumberlikeArray<unsigned long> {
        ~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<unsigned long> {
 
        // PICKING APART
        // These accessors can be used to get the pieces of the number
-       public:
+public:
        NumberlikeArray<Blk>::getCapacity;
        NumberlikeArray<Blk>::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<unsigned long> {
        bool isZero() const { return NumberlikeArray<Blk>::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<unsigned long> {
         */
 
        // 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<unsigned long> {
        // 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<unsigned long> {
 
        // 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<unsigned long> {
        // 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
index c279826..6925151 100644 (file)
 class BigUnsignedInABase : protected NumberlikeArray<unsigned short> {
 
        // 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<unsigned short> {
        //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<Digit>(), base(2) {} // Default constructor (value is 0 in base 2)
        BigUnsignedInABase(const BigUnsignedInABase &x) : NumberlikeArray<Digit>(x), base(x.base) {} // Copy constructor
 
@@ -96,7 +96,7 @@ class BigUnsignedInABase : protected NumberlikeArray<unsigned short> {
 
        // PICKING APART
        // These accessors can be used to get the pieces of the number
-       public:
+public:
        Base getBase() const { return base; }
        NumberlikeArray<Digit>::getCapacity; // (NlA)
        NumberlikeArray<Digit>::getLength; // (NlA)
@@ -107,7 +107,7 @@ class BigUnsignedInABase : protected NumberlikeArray<unsigned short> {
        bool isZero() const { return NumberlikeArray<Digit>::isEmpty(); } // Often convenient for loops
 
        // EQUALITY TEST
-       public:
+public:
        // Equality test
        bool operator ==(const BigUnsignedInABase &x) const {
                return base == x.base && NumberlikeArray<Digit>::operator ==(x);
index 7b49566..8fa52d7 100644 (file)
@@ -34,7 +34,7 @@
 
 template <class Blk>
 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.