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  * @since 10
38  */
39 
40 #include <cstdint>
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**
46  * @brief Define the OH_VObject structure type.
47  *
48  * @since 10
49  */
50 typedef struct OH_VObject {
51     /**
52      * The id used to uniquely identify the OH_VObject struct.
53      */
54     int64_t id;
55 
56     /**
57      * @brief Convert the int64 input parameter to a value of type {@link OH_VObject}.
58      *
59      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
60      * @param value Represents a pointer to an int64_t input parameter or the array of type int64_t.
61      * @param count If value is a pointer to a single numerical value, count = 1;
62      * if value is a pointer to an array, count is the size of the array.
63      * @return Returns the status code of the execution.
64      * @see OH_VObject.
65      * @since 10
66      */
67     int (*putInt64)(OH_VObject *valueObject, int64_t *value, uint32_t count);
68 
69     /**
70      * @brief Convert the double input parameter to a value of type {@link OH_VObject}.
71      *
72      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
73      * @param value Represents a pointer to an double input parameter or the array of type double.
74      * @param count If value is a pointer to a single numerical value, count = 1;
75      * if value is a pointer to an array, count is the size of the array.
76      * @return Returns the status code of the execution.
77      * @see OH_VObject.
78      * @since 10
79      */
80     int (*putDouble)(OH_VObject *valueObject, double *value, uint32_t count);
81 
82     /**
83      * @brief Convert the char input parameter to a value of type {@link OH_VObject}.
84      *
85      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
86      * @param value Indicates the const char * input parameter.
87      * @return Returns the status code of the execution.
88      * @see OH_VObject.
89      * @since 10
90      */
91     int (*putText)(OH_VObject *valueObject, const char *value);
92 
93     /**
94      * @brief Convert the char * array input parameter to a value of type {@link OH_VObject}.
95      *
96      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
97      * @param value Indicates the const char * array input parameter.
98      * @param count Indicates the size of the value.
99      * @return Returns the status code of the execution.
100      * @see OH_VObject.
101      * @since 10
102      */
103     int (*putTexts)(OH_VObject *valueObject, const char **value, uint32_t count);
104 
105     /**
106      * @brief Destroy the {@link OH_VObject} object and reclaim the memory occupied by the object.
107      *
108      * @param valueObject Represents a pointer to an {@link OH_VObject} instance.
109      * @return Returns the status code of the execution.
110      * @see OH_VObject.
111      * @since 10
112      */
113     int (*destroy)(OH_VObject *valueObject);
114 } OH_VObject;
115 
116 #ifdef __cplusplus
117 };
118 #endif
119 
120 #endif // OH_VALUE_OBJECT_H
121