blib/lib/SPVM/Document/NativeAPI/StringBuffer.pm untested

filter: Statementstmt n/a Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a SCAR -
1 =head1 Name
2  
3 SPVM::Document::NativeAPI::StringBuffer - String Buffer Native APIs
4  
5 =head1 Description
6  
7 The string buffer native APIs in L<SPVM> are the APIs for string buffers
8  
9 =head1 Usage
10  
11 SPVM_API_STRING_BUFFER* string_buffer_api = env->api->string_buffer;
12
13 SPVM_API_ALLOCATOR* api_allocator = env->api->allocator;
14
15 SPVM_NATIVE_ALLOCATOR* allocator = api_allocator->new_instance();
16
17 int32_t capacity = 100;
18
19 SPVM_NATIVE_STRING_BUFFER* string_buffer = string_buffer_api->new_instance(allocator, capacity);
20
21 string_buffer_api->free_instance(string_buffer);
22
23 api_allocator->free_instance(allocator);
24  
25 =head1 Native APIs
26  
27 =head2 new_instance
28  
29 C<SPVM_NATIVE_STRING_BUFFER* (*new_instance)(L<SPVM_NATIVE_ALLOCATOR* allocator|SPVM::Document::NativeAPI::Allocator>, int32_t capacity);>
30  
31 Creates a new L<string buffer|SPVM::Document::NativeAPI::StringBuffer> given its capacity I<capacity>, and returns it.
32  
33 =head2 free_instance
34  
35 C<void (*free_instance)(L<SPVM_NATIVE_STRING_BUFFER* string_buffer|SPVM::Document::NativeAPI::StringBuffer>);>
36  
37 Frees the string buffer I<string_buffer>.
38  
39 =head2 get_string
40  
41 C<const char* (*get_string)(L<SPVM_NATIVE_STRING_BUFFER* string_buffer|SPVM::Document::NativeAPI::StringBuffer>);>
42  
43 Returns the string stored in the string buffer I<string_buffer>.
44  
45 =head2 get_length
46  
47 C<int32_t (*get_length)(L<SPVM_NATIVE_STRING_BUFFER* string_buffer|SPVM::Document::NativeAPI::StringBuffer>);>
48  
49 Returns the length of the string stored in the string buffer I<string_buffer>.
50  
51 =head1 Native API IDs
52  
53 0 new_instance
54 1 free_instance
55 2 get_string
56 3 get_length
57  
58 =head1 See Also
59  
60 =over 2
61  
62 =item * L<SPVM::Document::NativeAPI>
63  
64 =item * L<SPVM::Document::NativeAPI::Allocator>
65  
66 =item * L<SPVM::Document::NativeClass>
67  
68 =item * L<SPVM::Document>
69  
70 =back
71  
72 =head1 Copyright & License
73  
74 Copyright (c) 2023 Yuki Kimoto
75  
76 MIT License