NAME
Clownfish::CharBuf - Growable buffer holding Unicode characters.
SYNOPSIS
my $buf = Clownfish::CharBuf->new;
$buf->cat('abc');
$buf->cat_char(ord("\n"));
print $buf->to_string;
DESCRIPTION
CONSTRUCTORS
new
my $buf = Clownfish::CharBuf->new( capacity => 256 );
Return a new CharBuf.
capacity - Initial minimum capacity of the CharBuf, in bytes.
METHODS
cat
$char_buf->cat($string);
Concatenate the contents of String string
onto the end of the caller.
string - The String to concatenate.
cat_char
$char_buf->cat_char($code_point);
Concatenate one Unicode character onto the end of the CharBuf.
code_point - The code point of the Unicode character.
grow
$char_buf->grow($capacity);
Assign more memory to the CharBuf, if it doesn’t already have enough room to hold a string of size
bytes. Cannot shrink the allocation.
capacity - The new minimum capacity of the ByteBuf.
clear
$char_buf->clear();
Clear the CharBuf.
get_size
$char_buf->get_size();
Return the size of the CharBuf’s content in bytes.
clone
$char_buf->clone();
Return a clone of the object.
yield_string
$char_buf->yield_string();
Return the content of the CharBuf as String and clear the CharBuf. This is more efficient than to_string().
INHERITANCE
Clownfish::CharBuf isa Clownfish::Obj.