NAME

SPVM::Hash - Key-Values Stored Data Structrue

SYNOPSYS

use SPVM::Hash;

# Book Data
my $book = SPVM::Hash->new;

$book->set_int(id => 4);
$book->set(name => "Perl");
$book->set_int(price => 300);

my $id = $book->get_int("id");
my $name = $book->get("name");
my $price = $book->get_int("price");

# Option Data
my $opt = SPVM::Hash->new;
$opt->set_int(limit => 10);
$opt->set(caption => "Perl is Good Plain Old Language");
$opt->set_double(rate => 0.95);

DESCRIPTION

SPVM::Hash is Key-Values Stored Data Structrue.

STATIC METHODS

new

sub new : SPVM::Hash ()

Create a new SPVM::Hash object.

INSTANCE METHODS

count : int ($self : self)

Count keys.

set : void ($self : self, $key : string, $val : object)

Set key value pair.

get : object ($self : self, $key : string)

Get value.

exists : int ($self : self, $key : string)

Check the value existance of a key.

delete : object ($self : self, $key : string)

Delete key and value pair.

keys : string[] ($self : self)

Get keys.

values : object[] ($self : self)

Get values.

copy : SPVM::Hash ($self : self)

Copy hash.

set_byte : void ($self : self, $name : string, $value : byte)

Set key and value pair. byte value is converted to SPVM::Byte object.

set_short : void ($self : self, $name : string, $value : short)

Set key and value pair. short value is converted to SPVM::Short object.

set_int : void ($self : self, $name : string, $value : int)

Set key and value pair. int value is converted to SPVM::Int object.

set_long : void ($self : self, $name : string, $value : long)

Set key and value pair. long value is converted to SPVM::Long object.

set_float : void ($self : self, $name : string, $value : float)

Set key and value pair. float value is converted to SPVM::Float object.

set_double : void ($self : self, $name : string, $value : double)

Set key and value pair. double value is converted to SPVM::Double object.

get_byte : byte ($self : self, $name : string)

Set value with a key. the value is converted to byte type.

get_short : short ($self : self, $name : string)

Set value with a key. the value is converted to short type.

get_int : int ($self : self, $name : string)

Set value with a key. the value is converted to int type.

get_long : long ($self : self, $name : string)

Set value with a key. the value is converted to long type.

get_float : float ($self : self, $name : string)

Set value with a key. the value is converted to float type.

get_double : double ($self : self, $name : string)

Set value with a key. the value is converted to double type.