core :: NativeArray
Access are unchecked and it has a fixed size Not for public use: may become private.
core :: NativeArray :: copy_to
Copylength
items to dest
.
core :: NativeArray :: memmove
Copylength
items to dest
starting from dest
.
core :: NativeArray :: native_to_s
Join all the elements usingto_s
core :: NativeArray :: new
Creates a new NativeArray of capacitylength
core $ NativeArray :: SELF
Type of this instance, automatically specialized in every classcore :: flat $ NativeArray :: native_to_s
Join all the elements usingto_s
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: NativeArray :: copy_to
Copylength
items to dest
.
core :: Object :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: NativeArray :: memmove
Copylength
items to dest
starting from dest
.
core :: NativeArray :: native_to_s
Join all the elements usingto_s
core :: NativeArray :: new
Creates a new NativeArray of capacitylength
core :: Object :: output_class_name
Display class name on stdout (debug only).
# Native Nit array
# Access are unchecked and it has a fixed size
# Not for public use: may become private.
universal NativeArray[E]
# Creates a new NativeArray of capacity `length`
new(length: Int) is intern
# The length of the array
fun length: Int is intern
# Use `self` to initialize a standard Nit Array.
fun to_a: Array[E] do return new Array[E].with_native(self, length)
# Get item at `index`.
fun [](index: Int): E is intern
# Set `item` at `index`.
fun []=(index: Int, item: E) is intern
# Copy `length` items to `dest`.
fun copy_to(dest: NativeArray[E], length: Int) is intern
# Copy `length` items to `dest` starting from `dest`.
fun memmove(start: Int, length: Int, dest: NativeArray[E], dest_start: Int) is intern do
if start < dest_start then
var i = length
while i > 0 do
i -= 1
dest[dest_start+i] = self[start+i]
end
else
var i = 0
while i < length do
dest[dest_start+i] = self[start+i]
i += 1
end
end
end
#fun =(o: NativeArray[E]): Bool is intern
#fun !=(o: NativeArray[E]): Bool is intern
end
lib/core/collection/array.nit:977,1--1016,3
redef class NativeArray[E]
# Join all the elements using `to_s`
#
# REQUIRE: `self isa NativeArray[String]`
# REQUIRE: all elements are initialized
fun native_to_s: String is abstract
end
lib/core/text/abstract_text.nit:2562,1--2568,3
redef class NativeArray[E]
redef fun native_to_s do
assert self isa NativeArray[String]
var l = length
var na = self
var i = 0
var sl = 0
var mypos = 0
while i < l do
sl += na[i].byte_length
i += 1
mypos += 1
end
var ns = new CString(sl + 1)
ns[sl] = 0
i = 0
var off = 0
while i < mypos do
var tmp = na[i]
if tmp isa FlatString then
var tpl = tmp._byte_length
tmp._items.copy_to(ns, tpl, tmp._first_byte, off)
off += tpl
else
for j in tmp.substrings do
var s = j.as(FlatString)
var slen = s._byte_length
s._items.copy_to(ns, slen, s._first_byte, off)
off += slen
end
end
i += 1
end
return new FlatString.with_infos(ns, sl, 0)
end
end
lib/core/text/flat.nit:1533,1--1568,3