mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-23 06:39:54 +00:00
add preferences interface
Signed-off-by: zwtmichael <zhuwentao5@huawei.com>
This commit is contained in:
parent
53fc7f9a1a
commit
ebd86cb1dd
42
distributeddatamgr/preferences/BUILD.gn
Normal file
42
distributeddatamgr/preferences/BUILD.gn
Normal file
@ -0,0 +1,42 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
import("//build/ohos/ndk/ndk.gni")
|
||||
import("//foundation/distributeddatamgr/preferences/preferences.gni")
|
||||
|
||||
ohos_ndk_headers("preferences_ndk_header") {
|
||||
dest_dir = "$ndk_headers_out_dir/database/preferences/"
|
||||
sources = [
|
||||
"./include/udmf.h",
|
||||
"./include/udmf_err_code.h",
|
||||
"./include/udmf_meta.h",
|
||||
"./include/uds.h",
|
||||
"./include/utd.h",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_ndk_library("libpreferences") {
|
||||
output_name = "udmf"
|
||||
output_extension = "so"
|
||||
system_capability = "SystemCapability.DistributedDataManager.Preferences.Core"
|
||||
ndk_description_file = "./libpreferences.ndk.json"
|
||||
min_compact_version = "13"
|
||||
system_capability_headers = [
|
||||
"$ndk_headers_out_dir/database/preferences/udmf_err_code.h",
|
||||
"$ndk_headers_out_dir/database/preferences/udmf_meta.h",
|
||||
"$ndk_headers_out_dir/database/preferences/udmf.h",
|
||||
"$ndk_headers_out_dir/database/preferences/uds.h",
|
||||
"$ndk_headers_out_dir/database/preferences/utd.h",
|
||||
]
|
||||
}
|
555
distributeddatamgr/preferences/include/oh_preferences.h
Normal file
555
distributeddatamgr/preferences/include/oh_preferences.h
Normal file
@ -0,0 +1,555 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup PREFERENCES
|
||||
* @{
|
||||
*
|
||||
* @brief The preference manages data based on relational models.
|
||||
* The Preferences module provides APIs for processing data in the form of key-value (KV) pairs, including querying,
|
||||
* modifying, and persisting KV pairs. The key is of the string type, and the value can be a number, a string,
|
||||
* a Boolean value, or an array of numbers, strings, or Boolean values.
|
||||
*
|
||||
* @since 13
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file oh_preferences.h
|
||||
*
|
||||
* @brief Provides preferences related functions and enumerations.
|
||||
*
|
||||
* @kit ArkData
|
||||
* @syscap SystemCapability.DistributedDataManager.Preferences.Core
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
|
||||
#ifndef OH_PREFERENCES_H
|
||||
#define OH_PREFERENCES_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include "uds.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Describes the unified preferences type.
|
||||
*
|
||||
* @since 13
|
||||
*/
|
||||
typedef struct OH_Preferences OH_Preferences;
|
||||
|
||||
/**
|
||||
* @brief The callback function of data observer event.
|
||||
*
|
||||
* @param context Represents the context of data observer.
|
||||
* @param pairs Indicates the key and value pairs that changed.
|
||||
* @param count The count of changed pair accounts.
|
||||
* @since 13
|
||||
*/
|
||||
typedef void (*PreferencesDataObserver)(void *context, const OH_PreferencesPair *pairs, uint32_t count);
|
||||
|
||||
/**
|
||||
* @brief open the preferences object
|
||||
*
|
||||
* @param option Represents a pointer to an {@link OH_PreferencesOption} instance.
|
||||
* @param errCode Represents a pointer to the status code of the execution. This parameter is the output parameter,
|
||||
* See {@link OH_Preferences_ErrCode}.
|
||||
* @return Returns preferences object pointer that in {@link OH_Preferences} when input parameters valid,
|
||||
* otherwise return nullptr.
|
||||
* @since 13
|
||||
*/
|
||||
OH_Preferences *OH_Preferences_Open(OH_PreferencesOptions *option, int *errCode);
|
||||
|
||||
/**
|
||||
* @brief close the preferences object
|
||||
*
|
||||
* @param option Represents a pointer to an {@link OH_PreferencesOption} instance.
|
||||
* @return Returns the status code of the execution. See {@link OH_Preferences_ErrCode}.
|
||||
* @since 13
|
||||
*/
|
||||
int OH_Preferences_Close(OH_PreferencesOptions *store);
|
||||
|
||||
/**
|
||||
* @brief Gets the value by the in preferences object.
|
||||
*
|
||||
* @param key Indicates the target key of the preferences.
|
||||
* @param value Indicates the value that is get .
|
||||
* @return Returns the status code of the execution.
|
||||
* {@link RDB_OK} - success.
|
||||
* {@link RDB_E_INVALID_ARGS} - The error code for common invalid args.
|
||||
* @see PreferencesStore.
|
||||
* @since 13
|
||||
*/
|
||||
int OH_Preferences_GetInt(PreferencesStore *store, const char *key, int *value);
|
||||
|
||||
/**
|
||||
* @brief Get the value by key from a preference.
|
||||
*
|
||||
* @param store Represents a pointer to an {@link PreferencesStore} instance.
|
||||
* @param key Indicates the key of the preferences.
|
||||
* @param errCode This parameter is the output parameter,
|
||||
* and the execution status of a function is written to this variable.
|
||||
* @return Returns value {@link OH_PreferencesValue} object.
|
||||
* @see PreferencesStore, OH_PreferencesValue
|
||||
* @since 13
|
||||
*/
|
||||
int OH_Preferences_GetBool(PreferencesStore *store, const char *key, bool *value);
|
||||
|
||||
/**
|
||||
* @brief Gets the version of a database.
|
||||
*
|
||||
* @param store Represents a pointer to an {@link PreferencesStore} instance.
|
||||
* @param key Indicates the key of the preferences.
|
||||
* @return Returns the status code of the execution.
|
||||
* {@link RDB_OK} - success.
|
||||
* {@link RDB_E_INVALID_ARGS} - The error code for common invalid args.
|
||||
* @see PreferencesStore.
|
||||
* @since 13
|
||||
*/
|
||||
int OH_Preferences_GetString(PreferencesStore *store, const char *key, char **value);
|
||||
|
||||
/**
|
||||
* @brief Describes the unified data type.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct OH_UdmfData OH_UdmfData;
|
||||
|
||||
/**
|
||||
* @brief Describes the record type in the unified data.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct OH_UdmfRecord OH_UdmfRecord;
|
||||
|
||||
/**
|
||||
* @brief Describes some property parameters of unified data.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct OH_UdmfProperty OH_UdmfProperty;
|
||||
|
||||
/**
|
||||
* @brief Creation a pointer to the instance of the {@link OH_UdmfData}.
|
||||
*
|
||||
* @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfData}
|
||||
* structure is returned. If the operation is failed, nullptr is returned.
|
||||
* @see OH_UdmfData.
|
||||
* @since 12
|
||||
*/
|
||||
OH_UdmfData* OH_UdmfData_Create();
|
||||
|
||||
/**
|
||||
* @brief Destroy a pointer that points to the {@link OH_UdmfData} instance.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
|
||||
* @see OH_UdmfData.
|
||||
* @since 12
|
||||
*/
|
||||
void OH_UdmfData_Destroy(OH_UdmfData* pThis);
|
||||
|
||||
/**
|
||||
* @brief Add one {OH_UdmfRecord} record to the {@link OH_UdmfData} data.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
|
||||
* @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfData Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfData_AddRecord(OH_UdmfData* pThis, OH_UdmfRecord* record);
|
||||
|
||||
/**
|
||||
* @brief Check whether the type exists in the {@link OH_UdmfData} data.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
|
||||
* @param type Represents a string pointer of the type.
|
||||
* @return Returns the status of finding type.
|
||||
* {@code false} is not existed.
|
||||
* {@code true} is existed.
|
||||
* @see OH_UdmfData.
|
||||
* @since 12
|
||||
*/
|
||||
bool OH_UdmfData_HasType(OH_UdmfData* pThis, const char* type);
|
||||
|
||||
/**
|
||||
* @brief Get all types in the {@link OH_UdmfData} data.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
|
||||
* @param count Represents the types count that is a output param.
|
||||
* @return Returns string array that in {@link OH_UdmfData} when input parameters valid,
|
||||
* otherwise return nullptr.
|
||||
* @see OH_UdmfData.
|
||||
* @since 12
|
||||
*/
|
||||
char** OH_UdmfData_GetTypes(OH_UdmfData* pThis, unsigned int* count);
|
||||
|
||||
/**
|
||||
* @brief Get all records in the {@link OH_UdmfData} data.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
|
||||
* @param count Represents the records count that is a output param.
|
||||
* @return Returns {@link OH_UdmfRecord} pointer array when input parameters valid, otherwise return nullptr.
|
||||
* @see OH_UdmfData OH_UdmfRecord.
|
||||
* @since 12
|
||||
*/
|
||||
OH_UdmfRecord** OH_UdmfData_GetRecords(OH_UdmfData* pThis, unsigned int* count);
|
||||
|
||||
/**
|
||||
* @brief Creation a pointer to the instance of the {@link OH_UdmfRecord}, it's relate with UDS data.
|
||||
*
|
||||
* @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfRecord}
|
||||
* structure is returned. If the operation is failed, nullptr is returned.
|
||||
* @see OH_UdmfRecord.
|
||||
* @since 12
|
||||
*/
|
||||
OH_UdmfRecord* OH_UdmfRecord_Create();
|
||||
|
||||
/**
|
||||
* @brief Destroy a pointer that points to an instance of {@link OH_UdmfRecord}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @see OH_UdmfRecord.
|
||||
* @since 12
|
||||
*/
|
||||
void OH_UdmfRecord_Destroy(OH_UdmfRecord* pThis);
|
||||
|
||||
/**
|
||||
* @brief Add one custom data to the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param typeId Represents record type, reference udmf_meta.h.
|
||||
* @param entry Represents custom data.
|
||||
* @param count Represents the size of data param.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfRecord Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* pThis, const char* typeId, unsigned char* entry, unsigned int count);
|
||||
|
||||
/**
|
||||
* @brief Add one {OH_UdsPlainText} data to the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfRecord OH_UdsPlainText Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_AddPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText);
|
||||
|
||||
/**
|
||||
* @brief Add one {OH_UdsHyperlink} data to the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param hyperlink Represents a pointer to an instance of {@link OH_UdsHyperlink}.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfRecord OH_UdsHyperlink Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_AddHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink);
|
||||
|
||||
/**
|
||||
* @brief Add one {OH_UdsHtml} data to the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfRecord OH_UdsHtml Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_AddHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
|
||||
|
||||
/**
|
||||
* @brief Add one {OH_UdsAppItem} data to the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param repThisord Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param appItem Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfRecord OH_UdsAppItem Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_AddAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
|
||||
|
||||
/**
|
||||
* @brief Get all types in the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param count Represents the types count that is a output param.
|
||||
* @return Returns string array that in {@link OH_UdmfRecord} when input parameters valid,
|
||||
* otherwise return nullptr.
|
||||
* @see OH_UdmfRecord.
|
||||
* @since 12
|
||||
*/
|
||||
char** OH_UdmfRecord_GetTypes(OH_UdmfRecord* pThis, unsigned int* count);
|
||||
|
||||
/**
|
||||
* @brief Get one entry data from the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param typeId Represents record type, reference udmf_meta.h.
|
||||
* @param entry Represents a pointer to entry data that is a output param.
|
||||
* @param count Represents the entry data length that is a output param.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* {@link UDMF_ERR} Internal data error.
|
||||
* @see OH_UdmfRecord Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_GetGeneralEntry(OH_UdmfRecord* pThis, const char* typeId,
|
||||
unsigned char** entry, unsigned int* count);
|
||||
|
||||
/**
|
||||
* @brief Get one {OH_UdsPlainText} data from the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* {@link UDMF_ERR} Internal data error.
|
||||
* @see OH_UdmfRecord OH_UdsPlainText Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_GetPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText);
|
||||
|
||||
/**
|
||||
* @brief Get one {OH_UdsHyperlink} data from the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param hyperlink Represents a pointer to an instance of {@link OH_UdsHyperlink}.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* {@link UDMF_ERR} Internal data error.
|
||||
* @see OH_UdmfRecord OH_UdsHyperlink Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_GetHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink);
|
||||
|
||||
/**
|
||||
* @brief Get one {OH_UdsHtml} data from the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* {@link UDMF_ERR} Internal data error.
|
||||
* @see OH_UdmfRecord OH_UdsHtml Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_GetHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
|
||||
|
||||
/**
|
||||
* @brief Get one {OH_UdsAppItem} data from the {@link OH_UdmfRecord} record.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
|
||||
* @param appItem Represents a pointer to an instance of {@link OH_UdsAppItem}.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* {@link UDMF_ERR} Internal data error.
|
||||
* @see OH_UdmfRecord OH_UdsAppItem Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfRecord_GetAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
|
||||
|
||||
/**
|
||||
* @brief Creation a pointer to the instance of the {@link OH_UdmfProperty}
|
||||
* from a {@link OH_UdmfData} data.
|
||||
*
|
||||
* @param unifiedData Represents a pointer to an instance of {@link OH_UdmfData}.
|
||||
* @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfProperty}
|
||||
* structure is returned. If the operation is failed, nullptr is returned.
|
||||
* @see OH_UdmfData OH_UdmfProperty.
|
||||
* @since 12
|
||||
*/
|
||||
OH_UdmfProperty* OH_UdmfProperty_Create(OH_UdmfData* unifiedData);
|
||||
|
||||
/**
|
||||
* @brief Destroy a pointer that points to the {@link OH_UdmfProperty} instance.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @see OH_UdmfProperty.
|
||||
* @since 12
|
||||
*/
|
||||
void OH_UdmfProperty_Destroy(OH_UdmfProperty* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get tag value from the {@link OH_UdmfProperty}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @return Returns a pointer of the tag value string when input parameters valid, otherwise return nullptr.
|
||||
* @see OH_UdmfProperty.
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdmfProperty_GetTag(OH_UdmfProperty* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get timestamp value from the {@link OH_UdmfProperty}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @return Returns timestamp value.
|
||||
* @see OH_UdmfProperty
|
||||
* @since 12
|
||||
*/
|
||||
int64_t OH_UdmfProperty_GetTimestamp(OH_UdmfProperty* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get share option value from the {@link OH_UdmfProperty}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @return Returns {@link Udmf_ShareOption} value.
|
||||
* @see OH_UdmfProperty Udmf_ShareOption
|
||||
* @since 12
|
||||
*/
|
||||
Udmf_ShareOption OH_UdmfProperty_GetShareOption(OH_UdmfProperty* pThis);
|
||||
|
||||
/**
|
||||
* @brief Get integer value by key from the {@link OH_UdmfProperty}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @param key Represents key-value pair's key
|
||||
* @param defaultValue Represents when get value failure.
|
||||
* @return Returns value associated with the key in successfully, otherwise return defaultValue.
|
||||
* @see OH_UdmfProperty.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfProperty_GetExtrasIntParam(OH_UdmfProperty* pThis,
|
||||
const char* key, int defaultValue);
|
||||
|
||||
/**
|
||||
* @brief Get tag value from the {@link OH_UdmfProperty}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @param key Represents key-value pair's key.
|
||||
* @return Returns a pointer of the key value string when input parameters valid, otherwise return nullptr.
|
||||
* @see OH_UdmfProperty
|
||||
* @since 12
|
||||
*/
|
||||
const char* OH_UdmfProperty_GetExtrasStringParam(OH_UdmfProperty* pThis, const char* key);
|
||||
|
||||
/**
|
||||
* @brief Set tag value to {@link OH_UdmfProperty} .
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @param tag Represents new tag param.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfProperty Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfProperty_SetTag(OH_UdmfProperty* pThis, const char* tag);
|
||||
|
||||
/**
|
||||
* @brief Set Udmf_ShareOption value to {@link OH_UdmfProperty}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @param option Represents new {@link Udmf_ShareOption} param.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfProperty Udmf_ShareOption Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfProperty_SetShareOption(OH_UdmfProperty* pThis, Udmf_ShareOption option);
|
||||
|
||||
/**
|
||||
* @brief Set extras param to {@link OH_UdmfProperty}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @param key Represents extras param's key value.
|
||||
* @param param Represents value of k-v pairs.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfProperty Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfProperty_SetExtrasIntParam(OH_UdmfProperty* pThis, const char* key, int param);
|
||||
|
||||
/**
|
||||
* @brief Set extras param to {@link OH_UdmfProperty}.
|
||||
*
|
||||
* @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
|
||||
* @param key Represents extras param's key value.
|
||||
* @param param Represents value of k-v pairs.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* @see OH_UdmfProperty Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_UdmfProperty_SetExtrasStringParam(OH_UdmfProperty* pThis,
|
||||
const char* key, const char* param);
|
||||
|
||||
/**
|
||||
* @brief Get {@link OH_UdmfData} data from udmf database.
|
||||
*
|
||||
* @param key Represents database store's key value.
|
||||
* @param intention Represents data type {@link Udmf_Intention}
|
||||
* @param unifiedData Represents output params of {@link OH_UdmfData};
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* {@link UDMF_ERR} Internal data error.
|
||||
* @see OH_UdmfProperty Udmf_Intention Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_Udmf_GetUnifiedData(const char* key, Udmf_Intention intention, OH_UdmfData* unifiedData);
|
||||
|
||||
/**
|
||||
* @brief Set {@link OH_UdmfData} data to database.
|
||||
*
|
||||
* @param intention Represents data type {@link Udmf_Intention}.
|
||||
* @param unifiedData Represents a pointer to an instance of {@link OH_UdmfData}.
|
||||
* @param key Represents return value after set data to database successfully,
|
||||
* it's memory size not less than {@link UDMF_KEY_BUFFER_LEN}.
|
||||
* @param keyLen Represents size of key param.
|
||||
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
|
||||
* {@link UDMF_E_OK} success.
|
||||
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
|
||||
* {@link UDMF_ERR} Internal data error.
|
||||
* @see OH_UdmfProperty Udmf_Intention Udmf_ErrCode.
|
||||
* @since 12
|
||||
*/
|
||||
int OH_Udmf_SetUnifiedData(Udmf_Intention intention, OH_UdmfData* unifiedData,
|
||||
char* key, unsigned int keyLen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif // OH_PREFERENCES_H
|
338
distributeddatamgr/preferences/libpreferences.ndk.json
Normal file
338
distributeddatamgr/preferences/libpreferences.ndk.json
Normal file
@ -0,0 +1,338 @@
|
||||
[
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_Create"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_Destroy"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_GetTypeId"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_GetDescription"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_GetReferenceUrl"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_GetIconFile"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_GetBelongingToTypes"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_GetFilenameExtensions"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_GetMimeTypes"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_GetTypesByFilenameExtension"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_GetTypesByMimeType"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_BelongsTo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_IsLower"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_IsHigher"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_Equals"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Utd_DestroyStringList"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsPlainText_Create"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsPlainText_Destroy"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsPlainText_GetType"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsPlainText_GetContent"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsPlainText_GetAbstract"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsPlainText_SetContent"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsPlainText_SetAbstract"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHyperlink_Create"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHyperlink_Destroy"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHyperlink_GetType"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHyperlink_GetUrl"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHyperlink_GetDescription"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHyperlink_SetUrl"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHyperlink_SetDescription"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHtml_Create"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHtml_Destroy"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHtml_GetType"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHtml_GetContent"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHtml_GetPlainContent"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHtml_SetContent"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsHtml_SetPlainContent"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_Create"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_Destroy"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_GetType"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_GetId"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_GetName"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_GetIconId"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_GetLabelId"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_GetBundleName"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_GetAbilityName"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_SetId"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_SetName"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_SetIconId"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_SetLabelId"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_SetBundleName"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdsAppItem_SetAbilityName"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfData_Create"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfData_Destroy"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfData_AddRecord"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfData_HasType"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfData_GetTypes"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfData_GetRecords"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_Create"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_Destroy"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_AddGeneralEntry"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_AddPlainText"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_AddHyperlink"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_AddHtml"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_AddAppItem"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_GetTypes"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_GetGeneralEntry"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_GetPlainText"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_GetHyperlink"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_GetHtml"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfRecord_GetAppItem"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_Create"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_Destroy"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_GetTag"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_GetTimestamp"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_GetShareOption"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_GetExtrasIntParam"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_GetExtrasStringParam"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_SetTag"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_SetShareOption"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_SetExtrasIntParam"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_UdmfProperty_SetExtrasStringParam"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Udmf_GetUnifiedData"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Udmf_SetUnifiedData"
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user