Class Account API

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 67

Cheque management.

A simple account management system for the

Lightening Cheque
application.

Marc Zonzon

Cheque management.

Contents
1 Date 1.1 1.2 1.3 1.4 1.5 ..................................................... BadDate Exception for bad dates. . . . . . . . . . . . . . . . . . . . . . . . BadFormat Exception for wrong format. . . . . . . . . . . . . . . . . OutputRange Output Range Exception. . . . . . . . . . . . . . . . . . now Tag for the Date constructor. . . . . . . . . . . . . . . . . . . . . . . constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5.4 DateFmt The known date formats . . . . . . . . . . . . . 1.5.5 YearDigits Year is written on 2 or 4 digits . . . . . Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Input-Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4 4 5 5 5 6 7 7 9 10 13 13 15 33 36 37 38 41 42 42 44 45 49 50 53 53 56

1.6 1.7 1.8 1.9 1.10 2 3 4

Money . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TransactionData The TransactionData structure . . . . . . . Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Comparison of transactions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Modiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Account The account class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1 Typedefs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Constructors and destructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Transaction management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Accessors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5 Modiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SecureInt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 SecureInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.1 Overow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

Cheque management.

This small set of classes is aimed to provide an account management facility. The lightening cheque user interface is based on these class. The link between the account level and the UI is done by an account manager layer. Two base classes. The Transaction class group all data from a transaction. An object of the Account class, is a user account. Each user can have as many account as needed. They are not deemed to be true bank account. Four utilities classes: The Date class provide the date needed by transaction and account. The Money is an arithmetic class appropriate for money operations. (xed length, no unexpected rounding, oveow detection). The SecureInt class provides integer with overow detection, it is used by the Money class. The Test class provides the framework for testing each component.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

Date

class Date

Public Members 1.1 struct BadDate 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 struct struct struct BadFormat OutputRange now constants. Constructors Accessors Input-Output Modiers

Exception for bad dates. . . . . . . . . Exception for wrong format. ... Output Range Exception. . . . . . . . Tag for the Date constructor. . . ................................ ................................ ................................ ................................ ................................

4 4 5 5 5 7 9 10 13 13

Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.1

struct BadDate
Exception for bad dates.

Exception for bad dates. Used when the year, month, day do not match any valid date.
1.2

struct BadFormat
Exception for wrong format.

Exception for wrong format. Used when a string cannot be decoded as a date.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

Date

1.3

struct OutputRange
Output Range Exception.

Output Range Exception. Exception thrown when trying to write on two digits a date which cannot be safely encoded.

1.4

struct now
Tag for the Date constructor.

Tag for the Date constructor. Provide a fake type used to ask for the present date.

1.5

constants.

Names 1.5.1 static

const int centuryLim const int lwYear const int hiYear DateFmt YearDigits const DateFmt defaultFmt

The bound to infer a century from a two digits year . . . . . . . . . . . . . . . Lower allowed year. . . . . . . . . . . . . Higher allowed year. ...........

6 6 6 6 7 7

1.5.2 1.5.3 1.5.4 1.5.5 1.5.6

static static enum enum static

The known date formats . . . . . . . . Year is written on 2 or 4 digits . The default format . . . . . . . . . . . . .

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

Date

1.5.1

static const int centuryLim


The bound to infer a century from a two digits year

The bound to infer a century from a two digits year

1.5.2

static const int lwYear


Lower allowed year.

Lower allowed year. This value is set according to Unix timers length.

1.5.3

static const int hiYear


Higher allowed year.

Higher allowed year. This value is set according to Unix timers length.

1.5.4

enum DateFmt
The known date formats

The known date formats

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

Date

1.5.5

enum YearDigits
Year is written on 2 or 4 digits

Year is written on 2 or 4 digits

1.5.6

static const DateFmt defaultFmt


The default format

The default format

1.6

Constructors

Names 1.6.1 Date ( int y, int yday) throw( BadDate) Constructor with a day number in the year. . . . . . . . . . . . . . . . . . . . . . . . Date (now) Current date. . . . . . . . . . . . . . . . . . .

8 8 8 9

1.6.2 1.6.3 1.6.4 1.6.5 explicit

Date ( int y, int m, int d ) throw( BadDate ) year, month, day constructor. Date ( const Date &) copy constructor . . . . . . . . . . . . . . . Date ( std::string s, DateFmt fmt=defaultFmt) throw( BadFormat, BadDate) Scan a string to extract a date. .

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

Date

1.6.1

Date ( int y, int yday) throw( BadDate)

Constructor with a day number in the year.

Constructor with a day number in the year. Parameters: y yday the year day within the year.

1.6.2

Date (now)

Current date.

Current date. You can initialize a date to the current day by saying Date today=now();

1.6.3

Date ( int y, int m, int d ) throw( BadDate )

year, month, day constructor.

year, month, day constructor. Note that you cannot call Date(2005,09,08) because 09 and 08 are inexistent octal numbers, of course Date(2005,9,8) is ne.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

Date

1.6.4

Date ( const Date &)


copy constructor

copy constructor

1.6.5

explicit Date ( std::string s, DateFmt fmt=defaultFmt) throw( BadFormat, BadDate)


Scan a string to extract a date.

Scan a string to extract a date. Years lower than 100 are translated to the current or previous century according how they compare to the constant centuryLim. Throw a BadFormat exception if the string cannot be decoded and a BadDate exception if it is inexistent. Parameters: s fmt The string containing the date. The format used.

1.7

Accessors

Names 1.7.1 int 1.7.2 1.7.3 1.7.4 int int int

year () const month () const day () const yDay () const

................................ ................................ ................................ Number of current day in the year ................................

10 10 10 10

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

Date

1.7.1

int year () const

