blib/lib/SPVM/Document/NativeAPI/ClassFile.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::ClassFile - Class File Native APIs
4  
5 =head1 Description
6  
7 The class file native APIs of L<SPVM> are the APIs to get and set class file information.
8  
9 =head1 Usage
10
11 SPVM_API_CLASS_FILE* api_class_file = env->api->class_file;
12
13 SPVM_NATIVE_COMPILER* compiler = env->api->compiler->new_instance();
14
15 SPVM_NATIVE_CLASS_FILE* class_file = env->api->compiler->get_class_file(compiler, "MyClass");
16
17 const char* class_name = api_class_file->get_class_name(compiler, class_file);
18  
19 =head1 Native APIs
20  
21 =head2 get_class_name
22  
23 C<const char* (*get_class_name)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>);>
24  
25 Returns the class name of the class file I<class_file>.
26  
27 =head2 get_file
28  
29 C<const char* (*get_file)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>);>
30  
31 Returns the file path for display. This is a field of the class file I<class_file>.
32  
33 =head2 set_file
34  
35 C<void (*set_file)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>, const char* file);>
36  
37 Copies I<file> and sets it to the file path for display. This is a field of the class file I<class_file>.
38  
39 =head2 get_dir
40  
41 C<const char* (*get_dir)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>);>
42  
43 Returns the directory where the class is loaded. This is a field of the class file I<class_file>.
44  
45 =head2 set_dir
46  
47 C<void (*set_dir)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>, const char* dir);>
48  
49 Copies the directory path I<dir>, and sets it to the directory where the class is loaded. This is a field of the class file I<class_file>.
50  
51 =head2 get_rel_file
52  
53 C<const char* (*get_rel_file)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>);>
54  
55 Returns the relative file path of the class file I<class_file>.
56  
57 =head2 set_rel_file
58  
59 C<void (*set_rel_file)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>, const char* rel_file);>
60  
61 Copies I<rel_file> and sets it to the relative file path of the class file I<class_file>.
62  
63 =head2 get_content
64  
65 C<const char* (*get_content)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>);>
66  
67 Returns the content of the class file I<class_file>.
68  
69 =head2 set_content
70  
71 C<void (*set_content)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>, const char* content);>
72  
73 Copies the content I<content> and sets it to the content of the class file I<class_file>.
74  
75 =head2 get_content_length
76  
77 C<int32_t (*get_content_length)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>);>
78  
79 Returns the length of the content of the class file I<class_file>.
80  
81 =head2 set_content_length
82  
83 C<void (*set_content_length)(L<SPVM_NATIVE_COMPILER* compiler|SPVM::Document::NativeAPI::Compiler>, L<SPVM_NATIVE_CLASS_FILE* class_file|SPVM::Document::NativeAPI::ClassFile>, int32_t content_length);>
84  
85 Sets I<content_length> to the length of the content of the class file I<class_file>.
86  
87 =head1 Native API IDs
88  
89 0 get_class_name
90 1 get_file
91 2 set_file
92 3 get_dir
93 4 set_dir
94 5 get_rel_file
95 6 set_rel_file
96 7 get_content
97 8 set_content
98 9 get_content_length
99 10 set_content_length
100  
101 =head1 See Also
102  
103 =over 2
104  
105 =item * L<SPVM::Document::NativeAPI>
106  
107 =item * L<SPVM::Document::NativeAPI::Compiler>
108  
109 =item * L<SPVM::Document::NativeClass>
110  
111 =item * L<SPVM::Document>
112  
113 =back
114  
115 =head1 Copyright & License
116  
117 Copyright (c) 2023 Yuki Kimoto
118  
119 MIT License