CTMoney Class

class CTMoney

Description

The CTMoney class represents Money objects.

See Also

CTString, CTCurrency

Preconditions

This is one of the basic objects from the c-tree database layer.

 

CTMoney Operators

  • operator =, +=, -=, *=, /=, abs, +, -, *, / : Assignment and arithmetic operators
  • operator <, <=, >, >=, ==, != : Comparison operators

 

CTMoney::operator =, +=, -=, *=, /=, abs, +, -, *, /

Syntax

CTMoney& operator=(CTFLOAT value)
CTMoney& operator=(CTMONEY value)
CTMoney& operator=( const CTString& str)
CTMoney& operator=(const CTMoney& money)
CTMoney& operator +=(const CTMoney& money)
CTMoney& operator -=(const CTMoney& money)
CTMoney& operator *=(const CTMoney& money)
CTMoney& operator /=(const CTMoney& money)
CTMoney& operator abs(const CTMoney& money)
CTMoney& operator +(const CTMoney& left, const CTMoney& right)
CTMoney& operator -(const CTMoney& left, const CTMoney& right)
CTMoney& operator *(const CTMoney& left, const CTMoney& right)
CTMoney& operator /(const CTMoney& left, const CTMoney& right)

Parameters

  • value [in] The double value to be converted and assigned to the new CTMoney object
  • str [in] The CTString object to be assigned to the new CTMoney object
  • money [in] The CTMoney object to be assigned to the new CTMoney object
  • left [in] The left CTMoney object to be concatenated to form the new CTMoney object
  • right [in] The right CTMoney object to be concatenated to form the new CTMoney object

Description

Assigns or concatenates values to form a CTMoney object

Return

The new CTMoney object

 

CTMoney::operator <, <=, >, >=, ==, !=

Syntax

CTBOOL operator < (const CTMoney& left, const CTMoney& right)
CTBOOL operator <= (const CTMoney& left, const CTMoney& right)
CTBOOL operator > (const CTMoney& left, const CTMoney& right)
CTBOOL operator >= (const CTMoney& left, const CTMoney& right)
CTBOOL operator == (const CTMoney& left, const CTMoney& right)
CTBOOL operator != (const CTMoney& left, const CTMoney& right)

Parameters

  • left [in] The left CTMoney object to be compared
  • right [in] The right CTMoney object to be compared

Description

These overloaded operators make comparisons between two CTMoney objects.

Return

The operators return YES or NO, depending on the result of the comparison.

 

CTMoney Methods

Constructor / Destructor

  • CTMoney(): Creates a CTMoney object
  • ~CTMoney(): Destroys a CTMoney Object and resets all the dependent objects

Money Handling

  • SetMoney(): Initializes the CTMoney object.
  • AsFloat(); Converts a CTMoney object to float
  • AsLong(): Converts a CTMoney object to long
  • AsMoney(): Converts a CTMoney object to CTMoney
  • AsString(): Converts a CTMoney object to a CTString object
  • StringToMoney(): Converts a CTString object to a CTMoney object

 

CTMoney::CTMoney

Syntax

CTMoney ( )
CTMoney (CTFLOAT value)
CTMoney (CTMONEY money)
CTMoney (const CTString& str)
CTMoney (CTMoney& money)

Parameters

  • Value [in] The double value to be converted and assigned to the new CTMoney object
  • money [in] The CTMoney object or Money to be assigned to the new CTMoney object
  • str [in] The CTString object to be assigned to the new CTMoney object

Description

This is the constructor for the CTMoney object.

See also

~CTMoney()

 

CTMoney::~CTMoney

Syntax

~CTMoney

Parameters

This destructor has no parameters.

Description

This is the destructor for the CTMoney object.

See also

CTMoney

 

CTMoney::AsFloat

Syntax

CTFLOAT AsFloat( )  const

Parameters

This method has no parameters.

Description

Converts a CTMoney object to float.

Return

AsFloat() returns the converted value in CTFloat format.

See also

AsLong()

 

CTMoney::AsLong

Syntax

LONG AsLong( ) const

Parameters

This method has no parameters.

Description

Converts a CTMoney object to LONG.

Return

AsLong() returns the converted value in LONG format.

See also

AsFloat()

 

CTMoney::AsMoney

Syntax

CTMONEY AsMoney( ) const

Parameters

This method has no parameters.

Description

Converts a CTMONEY object to a CTMoney object.

Return

AsMoney() returns a CTMoney object.

See also

AsString()

 

CTMoney::AsString

Syntax

CTString AsString( ) const

Parameters

This method has no parameters.

Description

Converts a CTMONEY object to a CTString object.

Return

AsString() returns a CTString object with the Money value.

See also

StringToMoney(), AsMoney()

 

CTMoney::SetInt

Declaration

CTMoney::SetInt(int value);

Description

Enable the assignment of an integer value to a CTMoney object.

Return

None.

 

CTMoney::SetMoney

Syntax

void SetMoney(CTFLOAT value)
void SetMoney(CTMONEY money)
void SetMoney(const CTString& str)
void SetMoney(const CTMoney& money)

Parameters

  • value [in] The double value to be converted and assigned to the CTMoney object
  • money [in] The CTMoney object or Money to be assigned to the CTMoney object
  • str [in] The CTString object to be assigned to the CTMoney object

Description

Initializes the CTMoney object.

Return

None.

 

CTMoney::StringToMoney

Syntax

void StringToMoney(const CTString& str)

Parameters

  • str [in] The string object to be converted.

Description

StringToMoney() converts a CTString object to a CTMoney object.

Return

None.

See also

AsString()