This project has retired. For details please refer to its Attic page.
Clownfish::Integer – C API Documentation
Apache Lucy™

Clownfish::Integer

parcel Clownfish
class variable CFISH_INTEGER
struct symbol cfish_Integer
class nickname cfish_Int
header file Clownfish/Num.h

Name

Clownfish::Integer – Immutable 64-bit signed integer.

Functions

new
cfish_Integer*
cfish_Int_new(
    int64_t value
);

Return a new Integer.

value

Initial value.

init
cfish_Integer*
cfish_Int_init(
    cfish_Integer *self,
    int64_t value
);

Initialize an Integer.

value

Initial value.

Methods

Get_Value
int64_t
cfish_Int_Get_Value(
    cfish_Integer *self
);

Return the value of the Integer.

To_F64
double
cfish_Int_To_F64(
    cfish_Integer *self
);

Convert the Integer to floating point.

To_String
cfish_String* // incremented
cfish_Int_To_String(
    cfish_Integer *self
);

Return the Integer formatted as String.

Equals
bool
cfish_Int_Equals(
    cfish_Integer *self,
    cfish_Obj *other
);

Indicate whether two numbers are the same.

Returns: true if other is an Integer or Float with the same value as self.

Compare_To
int32_t
cfish_Int_Compare_To(
    cfish_Integer *self,
    cfish_Obj *other
);

Indicate whether one number is less than, equal to, or greater than another. Throws an exception if other is neither an Integer nor a Float.

Returns: 0 if the numbers are equal, a negative number if self is less than other, and a positive number if self is greater than other.

Clone
cfish_Integer* // incremented
cfish_Int_Clone(
    cfish_Integer *self
);

Return a clone of the object.

Inheritance

Clownfish::Integer is a Clownfish::Obj.