1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # This file is free software, which comes along with NIT. This software is
4 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
5 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
7 # is kept unaltered, and a notification of the changes is added.
8 # You are allowed to redistribute it and sell it, alone or is a part of
11 # Implementation of Array::to_s with FlatStrings exclusively
13 # To be used as a Mixin at compile-time for benchmarking purposes.
14 module array_to_s_flatstr
16 intrude import standard
::text
::flat
18 redef class FlatString
22 var nns
= new NativeString(mlen
+ slen
)
23 items
.copy_to
(nns
, mlen
, index_from
, 0)
24 if o
isa FlatString then
25 o
.items
.copy_to
(nns
, slen
, o
.index_from
, mlen
)
33 return nns
.to_s_with_length
(mlen
)
42 if l
== 0 then return ""
47 if e
!= null then s
+= e
.to_s