| 1 | package SPVM::Double; | ||
| 2 | |||
| 3 | 1; | ||
| 4 | |||
| 5 | =head1 Name | ||
| 6 | |||
| 7 | SPVM::Double - A double value as An Object | ||
| 8 | |||
| 9 | =head1 Description | ||
| 10 | |||
| 11 | Double class in L<SPVM> represents a double value as an object. | ||
| 12 | |||
| 13 | =head1 Usage | ||
| 14 | |||
| 15 | my $double_object = Double->new(5.0); | ||
| 16 | my $double_value = $double_object->value; | ||
| 17 | $double_object->set_value(10.0); | ||
| 18 | |||
| 19 | =head1 Details | ||
| 20 | |||
| 21 | This class is automatically loaded. | ||
| 22 | |||
| 23 | =head1 Interfaces | ||
| 24 | |||
| 25 | =over 2 | ||
| 26 | |||
| 27 | =item * L<Stringable|SPVM::Stringable> | ||
| 28 | =item * L<Cloneable|SPVM::Cloneable> | ||
| 29 | |||
| 30 | =back | ||
| 31 | |||
| 32 | =head1 Fields | ||
| 33 | |||
| 34 | =head2 value | ||
| 35 | |||
| 36 | C<has value : rw double;> | ||
| 37 | |||
| 38 | The value. If the L</"is_read_only"> field is 1, a compilation error or a runtime error occurs when setting the value. | ||
| 39 | |||
| 40 | =head2 is_read_only | ||
| 41 | |||
| 42 | C<has is_read_only : ro byte;> | ||
| 43 | |||
| 44 | If this value is 1, the L</"value"> field is read-only. | ||
| 45 | |||
| 46 | =head1 Class Methods | ||
| 47 | |||
| 48 | =head2 new | ||
| 49 | |||
| 50 | C<static method new : L<Double|SPVM::Double> ($value : double);> | ||
| 51 | |||
| 52 | Creates a new L<Double|SPVM::Double> object with a C<double> $value. | ||
| 53 | |||
| 54 | =head1 Instance Methods | ||
| 55 | |||
| 56 | =head2 make_read_only | ||
| 57 | |||
| 58 | C<method make_read_only : void ();> | ||
| 59 | |||
| 60 | Sets L</"is_read_only"> field to 1. | ||
| 61 | |||
| 62 | =head2 clone | ||
| 63 | |||
| 64 | C<method clone : L<Double|SPVM::Double> ();> | ||
| 65 | |||
| 66 | Creates a new L<Double|SPVM::Double> object that clones this object. The value of L</"is_read_only"> field in the new object is 0. | ||
| 67 | |||
| 68 | =head2 to_string | ||
| 69 | |||
| 70 | C<method to_string : string ();> | ||
| 71 | |||
| 72 | Casts the value to string type and returns it. | ||
| 73 | |||
| 74 | =head1 Copyright & License | ||
| 75 | |||
| 76 | Copyright (c) 2023 Yuki Kimoto | ||
| 77 | |||
| 78 | MIT License |