• 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_VALUE_IMPL_H
17 #define CPP_ABCKIT_VALUE_IMPL_H
18 
19 #include "./value.h"
20 #include "./type.h"
21 #include "./literal_array.h"
22 
23 namespace abckit {
24 
GetType()25 inline Type Value::GetType() const
26 {
27     auto value = GetApiConfig()->cIapi_->valueGetType(GetView());
28     CheckError(GetApiConfig());
29     return Type(value, GetApiConfig(), GetResource());
30 }
31 
GetU1()32 inline bool Value::GetU1() const
33 {
34     bool ret = GetApiConfig()->cIapi_->valueGetU1(GetView());
35     CheckError(GetApiConfig());
36     return ret;
37 }
38 
GetDouble()39 inline double Value::GetDouble() const
40 {
41     double ret = GetApiConfig()->cIapi_->valueGetDouble(GetView());
42     CheckError(GetApiConfig());
43     return ret;
44 }
45 
GetString()46 inline std::string Value::GetString() const
47 {
48     AbckitString *abcStr = GetApiConfig()->cIapi_->valueGetString(GetView());
49     CheckError(GetApiConfig());
50     std::string str = GetApiConfig()->cIapi_->abckitStringToString(abcStr);
51     CheckError(GetApiConfig());
52     return str;
53 }
54 
GetFile()55 inline const File *Value::GetFile() const
56 {
57     CheckError(GetApiConfig());
58     return GetResource();
59 }
60 
GetLiteralArray()61 inline LiteralArray Value::GetLiteralArray() const
62 {
63     auto ret = GetApiConfig()->cIapi_->arrayValueGetLiteralArray(GetView());
64     CheckError(GetApiConfig());
65     return LiteralArray(ret, GetApiConfig(), GetResource());
66 }
67 
68 }  // namespace abckit
69 
70 #endif
71