Qore Programming Language Reference Manual 2.0.0
|
Methods in this pseudo-class can be executed on integer values. More...
#include <Pseudo_QC_Int.dox.h>
Public Member Methods | |
int | abs () |
Returns the absolute value of the number. | |
binary | encodeLsb (int size=4) |
returns a binary object with the integer encoded in the given number of bytes in least significant byte order | |
binary | encodeMsb (int size=4) |
returns a binary object with the integer encoded in the given number of bytes in most significant byte order | |
string | format (string fmt) |
Returns a formatted string of the integer according to the format argument. | |
string | format (int prec=2, string decimal_sep=".", string thousands_sep="") |
Returns a formatted string of the integer according to format arguments. | |
bool | intp () |
Returns True by default. | |
int | sign () |
Returns -1 if the number is negative, 0 if it is zero, or 1 if it is positive. | |
bool | strp () |
Returns True because integer values can be converted to strings. | |
string | toBase (int base=10) |
Converts the integer to a different base (and returns it as a string). | |
string | toUnicode () |
Returns a single character string in UTF-8 encoding for the integer value treated as a unicode value. | |
int | typeCode () |
Returns Qore::NT_INT. | |
bool | val () |
Returns True if the int is non-zero, False if zero. | |
Public Member Methods inherited from <value> | |
bool | callp () |
Returns False; this method is reimplemented in other types and will return True if the given expression is a callable value (ie closures or call references) | |
bool | complexType () |
returns True if the value has a complex type, False if not | |
bool | empty () |
Returns True; this method will be reimplemented in container types where it may return False. | |
string | fullType (__7_ bool with_namespaces) |
returns the full type name which differs from the simple type name in case of complex types and objects | |
bool | intp () |
Returns False; this method is reimplemented in other types and will return True if the given expression can be converted to an integer. | |
AbstractIterator | iterator () |
Returns an iterator object for the value; the default iterator object returned is SingleValueIterator. | |
int | lsize () |
Returns 1; the return value of this method should give the list size of the value, which is normally 1 for non-lists (except for NOTHING where the size will be 0) and the number of the elements in the list for lists; this method will be reimplemented in other types where it may return other values. | |
int | size () |
Returns zero; this method will be reimplemented in container types where it may return a non-zero value. | |
bool | sizep () |
Returns True if the type can return a non-zero size (True for containers including binary objects and strings, False for everything else) | |
bool | strp () |
Returns False; this method is reimplemented in other types and will return True if the given expression can be converted to a string. | |
bool | toBool () |
Returns the boolean representation of the value; the default is False. | |
float | toFloat () |
Returns the floating-point representation of the value; the default is 0.0. | |
int | toInt () |
Returns the integer representation of the value; the default is 0. | |
number | toNumber () |
Returns the arbitrary-precision numeric representation of the value; the default is 0. | |
string | toString (__7_ string encoding) |
Returns the string representation of the value; the default is an empty string. | |
string | type () |
Returns the string type for the value. | |
int | typeCode () |
Returns the type code for the value. | |
bool | val () |
Returns False; this method is reimplemented in other types and will return True if the given expression has a non-empty value. | |
Methods in this pseudo-class can be executed on integer values.
int <int>::abs | ( | ) |
returns a binary object with the integer encoded in the given number of bytes in least significant byte order
size | the size of the encoded binary object; must be 1, 2, 4, or 8 or a SIZE-ERROR exception is raised |
SIZE-ERROR | the argument is not 1, 2, 4, or 8 or the argument cannot fit in the number of bytes requested |
returns a binary object with the integer encoded in the given number of bytes in most significant byte order
size | the size of the encoded binary object; must be 1, 2, 4, or 8 or a SIZE-ERROR exception is raised |
SIZE-ERROR | the argument is not 1, 2, 4, or 8 or the argument cannot fit in the number of bytes requested |
Returns a formatted string of the integer according to format arguments.
prec | the number of digits after the decimal point; a negative value means to round that number of digits before the decimal place, note that a positive value here will result in the given number of zeros appearing after the decimal place |
decimal_sep | a single character that defines the decimal separator; an empty string means no decimal separator |
thousands_sep | a single character that defines the thousands and further separators every three digits before the decimal point; an empty string means no thousands separator |
Returns a formatted string of the integer according to the format argument.
fmt | the format string has the following format: <thousands_separator> [ <decimal_separator>[<decimals>]] where:
|
? character bool <int>::intp | ( | ) |
int <int>::sign | ( | ) |
Returns -1 if the number is negative, 0 if it is zero, or 1 if it is positive.
bool <int>::strp | ( | ) |
Converts the integer to a different base (and returns it as a string).
base | the base to convert the integer to; this value must be 2 - 36 inclusive or an INVALID-BASE exception will be thrown |
INVALID-BASE | the base is invalid; must be 2 - 36 inclusive |
string <int>::toUnicode | ( | ) |
Returns a single character string in UTF-8 encoding for the integer value treated as a unicode value.
int <int>::typeCode | ( | ) |
Returns Qore::NT_INT.