CTCurrency Class

Description

The CTCurrency class represents Currency objects. Currency objects are 64-bit integers representing currency values.

See Also

CTMoney

Preconditions

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

CTCurrency Operators

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

CTCurrency.operator =, +=, -=, *=, /=, abs, +, -, *, /

Syntax

CTCurrency operator=(int value)

CTCurrency operator=(double value)

CTCurrency operator=(CTCURRENCY value)

CTCurrency operator=(CTMoney value)

CTCurrency operator=(String value)

CTCurrency operator=(CTBigint value)

CTCurrency operator=(CTCurrency value)

CTCurrency operator+=(CTCurrency value)

CTCurrency operator-=(CTCurrency value)

CTCurrency operator*=(CTCurrency value)

CTCurrency operator/=(CTCurrency value)

CTCurrency operator abs(CTCurrency& value)

CTCurrency operator +(CTCurrency left, CTCurrency right)

CTCurrency operator -(CTCurrency left, CTCurrency right)

CTCurrency operator *(CTCurrency left, CTCurrency right)

CTCurrency operator /(CTCurrency left, CTCurrency right)

Parameters

  • value [in] int, double, CTCurrency, CTMoney, String, CTBigint or CTCurrency value or object to be assigned to or updated with the new CTCurrency object.
  • left [in] The left CTCurrency object to be concatenated to form the new CTCurrency object
  • right [in] The right CTCurrency object to be concatenated to form the new CTCurrency object

Description

Assigns or concatenates values to form a CTCurrency object

Return

The new CTCurrency object

CTCurrency.operator <, <=, >, >=, ==, !=

Syntax

bool operator < ( CTCurrency left, CTCurrency right)

bool operator <= ( CTCurrency left, CTCurrency right)

bool operator > ( CTCurrency left, CTCurrency right)

bool operator >= ( CTCurrency left, CTCurrency right)

bool operator == ( CTCurrency left, CTCurrency right)

bool operator != ( CTCurrency left, CTCurrency right)

Parameters

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

Description

These overloaded operators make comparisons between two CTCurrency objects.

Return

The operators return true or false, depending on the result of the comparison.

CTCurrency Methods

Constructor / Destructor

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

Currency Handling

  • IsZero(): Indicates if a currency value is zero
  • Zero(): Sets a currency value to zero
  • SetCurrency(): Initializes the CTCurrency object.
  • AsFloat(): Converts a CTCurrency object to single
  • AsLong(): Converts a CTCurrency object to long
  • AsBigint(): Converts a CTCurrency object to big integer
  • AsCurrency(): Retrieves the CTCurrency type (long)
  • AsMoney(): Converts a CTCurrency object to a CTMoney object
  • AsString(): Converts a CTCurrency object to a String object
  • Round(int scale): Rounds a CTCurrency to a specified number of decimal places.

CTCurrency.CTCurrency

Syntax

CTCurrency ( )

CTCurrency (long value)

CTCurrency (double value)

CTCurrency (CTCURRENCY value)

CTCurrency( CTMoney value)

CTCurrency( String value)

CTCurrency( CTBigint value)

CTCurrency( CTCurrency value)

Parameters

  • value: [in] The long, double, CTCURRENCY, CTMoney, String, CTBigint or CTCurrency value or object to be converted and assigned to the new CTCurrency object

Description

This is the constructor for the CTCurrency object.

See Also

~CTCurrency()

CTCurrency.~CTCurrency

Syntax

~CTCurrency

Parameters

This destructor has no parameters.

Description

This is the destructor for the CTCurrency object.

See Also

CTCurrency()

CTCurrency.AsBigint

Syntax

CTBigint AsBigint( )

Parameters

This method has no parameters.

Description

Convert a CTCurrency object to big integer.

Return

AsBigint() returns the converted value in big integer (64-bit) format.

See Also

AsFloat(), AsLong()

CTCurrency.AsCurrency

Syntax

CTCURRENCY AsCurrency( )

Parameters

This method has no parameters.

Description

Retrieve the CTCurrency type.

Return

AsCurrency() returns a CTCURRENCY type.

See Also

AsString()

CTCurrency.AsFloat

Syntax

Single AsFloat

Parameters

This method has no parameters.

Description

Converts a CTCurrency object to Single.

Return

AsFloat() returns the converted value in Single format.

See Also

AsBigint(), AsLong()

CTCurrency.AsLong

Syntax

long AsLong( )

Parameters

This method has no parameters.

Description

Converts a CTCurrency object to long.

Return

AsLong() returns the converted value in long format.

See Also

AsBigint(), AsFloat()

CTCurrency.AsMoney

Syntax

CTMoney AsMoney( )

Parameters

This method has no parameters.

Description

Convert a CTCurrency object (64-bit) to a CTMoney object (32-bit).

Return

AsMoney() returns the converted value as a CTMoney object.

See Also

AsString()

CTCurrency.AsString

Syntax

String AsString( )

Parameters

This method has no parameters.

Description

Converts a CTCurrency object to a String object.

Return

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

See Also

AsCurrency()

CTCurrency.IsZero

Syntax

bool IsZero( )

Parameters

This method has no parameters.

Description

IsZero() indicates if a currency value is zero.

Return

IsZero() returns true if the currency value is zero, false otherwise.

See Also

Zero()

CTCurrency.Round

Syntax

CTCurrency Round (int scale)

Parameters

  • scale [in] the number of decimal places.

Description

Rounds a CTCurrency to a specified number of decimal places.

Return

Round returns the rounded CTCurrency.

See Also

AsString(), SetCurrency()

CTCurrency.SetCurrency

Syntax

void SetCurrency(int value)

void SetCurrency(double value)

void SetCurrency( CTMoney value)

void SetCurrency( String value)

void SetCurrency( CTBigint value)

Parameters

  • value [in] The long, double, CTMoney, String, or CTBigint value or object to be converted and assigned to the CTCurrency object

Description

Initializes the CTCurrency object.

Return

None.

See Also

Zero()

CTCurrency.Zero

Syntax

void Zero ( )

Parameters

This method has no parameters.

Description

Zero sets a CTCurrency object value to zero.

Return

None.

See Also

IsZero()