• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef CPP_ABCKIT_CORE_IMPORT_DESCRIPTOR_IMPL_H
17 #define CPP_ABCKIT_CORE_IMPORT_DESCRIPTOR_IMPL_H
18 
19 #include "./import_descriptor.h"
20 #include "./function.h"
21 #include "./module.h"
22 namespace abckit::core {
23 
GetFile()24 inline const File *ImportDescriptor::GetFile() const
25 {
26     return GetResource();
27 }
28 
GetName()29 inline std::string ImportDescriptor::GetName() const
30 {
31     AbckitString *abcName = GetApiConfig()->cIapi_->importDescriptorGetName(GetView());
32     CheckError(GetApiConfig());
33     std::string name = GetApiConfig()->cIapi_->abckitStringToString(abcName);
34     CheckError(GetApiConfig());
35     return name;
36 }
37 
GetImportedModule()38 inline Module ImportDescriptor::GetImportedModule() const
39 {
40     AbckitCoreModule *module = GetApiConfig()->cIapi_->importDescriptorGetImportedModule(GetView());
41     CheckError(GetApiConfig());
42     return core::Module(module, conf_, GetResource());
43 }
44 
ImportDescriptor(AbckitCoreImportDescriptor * module,const ApiConfig * conf,const File * file)45 inline ImportDescriptor::ImportDescriptor(AbckitCoreImportDescriptor *module, const ApiConfig *conf, const File *file)
46     : ViewInResource(module), conf_(conf)
47 {
48     SetResource(file);
49 };
50 
GetImportingModule()51 inline Module ImportDescriptor::GetImportingModule() const
52 {
53     AbckitCoreModule *module = GetApiConfig()->cIapi_->importDescriptorGetImportingModule(GetView());
54     CheckError(GetApiConfig());
55     return core::Module(module, conf_, GetResource());
56 }
57 
DescriptorGetAlias()58 inline std::string ImportDescriptor::DescriptorGetAlias() const
59 {
60     AbckitString *abcAlias = GetApiConfig()->cIapi_->importDescriptorGetAlias(GetView());
61     CheckError(GetApiConfig());
62     std::string alias = GetApiConfig()->cIapi_->abckitStringToString(abcAlias);
63     CheckError(GetApiConfig());
64     return alias;
65 }
66 
67 }  // namespace abckit::core
68 
69 #endif  // CPP_ABCKIT_CORE_IMPORT_DESCRIPTOR_IMPL_H
70