1.7.2

int month () const

1.7.3

int day () const

1.7.4

int yDay () const


Number of current day in the year

Number of current day in the year

1.8

Input-Output

Names 1.8.1 std::string strDate (YearDigits ydigits=full, DateFmt fmt=defaultFmt ) const String representation of a date. std::ostream&

11

1.8.2

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

10

Date

put (std::ostream& os, YearDigits ydigits=full, DateFmt fmt=defaultFmt) const Put the date on the output stream os. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.8.3 std::ostream& put (std::ostream& os, DateFmt fmt) const Put the date on the output stream os. . . . . . . . . . . . . . . . . . . . . . . . . . . . . std::istream& get (std::istream& is, DateFmt fmt=defaultFmt) throw(BadDate) Get the date from input stream.

12

12

1.8.4

12

1.8.1

std::string strDate (YearDigits

ydigits=full,

DateFmt

fmt=defaultFmt ) const
String representation of a date.

String representation of a date. Return Value: Parameters: a string containing the representation of the date. fmt The format used to print the string. ydigits The year is coded on 4 chars if ydigits isfull and 2 if it is abridged.

1.8.2

std::ostream& put (std::ostream& its=full, const

os,

YearDigits

ydig-

DateFmt

fmt=defaultFmt)

Put the date on the output stream os.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

11

Date

Put the date on the output stream os. Parameters: yWidth fmt ydigits the number of digits for the year ( 2 or 4) The format used to print the string. Year on 4 digits ( full ) or 2 digits ( abridged )usually called via <<

1.8.3

std::ostream& put (std::ostream& os, DateFmt fmt) const


Put the date on the output stream os.

Put the date on the output stream os. Call the previous method with the default of ydigits=full

1.8.4

std::istream& get (std::istream&

is,

DateFmt

fmt=defaultFmt) throw(BadDate)
Get the date from input stream.

Get the date from input stream. Note that input error are either reported through an ios ag if the date cannot be read or with an exception if it is inexistent. Return Value: of th stream after the operation,you can test ios::failBite to know if the reading succeeded. is the input stream. BadDate is thrown when the date is inexistent state

Parameters: Exceptions:

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

12

Date

1.9

Relational operators

Names 1.9.1 bool 1.9.2 1.9.3 bool bool

operator== ( const Date & ) const . . . . . . . . . . . . . . . operator!= ( const Date & ) const . . . . . . . . . . . . . . . . operator< ( const Date & ) const . . . . . . . . . . . . . . . . . .

13 13 13

1.9.1

bool operator== ( const Date & ) const

1.9.2

bool operator!= ( const Date & ) const

1.9.3

bool operator< ( const Date & ) const

1.10

Modiers

Names 1.10.1 Date& 1.10.2 Date 1.10.3 bool

operator++ ()

pre-increment operator . . . . . . . . .

14 14

operator++ ( int ) post-increment operator . . . . . . . . leapYear ( ) const

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

13

Date

True if current year is a leap year ................................

14

1.10.1

Date& operator++ ()
pre-increment operator

pre-increment operator

1.10.2

Date operator++ ( int )


post-increment operator

post-increment operator

1.10.3

bool leapYear ( ) const


True if current year is a leap year

True if current year is a leap year

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

14

Money

Money

Names 2.1 2.2 typedef int SecureInt class Money Detection of overows. . . . . . . . . . 15

std::ostream& operator<< ( std::ostream & output, const Money &m ) throw() Output operator. . . . . . . . . . . . . . . . std::istream& operator>> ( std::istream &is, Money &m ) throw(Money::Overow) Intput operator. . . . . . . . . . . . . . . . .

32

2.3

32

Money

2.1

typedef int SecureInt class Money


Detection of overows.

Names 2.1.1 2.1.2 2.1.3 static inline exceptions constants ................................ ................................ 16 18

bool module precondition () Precondition to build this class. Constructors Accessors operations. Input-Output ................................ ................................ ................................ ................................

19 20 22 24 28 30

2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9

comparison operators. . . . . . . . . . . . . . . . . . . . . . . . . . . Money (SecureInt n) throw()

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

15

Money

Initialize a money var with the raw value. . . . . . . . . . . . . . . . . . . . . .

??

Detection of overows. Use SecureInt to represent the amount in cents as to allow the detection of overows. The Use of SecureInt is only done at an internal level and the user of Money dont need to know about it.
2.1.1

exceptions
Names 2.1.1.1 class 2.1.1.2 class 2.1.1.3 class

Exception

base Money::Exception class . . . .

16 17

Overow : public Exception Exception for overows . . . . . . . . BadFormat : public Exception Exception for error in input of an amount of money . . . . . . . . . . . . . .

17

2.1.1.1

class Exception
base Money::Exception class

Inheritance
2.1.1.1 Exception 2.1.1.2 Overow 2.1.1.3 BadFormat

> >

base Money::Exception class

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

16

Money

2.1.1.2

class Overow : public Exception

Exception for overows

Inheritance
2.1.1.1 Exception 2.1.1.2 Overow

Exception for overows

2.1.1.3

class BadFormat : public Exception

Exception for error in input of an amount of money

Inheritance
2.1.1.1 Exception 2.1.1.3 BadFormat

Exception for error in input of an amount of money

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

17

Money

2.1.2

constants

Names 2.1.2.1 typedef long int value type 2.1.2.2 static 2.1.2.3 static 2.1.2.4 static 2.1.2.5 static const Money max const Money min const int conv const int decades

An integer type to hold a Money value. . . . . . . . . . . . . . . . . . . . . . . . . . . Maximum for a Money . . . . . . . . . Minimum for a Money . . . . . . . . . multiplicand for cents to units. . The number of decimal positions. 19

