-
Notifications
You must be signed in to change notification settings - Fork 2
mint.type
load mint.type
This module provides functions to manage types.
This enum describes the modifiers of the member.
Constant | Value | Description |
---|---|---|
ConstAddress | 0x02 |
The member has const address. |
ConstValue | 0x01 |
The member has const value. |
Global | 0x20 |
The member is global. |
None | 0x00 |
Empty flag for default created member. |
Package | 0x10 |
The member is public only inside his owner class's package. |
Private | 0x04 |
The member is private. |
Protected | 0x08 |
The member is protected. |
This class provides informations about a member of a class.
Modifiers | Member | Description |
---|---|---|
+ enum
|
Flag | This enum describes the modifiers of the member. |
- final
|
flags | Internal member flags. |
+ const
|
getFlags | Returns the modifiers flags of the member as a mask of values described by Fl... |
+ const
|
getName | Returns the name of the member. |
+ const
|
getOwner | Returns the owner class of the member. |
+ const
|
isConst | Returns true if the member is const (declared using a const modifier); ot... |
+ const
|
isConstAddress | Returns true if the member has const address (declared using a $ modifier... |
+ const
|
isConstValue | Returns true if the member has const value (declared using a % modifier);... |
+ const
|
isGlobal | Returns true if the member is global (declared using a @ modifier); other... |
+ const
|
isPackage | Returns true if the member is public inside his owner class package (declar... |
+ const
|
isPrivate | Returns true if the member is private (declared using a - modifier); othe... |
+ const
|
isProtected | Returns true if the member is protected (declared using a # modifier); ot... |
+ const
|
isPublic | Returns true if the member is public (declared using a + modifier); other... |
- final
|
name | Internal member name. |
+ const
|
new | Creates a new member information with the name given by name and the modifi... |
- final
|
owner | Internal member owner. |
- array
- boolean
- copy
- createGlobalMember
- getMemberInfo
- getMemberOwner
- hash
- isBaseOf
- isBaseOrSame
- isClass
- isCopyable
- isInstanceOf
- isMemberPrivate
- isMemberProtected
- isObject
- new
- number
- private
- protected
- regex
- string
- super
- type
0x02
The member has const address.
0x01
The member has const value.
0x20
The member is global.
0x00
Empty flag for default created member.
0x10
The member is public only inside his owner class's package.
0x04
The member is private.
0x08
The member is protected.
none
Internal member flags.
def (const self)
Returns the modifiers flags of the member as a mask of values described by Flag.
def (const self)
Returns the name of the member.
def (const self)
Returns the owner class of the member.
def (const self)
Returns true
if the member is const (declared using a const
modifier);
otherwise returns false
.
def (const self)
Returns true
if the member has const address (declared using a $
modifier); otherwise returns false
.
def (const self)
Returns true
if the member has const value (declared using a %
modifier);
otherwise returns false
.
def (const self)
Returns true
if the member is global (declared using a @
modifier);
otherwise returns false
.
def (const self)
Returns true
if the member is public inside his owner class package
(declared using a ~
modifier); otherwise returns false
.
def (const self)
Returns true
if the member is private (declared using a -
modifier);
otherwise returns false
.
def (const self)
Returns true
if the member is protected (declared using a #
modifier);
otherwise returns false
.
def (const self)
Returns true
if the member is public (declared using a +
modifier);
otherwise returns false
.
none
Internal member name.
def (self, name, flags = None, owner = none)
Creates a new member information with the name given by name
and the
modifiers described by flags
. The flags
parameter must be a mask of
values givent by Flag. Optionally, the owner class of the member
can be provided using the owner
parameter.
none
Internal member owner.
def (value = [])
Converts value
to array
. If value
is already a array
, it is
returned; otherwise, if it provides a toArray
method, the result of the
method call is returned; otherwise, a built-in cast is performed.
def (value = false)
Converts value
to boolean
. If value
is already a boolean
, it is
returned; otherwise, if it provides a toBoolean
method, the result of the
method call is returned; otherwise, a built-in cast is performed.
def (value)
Copy the value of value
. If value
provides a clone
method, the result
of the method call is returned; otherwise a built-in copy operation is
performed.
def (type, memberName, value = none)
Creates a new global member named memberName
for the type given by type
if no
global member with the same name already exists.
If value
is given, the member is initialized with the given value; otherwise
the member is initialized to none
.
Returns type
if the members was successfully created; otherwise returns
none
.
def (type, memberName)
Returns the informations about the memberName
member of the type
class
as an instance of MemberInfo. If the type
parameter is not a class, an
object or has no member memberName
, none
is returned.
def (type, memberName)
Returns the owner class of the member named memberName
in the class type
.
If no owner class can be found, none
is returned.
def (value = {})
Converts value
to hash
. If value
is already a hash
, it is
returned; otherwise, if it provides a toHash
method, the result of the
method call is returned; otherwise, a built-in cast is performed.
def (base, type)
Returns true
if base
is a base class of type
; otherwise returns false
.
def (base, type)
Returns true
if base
is a base class of type
or the same class; otherwise
returns false
.
def (object)
Returns true
if object
is a non instanciated class; otherwise returns false
.
def (type)
Returns true
if the built-in copy operation can be applied to type
; otherwise
returns false
. The type
parameter can either be a class or an object.
def (object, type)
Returns true
if object
use the class of type
; otherwise returns false
.
def (type, memberName)
Returns true
if the member named memberName
is private in the class
type
; otherwise returns false
.
If no member can be found, none
is returned.
def (type, memberName)
Returns true
if the member named memberName
is protected in the class
type
; otherwise returns false
.
If no member can be found, none
is returned.
def (object)
Returns true
if object
is an instanciated object; otherwise returns false
.
def (type, ...)
Creates a new instance of type
. The type
parameter can either be a cast
function of this module, a class or a type name. Extra arguments are passed
to the cast function or constructor called.
Example:
other = new(typeof value)
Note
If type
is an object, the type of type
is used instead.
def (value = 0)
Converts value
to number
. If value
is already a number
, it is
returned; otherwise, if it provides a toNumber
method, the result of the
method call is returned; otherwise, a built-in cast is performed.
def (member)
Returns the value of member
has a private member.
def (member)
Returns the value of member
has a private member.
def (value = /.*/)
Converts value
to regex
. If value
is already a regex
, it is
returned; otherwise, if it provides a toRegex
method, the result of the
method call is returned; otherwise, a built-in cast is performed.
def (value = '')
Converts value
to string
. If value
is already a string
, it is
returned; otherwise, if it provides a toString
method, the result of the
method call is returned; otherwise, a built-in cast is performed.
def (type)
Returns an array containing the base classes of type
.
array
Fallback to array function when calling toArray
on an object without
the method.
boolean
Fallback to boolean function when calling toBoolean
on an object without
the method.
hash
Fallback to hash function when calling toHash
on an object without
the method.
number
Fallback to number function when calling toNumber
on an object without
the method.
regex
Fallback to regex function when calling toRegex
on an object without
the method.
string
Fallback to string function when calling toString
on an object without
the method.
def (object)
Returns the class of the object
parameter or none
if the object is not a
class instance.
def (type, members)
Creates a new local class named type
with the members described by members
.
The members
parameter must be an hash containing the members names mapped to
the default value. The key can also be an instance of MemberInfo to add
modifiers to the created member.
The created type is returned by the function. The returned value is the only way to access the described type. The type name is not registered as a class name and no standard instanciation is applicable.
By default, each created member is public and local. Members visibility can be
changed using the private
and protected
function. Global members can be
created using the createGlobalMember
function.
def (type, bases, members)
Creates a new local class named type
with the members described by members
.
The members
parameter must be an hash containing the members names mapped to
the default value. The key can also be an instance of MemberInfo to add
modifiers to the created member.
The bases
parameter must be an array containing the base classes or base
classes name for the created type.
The created type is returned by the function. The returned value is the only way to access the described type. The type name is not registered as a class name and no standard instanciation is applicable.
By default, each created member is public and local. Members visibility can be
changed using the private
and protected
function. Global members can be
created using the createGlobalMember
function.
Language reference
- Introduction
- Variables
- Built-in types
- Arithmetic operations
- Type casting
- Control structures
- Function definition
- User defined types
- Work with modules
Library reference