harmony 鸿蒙oh_preferences_value.h

  • 2025-06-12
  • 浏览 (5)

oh_preferences_value.h

Overview

Provides APIs, enums, and structs for accessing the PreferencesValue object.

File to include: <database/preferences/oh_preferences_value.h>

Library: libohpreferences.so

System capability: SystemCapability.DistributedDataManager.Preferences.Core

Since: 13

Related module: Preferences

Summary

Types

Name Description
typedef enum Preference_ValueType Preference_ValueType Defines an enum for data types of PreferencesValue.
typedef struct OH_PreferencesPair OH_PreferencesPair Defines a Preferences data record in the key-value (KV) format.
typedef struct OH_PreferencesValue OH_PreferencesValue Defines a PreferencesValue object.

Enums

Name Description
Preference_ValueType {
PREFERENCE_TYPE_NULL = 0, PREFERENCE_TYPE_INT, PREFERENCE_TYPE_BOOL, PREFERENCE_TYPE_STRING,
PREFERENCE_TYPE_BUTT
}
Enumerates the data types of PreferencesValue.

Functions

Name Description
const char * OH_PreferencesPair_GetKey (const OH_PreferencesPair *pairs, uint32_t index) Obtains the key based on the specified index from the KV data.
const OH_PreferencesValue * OH_PreferencesPair_GetPreferencesValue (const OH_PreferencesPair *pairs, uint32_t index) Obtains the value based on the specified index from the KV pairs.
Preference_ValueType OH_PreferencesValue_GetValueType (const OH_PreferencesValue *object) Obtains the data type of a PreferencesValue instance.
int OH_PreferencesValue_GetInt (const OH_PreferencesValue *object, int *value) Obtains an integer value from an OH_PreferencesValue instance.
int OH_PreferencesValue_GetBool (const OH_PreferencesValue *object, bool *value) Obtains a Boolean value from an OH_PreferencesValue instance.
int OH_PreferencesValue_GetString (const OH_PreferencesValue *object, char **value, uint32_t *valueLen) Obtains a string from an OH_PreferencesValue instance.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkData (ArkData Management)

harmony 鸿蒙Data

harmony 鸿蒙OH_Cursor

harmony 鸿蒙OH_Predicates

harmony 鸿蒙OH_Rdb_Config

harmony 鸿蒙OH_Rdb_Store

harmony 鸿蒙OH_VBucket

harmony 鸿蒙OH_VObject

harmony 鸿蒙Preferences

harmony 鸿蒙_r_d_b

0  赞