# Index at which `self` begins in `_items`, inclusively
redef var first_byte is noinit
- redef var chars = new FlatStringCharView(self) is lazy
+ redef fun chars do return new FlatStringCharView(self)
- redef var bytes = new FlatStringByteView(self) is lazy
+ redef fun bytes do return new FlatStringByteView(self)
redef fun to_cstring do
var blen = _byte_length
super FlatText
super Buffer
- redef var chars: Sequence[Char] = new FlatBufferCharView(self) is lazy
+ redef fun chars do return new FlatBufferCharView(self)
- redef var bytes = new FlatBufferByteView(self) is lazy
-
- private var char_cache: Int = -1
-
- private var byte_cache: Int = -1
+ redef fun bytes do return new FlatBufferByteView(self)
private var capacity = 0
do
assert index >= 0 and index <= _length
if written then reset
- is_dirty = true
if index == _length then
add item
return
redef fun add(c)
do
if written then reset
- is_dirty = true
var clen = c.u8char_len
var bt = _byte_length
enlarge(bt + clen)
end
redef fun clear do
- is_dirty = true
_byte_length = 0
_length = 0
if written then
redef fun append(s)
do
if s.is_empty then return
- is_dirty = true
var sl = s.byte_length
var nln = _byte_length + sl
enlarge(nln)