1 /*
2 * Copyright (c) 2023 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 OH_VALUE_OBJECT_H
17 #define OH_VALUE_OBJECT_H
18 
19 /**
20  * @addtogroup RDB
21  * @{
22  *
23  * @brief The relational database (RDB) store manages data based on relational models.
24  * With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases.
25  * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations
26  * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements.
27  *
28  * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
29  * @since 10
30  */
31 
32 /**
33  * @file oh_value_object.h
34  *
35  * @brief Provides numeric type conversion functions.
36  *
37  * @kit ArkData
38  * @since 10
39  */
40 
41 #include <cstdint>
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /**
47  * @brief Define the OH_VObject structure type.
48  *
49  * @since 10
50  */
51 typedef struct OH_VObject {
52     /**
53      * The id used to uniquely identify the OH_VObject struct.
54      */
55     int64_t id;
56 
57     /**
58      * @brief Convert the int64 input parameter to a value of type {@link OH_VObject}.
59      *
60      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
61      * @param value Represents a pointer to an int64_t input parameter or the array of type int64_t.
62      * @param count If value is a pointer to a single numerical value, count = 1;
63      * if value is a pointer to an array, count is the size of the array.
64      * @return Returns the status code of the execution.
65      * @see OH_VObject.
66      * @since 10
67      */
68     int (*putInt64)(OH_VObject *valueObject, int64_t *value, uint32_t count);
69 
70     /**
71      * @brief Convert the double input parameter to a value of type {@link OH_VObject}.
72      *
73      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
74      * @param value Represents a pointer to an double input parameter or the array of type double.
75      * @param count If value is a pointer to a single numerical value, count = 1;
76      * if value is a pointer to an array, count is the size of the array.
77      * @return Returns the status code of the execution.
78      * @see OH_VObject.
79      * @since 10
80      */
81     int (*putDouble)(OH_VObject *valueObject, double *value, uint32_t count);
82 
83     /**
84      * @brief Convert the char input parameter to a value of type {@link OH_VObject}.
85      *
86      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
87      * @param value Indicates the const char * input parameter.
88      * @return Returns the status code of the execution.
89      * @see OH_VObject.
90      * @since 10
91      */
92     int (*putText)(OH_VObject *valueObject, const char *value);
93 
94     /**
95      * @brief Convert the char * array input parameter to a value of type {@link OH_VObject}.
96      *
97      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
98      * @param value Indicates the const char * array input parameter.
99      * @param count Indicates the size of the value.
100      * @return Returns the status code of the execution.
101      * @see OH_VObject.
102      * @since 10
103      */
104     int (*putTexts)(OH_VObject *valueObject, const char **value, uint32_t count);
105 
106     /**
107      * @brief Destroy the {@link OH_VObject} object and reclaim the memory occupied by the object.
108      *
109      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
110      * @return Returns the status code of the execution.
111      * @see OH_VObject.
112      * @since 10
113      */
114     int (*destroy)(OH_VObject *valueObject);
115 } OH_VObject;
116 
117 #ifdef __cplusplus
118 };
119 #endif
120 
121 #endif // OH_VALUE_OBJECT_H
122