18 18 19 19

2.1.2.1

typedef long int value type


An integer type to hold a Money value.

An integer type to hold a Money value. value type is an integer type guaranteed to be as large as to be able to represent Money::max in cents.

2.1.2.2

static const Money max


Maximum for a Money

Maximum for a Money

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

18

Money

2.1.2.3

static const Money min


Minimum for a Money

Minimum for a Money

2.1.2.4

static const int conv


multiplicand for cents to units.

multiplicand for cents to units. conv== 10**decades

2.1.2.5

static const int decades


The number of decimal positions.

The number of decimal positions.

2.1.3

static inline bool module precondition ()


Precondition to build this class.

Precondition to build this class. The following assertion must be veried for the code to be valid. it is checked at the beginning of the object module. We check than a short int can be safely encoded as Money without taking care of overows.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

19

Money

2.1.4

Constructors

Names 2.1.4.1 2.1.4.2 explicit Money () throw() A null amount of money . . . . . . . Money (long int n) throw(Overow) Initializer with a number of cents 21 Money (int i) throw(Overow) Initializer with a number of cents 21 Money (short i) throw() Initializer with short number of cents. . . . . . . . . . . . . . . . . . . . . . . . . . . Money (double d) throw(Overow) Initializer with a double. ....... 20

2.1.4.3 explicit

2.1.4.4 explicit

21 21

2.1.4.5 explicit 2.1.4.6 explicit

Money (std::string monstring) throw(BadFormat, Overow ) Constructor with a formated string. . . . . . . . . . . . . . . . . . . . . . . . . . Money (const char* monstring) throw(BadFormat, Overow ) Constructor with a formated string litteral . . . . . . . . . . . . . . . . . . .

22

2.1.4.7 explicit

22

2.1.4.1

Money () throw()

A null amount of money

A null amount of money

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

20

Money

2.1.4.2

explicit Money (long int n) throw(Overow)


Initializer with a number of cents

Initializer with a number of cents

2.1.4.3

explicit Money (int i) throw(Overow)


Initializer with a number of cents

Initializer with a number of cents

2.1.4.4

explicit Money (short i) throw()


Initializer with short number of cents.

Initializer with short number of cents. As value type is always larger than a short no Overow can be sent by this constructor.

2.1.4.5

explicit Money (double d) throw(Overow)


Initializer with a double.

Initializer with a double. Warning: Money(10.4) is 10 cents not 1040 cents. This function round its parameter, it is dierent from a cast from oatting to integral type.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

21

Money

Return Value: Parameters:

value rounded to the closer number of cents. d the double

2.1.4.6

explicit Money (std::string monstring) throw(BadFormat, Overow )


Constructor with a formated string.

Constructor with a formated string. Money(1.1) 1 unit and 10 cents. Parameters: monstring string "xxxxx.xx" for an amount of money.An empty string stand for a null amount of money.

2.1.4.7

explicit Money (const char* monstring) throw(BadFormat, Overow )


Constructor with a formated string litteral

Constructor with a formated string litteral

2.1.5

Accessors

Names 2.1.5.1 value type cents () const throw() Number of cents. . . . . . . . . . . . . . . . 2.1.5.2 value type units () const throw()

23

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

22

Money

Integer number of monetary units ................................ 2.1.5.3 value type value () const throw() The raw value . . . . . . . . . . . . . . . . . .

23 23

2.1.5.1

value type cents () const throw()


Number of cents.

Number of cents. m.cents() < 100

2.1.5.2

value type units () const throw()


Integer number of monetary units

Integer number of monetary units

2.1.5.3

value type value () const throw()


The raw value

The raw value

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

23

Money

2.1.6

operations.

Names 2.1.6.1 Money& 2.1.6.2 Money& operator= ( const Money &) throw() Assignement . . . . . . . . . . . . . . . . . . . operator = (std::string monstring) throw(BadFormat, Overow) Aectation from a string to Money. . . . . . . . . . . . . . . . . . . . . . . . . operator = (const char* monstring) throw(BadFormat, Overow) Aectation from a string litteral to Money . . . . . . . . . . . . . . . . . . . . . . . . . operator + (const Money &) const throw(Overow) sum of money . . . . . . . . . . . . . . . . . . operator += (const Money &) throw(Overow) . . operator - (const Money& ) const throw(Overow) dierence of money . . . . . . . . . . . . operator -= (const Money &) throw(Overow) . . . . operator - () const throw() Opposite amount . . . . . . . . . . . . . . . operator* (double) const throw(Overow) Multiply by a double. . . . . . . . . . . . operator*= (double) throw(Overow) . . . . . . . . . . . . . operator/ (const Money& ) const throw() Divide by an other amount of money. . . . . . . . . . . . . . . . . . . . . . . . . operator/= (double) throw(Overow) . . . . . . . . . . . . . operator/ (double) const throw(Overow) Divide by a real number. . . . . . . . 25

25

2.1.6.3 Money&

25

2.1.6.4 Money

26 26 26 26 27 27 27

2.1.6.5 Money& 2.1.6.6 Money 2.1.6.7 Money& 2.1.6.8 Money 2.1.6.9 Money 2.1.6.10Money& 2.1.6.11double

27 28 28

2.1.6.12Money& 2.1.6.13Money

The additive operations are with Money, the multiplicative operations are with real numbers i.e. double.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

24

Money

2.1.6.1

Money& operator= ( const Money &) throw()

Assignement

Assignement

2.1.6.2

Money& operator = (std::string

monstring)

throw(BadFormat, Overow)

Aectation from a string to Money.

Aectation from a string to Money. Money(1.1) 1 unit and 10 cents. Parameters: monstring string "xxxxx.xx" for an amount of money.

2.1.6.3

