diff --git a/distributeddatamgr/preferences/include/oh_preferences.h b/distributeddatamgr/preferences/include/oh_preferences.h index 944fa9dffcdcd8024127548ed3994bf5f8de406d..837891ae77c612ee52a3301288e9d36e7aa26f88 100644 --- a/distributeddatamgr/preferences/include/oh_preferences.h +++ b/distributeddatamgr/preferences/include/oh_preferences.h @@ -263,6 +263,18 @@ int OH_Preferences_RegisterDataObserver(OH_Preferences *preference, void *contex int OH_Preferences_UnregisterDataObserver(OH_Preferences *preference, void *context, OH_PreferencesDataObserver observer, const char *keys[], uint32_t keyCount); +/** + * @brief Check if a type is supported or not. + * + * @param type the storage type of {@Link Preferences_StorageType}. + * @param isSupported Pointer to the Boolean value obtained. + * @return Returns the status code of the execution. + * {@link PREFERENCES_OK} indicates the operation is successful. + * {@link PREFERENCES_ERROR_INVALID_PARAM} indicates invalid args are passed in. + * @since 16 + */ +int OH_Preferences_IsStorageTypeSupported(Preferences_StorageType type, bool *isSupported); + #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/preferences/include/oh_preferences_option.h b/distributeddatamgr/preferences/include/oh_preferences_option.h index a8a25af9f55287456e3595803981a3c727390acf..82a6d7a310d0da483c974dd363d5ac04b4a70329 100644 --- a/distributeddatamgr/preferences/include/oh_preferences_option.h +++ b/distributeddatamgr/preferences/include/oh_preferences_option.h @@ -52,6 +52,18 @@ extern "C" { */ typedef struct OH_PreferencesOption OH_PreferencesOption; +/** + * @brief Enumerates the preferences storage types. + * + * @since 16 + */ +typedef enum Preferences_StorageType { + /** XML storage*/ + PREFERENCES_STORAGE_XML = 0, + /** CLKV storage */ + PREFERENCES_STORAGE_CLKV +} Preferences_StorageType; + /** * @brief Creates an {@Link OH_PreferencesOption} instance. * @@ -101,6 +113,19 @@ int OH_PreferencesOption_SetBundleName(OH_PreferencesOption *option, const char */ int OH_PreferencesOption_SetDataGroupId(OH_PreferencesOption *option, const char *dataGroupId); +/** + * @brief Sets the storage type in an {@Link OH_PreferencesOption} instance. + * + * @param option Represents a pointer to an {@link OH_PreferencesOption} instance. + * @param type Represents preferences storage type. + * @return Returns the status code of the execution. + * {@link PREFERENCES_OK} success. + * {@link PREFERENCES_ERROR_INVALID_PARAM} indicates invalid args are passed in. + * @see OH_PreferencesOption. + * @since 16 + */ +int OH_PreferencesOption_SetStorageType(OH_PreferencesOption *option, Preferences_StorageType type); + /** * @brief Destroys an {@Link OH_PreferencesOption} instance. *