Define CNNumber class.
More...
#include "CNObject.h"
#include "CNType.h"
#include <stdio.h>
#include <stdint.h>
Go to the source code of this file.
Define CNNumber class.
- Copyright
- Copyright (C) 2013 Steel Wheels Project
Type of the context of the CNNumber.
Enumerator |
---|
CNBooleanNumberType |
Boolean number
|
CNSignedIntegerNumberType |
Signed integer number
|
CNUnsignedIntegerNumberType |
Unsigned integer number
|
CNFloatNumberType |
Floating point number
|
struct CNNumber* CNAllocateBooleanNumber |
( |
CNBoolean |
value, |
|
|
struct CNResource * |
resource |
|
) |
| |
Allocate CNNumber object witl boolean value.
- Return values
-
num | Allocated object |
NULL | Allocation failed |
- Parameters
-
value | Initial value |
resource | Resource to allocate the object |
struct CNNumber* CNAllocateSignedIntegerNumber |
( |
int64_t |
value, |
|
|
struct CNResource * |
resource |
|
) |
| |
Allocate CNNumber object witl signed integer value.
- Return values
-
num | Allocated object |
NULL | Allocation failed |
- Parameters
-
value | Initial value |
resource | Resource to allocate the object |
struct CNNumber* CNAllocateUnsignedIntegerNumber |
( |
uint64_t |
value, |
|
|
struct CNResource * |
resource |
|
) |
| |
Allocate CNNumber object witl unsigned integer value.
- Return values
-
num | Allocated object |
NULL | Allocation failed |
- Parameters
-
value | Initial value |
resource | Resource to allocate the object |
struct CNNumber* CNAllocateFloatNumber |
( |
double |
value, |
|
|
struct CNResource * |
resource |
|
) |
| |
Allocate CNNumber object witl floating value.
- Return values
-
num | Allocated object |
NULL | Allocation failed |
- Parameters
-
value | Initial value |
resource | Resource to allocate the object |
static void CNReleaseNumber |
( |
struct CNNumber * |
dst | ) |
|
|
inlinestatic |
static int64_t CNSignedIntegerNumber |
( |
const struct CNNumber * |
src | ) |
|
|
inlinestatic |
static uint64_t CNUnsignedIntegerNumber |
( |
const struct CNNumber * |
src | ) |
|
|
inlinestatic |
static double CNFloatNumber |
( |
const struct CNNumber * |
src | ) |
|
|
inlinestatic |
Get floating point value in number object.
- Returns
- Context value
- Parameters
-
References CNNumber::floatValue.
struct CNString* CNNumberToString |
( |
struct CNNumber * |
src, |
|
|
struct CNResource * |
resource |
|
) |
| |
Get string which presents the value of source number.
- Returns
- String
- Parameters
-
src | Source number |
resource | Resource to allocate the string |
void CNPrintNumber |
( |
FILE * |
outfp, |
|
|
const struct CNNumber * |
src |
|
) |
| |
Print number to the file.
- Parameters
-
outfp | Output file |
src | Source number object |