Money& operator = (const

char*

monstring)

throw(BadFormat, Overow)

Aectation from a string litteral to Money

Aectation from a string litteral to Money

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

25

Money

2.1.6.4

Money operator + (const

Money

&)

const

throw(Overow)

sum of money

sum of money

2.1.6.5

Money& operator += (const Money &) throw(Overow)

2.1.6.6

Money operator - (const

Money&

const

throw(Overow)

dierence of money

dierence of money

2.1.6.7

Money& operator -= (const Money &) throw(Overow)

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

26

Money

2.1.6.8

Money operator - () const throw()


Opposite amount

Opposite amount

2.1.6.9

Money operator* (double) const throw(Overow)


Multiply by a double.

Multiply by a double. You obtain a money amount. It is how you compute interests.

2.1.6.10

Money& operator*= (double) throw(Overow)

2.1.6.11

double operator/ (const Money& ) const throw()


Divide by an other amount of money.

Divide by an other amount of money. When you divide to amounts of money the result is an abstract real number, not a currency.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

27

Money

2.1.6.12

Money& operator/= (double) throw(Overow)

2.1.6.13

Money operator/ (double) const throw(Overow)


Divide by a real number.

Divide by a real number. And obtain money.

2.1.7

comparison operators.

Names 2.1.7.1 bool 2.1.7.2 bool 2.1.7.3 bool 2.1.7.4 bool 2.1.7.5 operator== (const Money &) const throw() . . . . . operator!= (const Money &) const throw() . . . . . . . operator< (const Money &) const throw() . . . . . . . . operator> (const Money &) const throw() . . . . . . . . missing comparison operators They are generated by the <utility> header from STL. . . . isnull () const throw() Shortcut to test against zero . . . . iscredit () const throw() True for a positive amount . . . . . isdebit () const throw() True for a negative amount . . . . 29 29 29 29

29 29 30 30

2.1.7.6 bool 2.1.7.7 bool 2.1.7.8 bool

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

28

Money

2.1.7.1

bool operator== (const Money &) const throw()

2.1.7.2

bool operator!= (const Money &) const throw()

2.1.7.3

bool operator< (const Money &) const throw()

2.1.7.4

bool operator> (const Money &) const throw()

2.1.7.5

missing comparison operators


They are generated by the <utility> header from STL.

2.1.7.6

bool isnull () const throw()


Shortcut to test against zero

Shortcut to test against zero

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

29

Money

2.1.7.7

bool iscredit () const throw()


True for a positive amount

True for a positive amount

2.1.7.8

bool isdebit () const throw()


True for a negative amount

True for a negative amount

2.1.8

Input-Output

Names 2.1.8.1 std::ostream& put (std::ostream& os, int width=0 ) const throw() put the Money on an output stream. . . . . . . . . . . . . . . . . . . . . . . . . 2.1.8.2 std::string strMoney ( int width) const throw() Convert type Money to a string. 2.1.8.3 std::istream& get (std::istream &is) throw(Overow) Read a Money. . . . . . . . . . . . . . . . . .

31 31

31

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

30

Money

2.1.8.1

std::ostream& put (std::ostream& os, int width=0 ) const throw()


put the Money on an output stream.

put the Money on an output stream. usually called via << Return Value: Parameters: s The modied output stream. os the output stream. width, width of eld, 0 is the defaultand stand for unlimited.

2.1.8.2

std::string strMoney ( int width) const throw()


Convert type Money to a string.

Convert type Money to a string. use the format xxxxx.xx If the number is too large to t in ndigits the length is expanded. This method never truncate an amount of Money. so 0 is used for free length. Parameters: width total number of characters in the eld,

2.1.8.3

std::istream& get (std::istream &is) throw(Overow)


Read a Money.

Read a Money.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

31

Money

Parameters:

Exceptions:

input stream. The I/O ags of ismust be inspected with to know the result of the input. Overflow if the amount is bigger that thecapacity of Money Use the I/O ags to examine the resultof input. is

2.2

std::ostream& operator<< ( std::ostream & output, const Money &m ) throw()


Output operator.

Output operator. operator version of the put method. the width is got from ios so you have to use the ags or manipulators if you want to set it.

2.3

std::istream& operator>> ( std::istream &is, Money &m ) throw(Money::Overow)


Intput operator.

Intput operator. operator version of the get method. Parameters: input stream. The I/O ags of ismust be inspected with to know the result of the input. m the money variable to get the amount on the stream. Overflow if the amount is bigger that thecapacity of Money Use the I/O ags to examine the resultof input. is

Exceptions:

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

32

TransactionData

struct TransactionData
The TransactionData structure

Members 3.1 3.2 3.3 3.4 3.5 3.6 3.7 string Date string string Money bool numM dateM descM categoryM amountM recM The number of the cheque. .... 33 34 34 34 34 35 The date of the transaction . . . . . The payee . . . . . . . . . . . . . . . . . . . . . . The category . . . . . . . . . . . . . . . . . . . The amount of transaction. Reconciled boolean. ... ............

TransactionData () A new transaction with empty data . . . . . . . . . . . . . . . . . . . . . . . . . . . TransactionData (const TransactionData& dataN) Copy constructor . . . . . . . . . . . . . . . TransactionData ( string numN, const Date dateN, string descN, string categoryN, Money amountN, bool recN ) Build a new TransactionData with all elds . . . . . . . . . . . . . . . . . . .

35 35

3.8 3.9

35

The TransactionData structure contains all transaction elds. It is used to gather data from the interface before creating or updating a Transaction

3.1

string numM
The number of the cheque.

The number of the cheque or any code for an other transaction. Some transaction doesnt have a true number. Either because this kind of transaction has no

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

33

TransactionData

number or more often because we dont know the id number that will be given by the bank.
3.2

Date dateM
The date of the transaction

The date of the transaction


3.3

string descM
The payee

The payee
3.4

string categoryM
The category

The category
3.5

Money amountM
The amount of transaction.

The amount is a credit if positive and a debit if negative

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

34

TransactionData

3.6

bool recM
Reconciled boolean.

rcM is true when the transaction as been reconciled with a bank transaction.

3.7

TransactionData ()
A new transaction with empty data

A new transaction with empty data

3.8

TransactionData (const TransactionData& dataN)


Copy constructor

Copy constructor

3.9

TransactionData ( string numN, const Date dateN, string descN, string categoryN, Money amountN, bool recN )
Build a new TransactionData with all elds

Build a new TransactionData with all elds

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

35

Transaction

class Transaction : private TransactionData

Public Members 4.1 4.2 4.3 Transaction () An empty transaction. ......... 36 37 Transaction (const TransactionData&) A transaction from its data . . . . Transaction ( string numN, const Date dateN, string descN, string categoryN, Money amountN, bool recN ) Straight constructor without using TransactionData . . . . . . . . . . . . . . Comparison of transactions. . . . . . . . . . . . . . . . . . . . . Accessors Modiers ................................ ................................

37 37 38 41

4.4 4.5 4.6

A Transaction object an be any kind of transaction on a bank account.

4.1

Transaction ()

An empty transaction.

An empty transaction. all elds are blank but the date (today).

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

36

Transaction

4.2

Transaction (const TransactionData&)


A transaction from its data

A transaction from its data

4.3

Transaction ( string numN, const Date dateN, string descN, string categoryN, Money amountN, bool recN )
Straight constructor without using TransactionData

Straight constructor without using TransactionData

4.4

Comparison of transactions.

Names 4.4.1 4.4.2 4.4.3 bool bool bool operator< ( const Transaction & ) const . . . . . . . . . . . operator== ( const Transaction & ) const . . . . . . . . operator> ( const Transaction & ) const . . . . . . . . . . . 38 38 38

Transactions compare by date then by number. The missing operators are generated by the STL.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

37

Transaction

4.4.1

bool operator< ( const Transaction & ) const

4.4.2

bool operator== ( const Transaction & ) const

4.4.3

bool operator> ( const Transaction & ) const

4.5

Accessors

Names 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 string string string bool Money Money Money Money num () const desc () const The number. . . . . . . . . . . . . . . . . . . . The payee . . . . . . . . . . . . . . . . . . . . . . 39 39 39 39 40 40 40

category () const The category . . . . . . . . . . . . . . . . . . . rec () const amount () const credit () const debit () const True if reconciled . . . . . . . . . . . . . . amount is a relative number . . . . ................................ ................................

recBalance () const The balance after this transaction. ................................

40

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

38

Transaction

4.5.1

string num () const


The number.

The number. It doesnt need to be numeric.

4.5.2

string desc () const


The payee

The payee

4.5.3

string category () const


The category

The category

4.5.4

bool rec () const


True if reconciled

True if reconciled

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

39

Transaction

4.5.5

Money amount () const


amount is a relative number

amount is a relative number

4.5.6

Money credit () const


The credit It is equal to amount if amount is positive otherwise credit() is null.

4.5.7

Money debit () const


The debit is equal to -amount If amount is negative, otherwise debit() is null.

4.5.8

Money recBalance () const


The balance after this transaction.

The balance after this transaction. It depends not only on the amount of this transaction but also of all the preceding ones.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

40

Transaction

4.6

Modiers

Names 4.6.1 4.6.2 4.6.3 void void recBalance (Money m) Set the record-Balance. rec (bool) ........ 41 41 ??

Reconcile a transaction. . . . . . . . . Record balance. ................

mutable Money recBalanceM

4.6.1

void recBalance (Money m)


Set the record-Balance.

The record-Balance is computed by the account class. As the record balance can change even if the transaction doesnt it is declared const

4.6.2

void rec (bool)


Reconcile a transaction.

Reconcile a transaction. It is the only modication you can do without reentering the whole data.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

41

Account

class Account
The account class.

Public Members 5.1 5.2 5.3 5.4 5.5 Typedefs ................................ 42 44 45 49 50 Constructors and destructor . . . . . . . . . . . . . . . . . . . . Transaction management . . . . . . . . . . . . . . . . . . . . . . . Accessors. Modiers ................................ ................................

Protected Members 5.6 void adjustBalance (iterator it ) Adjust the balance after an update. ................................ adjustBalance () Adjust the balance after an update. ................................

52 52

5.7

void

The account class. is used to record the transactions on a specic account. A user can have many accounts. but in the present application we can suppose that the whole number of accounts is quite low (not more than 10) so the speed of creation and destruction is not our rst concern.

5.1

Typedefs

Names 5.1.1 5.1.2 5.1.3 typedef vector<Transaction> TransList typedef TransList::iterator iterator The container for transactions. Iterator type for transactions . . . 43 43

typedef TransList::const iterator

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

42

Account

const iterator 5.1.4 Blank account

Const iterator type for transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . ................................

44 44

5.1.1

typedef vector<Transaction> TransList


The container for transactions.

The container for transactions. We have to choose some convenient type of container the requirements are as follow: The container must be accessible by number. It is because the UI return from menus by number of the selected item. The container is ordered. Because we want that the transaction list stay sorted by date and transaction number. We can suppose that the user will mainly enter transaction sequentially and that sorting is not very often necessary. But of course it would need to be checked. We can achieve this goal either by inserting transactions at their right place or by sorting transactions before to display them. When an account is moved by copy-destruction, the container is also copied and destroyed, it may be time consuming. The cause of moving accounts is that they are themselves placed in containers which can need to move them. It happens when they reclaim space because they dont have room to add new accounts.

5.1.2

typedef TransList::iterator iterator


Iterator type for transactions

Iterator type for transactions

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

43

Account

5.1.3

typedef TransList::const iterator const iterator


Const iterator type for transactions

Const iterator type for transactions

5.1.4

Blank account
Blank account

5.2

Constructors and destructor

Names 5.2.1

Account ( string nameN, string descN, string notesN= ) Account with no transaction . . . . Account ( const Account & oldAccount) Copy constructor. . . . . . . . . . . . . . . ~Account () Destructor. ....................

44 45 45

5.2.2 5.2.3

5.2.1

Account ( string nameN, string descN, string notesN= )


Account with no transaction

Account with no transaction

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

44

Account

5.2.2

Account ( const Account & oldAccount)


Copy constructor.

Copy constructor. The transaction container is copied. Depending on the container this may imply a copy of each transaction.

5.2.3

~Account ()
Destructor.

Destructor. Used during debugging to monitor destructions.

5.3

Transaction management

Names 5.3.1 5.3.2 5.3.3 5.3.4 void void void void push back ( const Transaction & ) Add a new transaction. erase (iterator) sort () ........ 46 46 47

Delete a transaction. . . . . . . . . . . . Sort all transactions. . . . . . . . . . . .

update ( iterator it, const TransactionData &x ) Change the data of the transaction it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . size () const begin () end () the number of transactions . . . . . First transaction. . . . . . . . . . . . . . . Iterator past the end of transactions. . . . . . . . . . . . . . . . . . . . . . . . . . .

47 47 47 48

5.3.5 5.3.6 5.3.7

int iterator iterator

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

45

Account

5.3.8 5.3.9

iterator iterator

last ()

Last transaction. . . . . . . . . . . . . . . .

48 48 48

transaction (int i)Iterator on the transaction numb. ................................ empty () const Predicate true if no transaction.

5.3.10 bool

An account is a transaction container and manager. As we want to keep private the base container we import all necessary operations.

5.3.1

void push back ( const Transaction & )


Add a new transaction.

Add a new transaction. The transaction is added at the end of the container. The record balance is xed as the account balance. The lastNbr is modied if this transaction is numbered. The sorting of transactions is presently done later.

5.3.2

void erase (iterator)


Delete a transaction.

Delete a transaction.

Change the balance an possibly the lastNbr.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

46

Account

5.3.3

void sort ()
Sort all transactions.

Sort all transactions. use the operator < on Transaction.


5.3.4

void update ( iterator it, const TransactionData &x )


Change the data of the transaction it.

Change the data of the transaction it. precondition: begin() it < end().
5.3.5

int size () const


the number of transactions

the number of transactions


5.3.6

iterator begin ()
First transaction.

First transaction. This iterator can be dereferenced only if begin()<end(), otherwise the account is empty.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

47

Account

5.3.7

iterator end ()
Iterator past the end of transactions.

Iterator past the end of transactions.

It can never be dereferenced.

5.3.8

iterator last ()
Last transaction.

Last transaction. (begin() < end()and + +last() = end())orlast() = end()


5.3.9

iterator transaction (int i)


Iterator on the transaction numb.

Iterator on the transaction numb. i. post: begin() + i = transaction(i)


5.3.10

bool empty () const


Predicate true if no transaction.

Predicate true if no transaction. empty() size() == 0

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

48

Account

5.4

Accessors.

Names 5.4.1 5.4.2 5.4.3 5.4.4 5.4.5 string string Money Money int name () const desc () const balance () const Account name . . . . . . . . . . . . . . . . . . Account description . . . . . . . . . . . . Balance of the account. ........ 49 49 50 50 50

bankBalance () const Bank balance of the account. . . . lastNbr () const higher number of a transaction .

5.4.1

string name () const

Account name

Account name

5.4.2

string desc () const

Account description

Account description

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

49

Account

5.4.3

Money balance () const


Balance of the account.

Balance of the account. Sum of all transactions amount.

5.4.4

Money bankBalance () const


Bank balance of the account.

Bank balance of the account. Sum of all reconciled transactions amount.

5.4.5

int lastNbr () const


higher number of a transaction

higher number of a transaction

5.5

Modiers

Names 5.5.1 5.5.2 void void name ( string newname ) Account name modier . . . . . . . . . desc (string newdesc ) 51

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

50

Account

Account description modier . . . 5.5.3 5.5.4 void void lastNbr (int n) set the recorded last number . . . .

51 51 52

lastNbr (string s) Set the last number to the argument if numeric. . . . . . . . . . . . . . . .

5.5.1

void name ( string newname )


Account name modier

Account name modier

5.5.2

void desc (string newdesc )


Account description modier

Account description modier

5.5.3

void lastNbr (int n)


set the recorded last number

set the recorded last number

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

51

Account

5.5.4

void lastNbr (string s)


Set the last number to the argument if numeric.

Set the last number to the argument if numeric. The last number is unchanged if s is not numeric. Parameters: s any string, when it is a numeric string it replacesthe last number.

5.6

void adjustBalance (iterator it )


Adjust the balance after an update.

Adjust the balance after an update. Parameters: it is the rst modied transaction

5.7

void adjustBalance ()
Adjust the balance after an update.

Adjust the balance after an update. All transactions are inspected to compute the balance.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

52

SecureInt.

SecureInt.

Names 6.1 6.2 class SecureInt ................................ 53 std::ostream& operator << (std::ostream & os, SecureInt i) throw() ................................ std::istream& operator >> (std::istream & is, SecureInt& i) throw(SecureInt::Overow) ................................

67

6.3

67

SecureInt. A class for a secure integer arithmetic.

6.1

class SecureInt

Public Members 6.1.1 6.1.2 6.1.3 class Overow ................................ ................................ 56 56 typedef long value type static inline

bool module precondition () Precondition to build this class. ................................ ................

56 56 56 57 57

6.1.4 6.1.5 6.1.6 6.1.7 6.1.8

static static static static static

const int bsize

const bool odd word error odd word error. const int bhalf size const value type max value const value type

A half word size . . . . . . . . . . . . . . . . Maximum value . . . . . . . . . . . . . . . .

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

53

SecureInt.

min value 6.1.9 static const SecureInt max const SecureInt min

Minimum value . . . . . . . . . . . . . . . . Maximum SecureInt . . . . . . . . . . Minimum SecureInt . . . . . . . . . . .

57 57 58 58 58 58 58 59 59 59 59 59 59 60 60 60 60 60 60 61 61 61 61 61 62 62 62 62

6.1.10 static 6.1.11 6.1.12 explicit 6.1.13 explicit 6.1.14 explicit

SecureInt (value type i=0) throw(Overow) . . . . . . . . SecureInt (int i) throw(Overow) . . . . . . . . . . . . . . . . . . SecureInt (short i) throw(Overow) . . . . . . . . . . . . . . . . SecureInt (double d) throw(Overow) Floating-integral conversions. ..

6.1.15 SecureInt 6.1.16 SecureInt 6.1.17 SecureInt 6.1.18 SecureInt 6.1.19 SecureInt 6.1.20 SecureInt 6.1.21 SecureInt 6.1.22 SecureInt 6.1.23 SecureInt 6.1.24 SecureInt 6.1.25 SecureInt 6.1.26 double

operator + (SecureInt i) const throw(Overow) . . operator - (SecureInt i) const throw(Overow) . . . operator * (SecureInt i) const throw(Overow) . . . operator / (SecureInt i) const throw() . . . . . . . . . . . . operator% (SecureInt i) const throw() . . . . . . . . . . . . operator + (int i) const throw(Overow) . . . . . . . . . operator - (int i) const throw(Overow) . . . . . . . . . . operator * (int i) const throw(Overow) . . . . . . . . . . operator / (int i) const throw() . . . . . . . . . . . . . . . . . . operator% (int i) const throw() . . . . . . . . . . . . . . . . . . operator - () const throw() . . . . . . . . . . . . . . . . . . . . . . . . operator * (double d) const throw() product by a double. . . . . . . . . . . . .

6.1.27 SecureInt& operator = (const SecureInt& i) throw() . . . . . . . . . . 6.1.28 SecureInt& operator = (int i) throw(Overow) aectation of an int. . . . . . . . . . . . 6.1.29 SecureInt& operator = (short i) throw(Overow) . . . . . . . . . . . . . 6.1.30 SecureInt& operator = (value type i) throw(Overow) . . . . . . . . 6.1.31 SecureInt& operator = (double d) throw(Overow) . . . . . . . . . . . 6.1.32 SecureInt& operator += (SecureInt i) throw(Overow) . . . . . . . 6.1.33 SecureInt& operator -= (SecureInt i) throw(Overow) . . . . . . . . 6.1.34 SecureInt& operator *= (SecureInt i) throw(Overow) . . . . . . . . 6.1.35 SecureInt& operator /= (SecureInt i) throw() . . . . . . . . . . . . . . . .

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

54

SecureInt.

6.1.36 SecureInt& operator += (int i) throw(Overow). . . . . . . . . . . . . . 6.1.37 SecureInt& operator -= (int i) throw(Overow) . . . . . . . . . . . . . . . 6.1.38 SecureInt& operator *= (int i) throw(Overow) . . . . . . . . . . . . . . 6.1.39 SecureInt& operator /= (int i) throw() . . . . . . . . . . . . . . . . . . . . . . . 6.1.40 SecureInt& operator *= (double d) throw(Overow) product of current value by a double; Equivalent to * then = . . . . . 6.1.41 SecureInt& operator/= (double) throw(Overow) division of current value by a double; Equivalent to / then = . . . . . 6.1.42 bool 6.1.43 bool 6.1.44 bool 6.1.45 bool 6.1.46 bool 6.1.47 bool 6.1.48 bool 6.1.49 bool 6.1.50 bool 6.1.51 bool 6.1.52 bool 6.1.53 bool 6.1.54 SecureInt 6.1.55 SecureInt 6.1.56 double operator == (SecureInt i) const throw() . . . . . . . . . . operator == (value type i) const throw() . . . . . . . . . operator == (int i) const throw() . . . . . . . . . . . . . . . . operator!= (SecureInt i) const throw() . . . . . . . . . . . operator!= (value type i) const throw() . . . . . . . . . . operator!= (int i) const throw() . . . . . . . . . . . . . . . . . . operator< (SecureInt i) const throw() . . . . . . . . . . . . . operator< (value type i) const throw() . . . . . . . . . . . . operator< (int i) const throw() . . . . . . . . . . . . . . . . . . . operator> (SecureInt i) const throw() . . . . . . . . . . . . . operator> (value type i) const throw() . . . . . . . . . . . . operator> (int i) const throw() . . . . . . . . . . . . . . . . . . . operator/ (const SecureInt& ) const throw(). . . . . . operator/ (long i ) const throw() . . . . . . . . . . . . . . . . . operator/ (double) const throw() . . . . . . . . . . . . . . . . .

62 62 63 63

63

63 63 64 64 64 64 64 64 65 65 65 65 65 65 66 66 66 66

6.1.57 std::ostream& put (std::ostream & os) const throw() . . . . . . . . . . . . . . 6.1.58 std::istream& get (std::istream & is) throw(Overow) . . . . . . . . . . . . . 6.1.59 template< class Target> Target cast to () const throw() cast to an other arithmetic type. 6.1.60 template<class T>static bool rangeOK (T i) Range predicate. ...............

66 67

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

55

SecureInt.

6.1.1

class Overow

6.1.2

typedef long value type

6.1.3

static inline bool module precondition ()


Precondition to build this class.

Precondition to build this class. The following assertion must be veried for the code to be valid. it is checked at the beginning of the object module.

6.1.4

static const int bsize

6.1.5

static const bool odd word error


odd word error.

odd word error. I suppose that a word has always an even size, so I make sure to fail if some strange CPU is using odd side for a word.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

56

SecureInt.

6.1.6

static const int bhalf size


A half word size

A half word size

6.1.7

static const value type max value


Maximum value

Maximum value

6.1.8

static const value type min value


Minimum value

Minimum value

6.1.9

static const SecureInt max


Maximum SecureInt

Maximum SecureInt

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

57

SecureInt.

6.1.10

static const SecureInt min


Minimum SecureInt

Minimum SecureInt

6.1.11

SecureInt (value type i=0) throw(Overow)

6.1.12

explicit SecureInt (int i) throw(Overow)

6.1.13

explicit SecureInt (short i) throw(Overow)

6.1.14

explicit SecureInt (double d) throw(Overow)


Floating-integral conversions.

Floating-integral conversions. In respect to others Floating-integral conversions The double d is truncated to produce a SecureInt value.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

58

SecureInt.

6.1.15

SecureInt operator + (SecureInt throw(Overow)

i)

const

6.1.16

SecureInt operator - (SecureInt i) const throw(Overow)

6.1.17

SecureInt operator * (SecureInt i) const throw(Overow)

6.1.18

SecureInt operator / (SecureInt i) const throw()

6.1.19

SecureInt operator% (SecureInt i) const throw()

6.1.20

SecureInt operator + (int i) const throw(Overow)

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

59

SecureInt.

6.1.21

SecureInt operator - (int i) const throw(Overow)

6.1.22

SecureInt operator * (int i) const throw(Overow)

6.1.23

SecureInt operator / (int i) const throw()

6.1.24

SecureInt operator% (int i) const throw()

6.1.25

SecureInt operator - () const throw()

6.1.26

double operator * (double d) const throw()


product by a double.

product by a double. Return Value: a double value.

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

60

SecureInt.

6.1.27

SecureInt& operator = (const SecureInt& i) throw()

6.1.28

SecureInt& operator = (int i) throw(Overow)


aectation of an int.

aectation of an int. It is very usefull to have an aectation of a smaller int type because it can be down without conversion. We dont know on which machine int and short are smaller than value type; so we cannot exclude an Overow.

6.1.29

SecureInt& operator = (short i) throw(Overow)

6.1.30

SecureInt& operator = (value type i) throw(Overow)

6.1.31

SecureInt& operator = (double d) throw(Overow)

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

61

SecureInt.

6.1.32

SecureInt& operator += (SecureInt i) throw(Overow)

6.1.33

SecureInt& operator -= (SecureInt i) throw(Overow)

6.1.34

SecureInt& operator *= (SecureInt i) throw(Overow)

6.1.35

SecureInt& operator /= (SecureInt i) throw()

6.1.36

SecureInt& operator += (int i) throw(Overow)

6.1.37

SecureInt& operator -= (int i) throw(Overow)

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

62

SecureInt.

6.1.38

SecureInt& operator *= (int i) throw(Overow)

6.1.39

SecureInt& operator /= (int i) throw()

6.1.40

SecureInt& operator *= (double d) throw(Overow)


product of current value by a double; Equivalent to * then =

product of current value by a double; Equivalent to * then =

6.1.41

SecureInt& operator/= (double) throw(Overow)


division of current value by a double; Equivalent to / then =

division of current value by a double; Equivalent to / then =

6.1.42

bool operator == (SecureInt i) const throw()

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

63

SecureInt.

6.1.43

bool operator == (value type i) const throw()

6.1.44

bool operator == (int i) const throw()

6.1.45

bool operator!= (SecureInt i) const throw()

6.1.46

bool operator!= (value type i) const throw()

6.1.47

bool operator!= (int i) const throw()

6.1.48

bool operator< (SecureInt i) const throw()

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

64

SecureInt.

6.1.49

bool operator< (value type i) const throw()

6.1.50

bool operator< (int i) const throw()

6.1.51

bool operator> (SecureInt i) const throw()

6.1.52

bool operator> (value type i) const throw()

6.1.53

bool operator> (int i) const throw()

6.1.54

SecureInt operator/ (const SecureInt& ) const throw()

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

65

SecureInt.

6.1.55

SecureInt operator/ (long i ) const throw()

6.1.56

double operator/ (double) const throw()

6.1.57

std::ostream& put (std::ostream & os) const throw()

6.1.58

std::istream& get (std::istream & is) throw(Overow)

6.1.59

template< class Target> Target cast to () const throw()

cast to an other arithmetic type.

cast to an other arithmetic type. The cast is done by the standard static cast and can cause a truncation if the target type is smaller than value type

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

66

SecureInt.

6.1.60

template<class T>static bool rangeOK (T i)


Range predicate.

Range predicate. Check if a value from an other numeric type can be safely encoded as a SecureInt. Allow to try before use instead of using exceptions.

6.2

std::ostream& operator << (std::ostream & os, SecureInt i) throw()

6.3

std::istream& operator >> (std::istream & is, SecureInt& i) throw(SecureInt::Overow)

This page was generated with the help of DOC++ http://docpp.sourceforge.net

July 1, 2003

67

You might also like