CTMoney Class

Description

The CTMoney class represents Money objects.

See Also

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=( String str)

CTMoney operator=( CTMoney money)

CTMoney operator +=( CTMoney money)

CTMoney operator -=( CTMoney money)

CTMoney operator *=( CTMoney money)

CTMoney operator /=( CTMoney money)

CTMoney operator abs( CTMoney money)

CTMoney operator +( CTMoney left, CTMoney right)

CTMoney operator -( CTMoney left, CTMoney right)

CTMoney operator *( CTMoney left, CTMoney right)

CTMoney operator /( CTMoney left, CTMoney right)

Parameters

  • value [in] The double value to be converted and assigned to the new CTMoney object
  • str [in] The String 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

bool operator < ( CTMoney left, CTMoney right)

bool operator <= ( CTMoney left, CTMoney right)

bool operator > ( CTMoney left, CTMoney right)

bool operator >= ( CTMoney left, CTMoney right)

bool operator == ( CTMoney left, CTMoney right)

bool operator != ( CTMoney left, 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 true or false, 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 String object
  • StringToMoney(): Converts a String object to a CTMoney object

CTMoney.CTMoney

Syntax

CTMoney ( )

CTMoney (CTFLOAT value)

CTMoney (CTMONEY money)

CTMoney (String 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 String 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

Single AsFloat( )

Parameters

This method has no parameters.

Description

Converts a CTMoney object to Single.

Return

AsFloat() returns the converted value in CTFLOAT (Single) format.

See Also

AsLong()

CTMoney.AsLong

Syntax

long AsLong( )

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

int AsMoney( )

Parameters

This method has no parameters.

Description

Converts a CTMoney object to a CTMONEY (int) object.

Return

AsMoney() returns a CTMONEY (int) object.

See Also

AsString()

CTMoney.AsString

Syntax

String AsString( )

Parameters

This method has no parameters.

Description

Converts a CTMoney object to a String object.

Return

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

See Also

AsMoney(), StringToMoney()

CTMoney.SetMoney

Syntax

void SetMoney(double value)

void SetMoney(int money)

void SetMoney(String str)

void SetMoney(CTMoney money)

Parameters

  • value [in] The double value to be converted and assigned to the CTMoney object
  • money [in] The CTMoney object or CTMONEY (int) to be assigned to the CTMoney object
  • str [in] The String object to be assigned to the CTMoney object

Description

Initializes the CTMoney object.

Return

None.

CTMoney.StringToMoney

Syntax

void StringToMoney(String str)

Parameters

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

Description

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

Return

None.

See Also

AsString()