1e41f4b71Sopenharmony_ci# oh_preferences_value.h
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Overview
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciProvides APIs, enums, and structs for accessing the **PreferencesValue** object.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci**File to include**: <database/preferences/oh_preferences_value.h>
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci**Library**: libohpreferences.so
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci**Since**: 13
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ciRelated module: [Preferences](_preferences.md)
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci## Summary
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci### Types
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci| Name| Description| 
25e41f4b71Sopenharmony_ci| -------- | -------- |
26e41f4b71Sopenharmony_ci| typedef enum [Preference_ValueType](_preferences.md#preference_valuetype) [Preference_ValueType](_preferences.md#preference_valuetype) | Defines an enum for data types of **PreferencesValue**.| 
27e41f4b71Sopenharmony_ci| typedef struct [OH_PreferencesPair](_preferences.md#oh_preferencespair) [OH_PreferencesPair](_preferences.md#oh_preferencespair) | Defines a Preferences data record in the key-value (KV) format.| 
28e41f4b71Sopenharmony_ci| typedef struct [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) | Defines a **PreferencesValue** object.| 
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci### Enums
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci| Name| Description| 
34e41f4b71Sopenharmony_ci| -------- | -------- |
35e41f4b71Sopenharmony_ci| [Preference_ValueType](_preferences.md#preference_valuetype-1) {<br>PREFERENCE_TYPE_NULL = 0, PREFERENCE_TYPE_INT, PREFERENCE_TYPE_BOOL, PREFERENCE_TYPE_STRING,<br>PREFERENCE_TYPE_BUTT<br>} | Enumerates the data types of **PreferencesValue**.| 
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci### Functions
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci| Name| Description| 
41e41f4b71Sopenharmony_ci| -------- | -------- |
42e41f4b71Sopenharmony_ci| const char \* [OH_PreferencesPair_GetKey](_preferences.md#oh_preferencespair_getkey) (const [OH_PreferencesPair](_preferences.md#oh_preferencespair) \*pairs, uint32_t index) | Obtains the key based on the specified index from the KV data.| 
43e41f4b71Sopenharmony_ci| const [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) \* [OH_PreferencesPair_GetPreferencesValue](_preferences.md#oh_preferencespair_getpreferencesvalue) (const [OH_PreferencesPair](_preferences.md#oh_preferencespair) \*pairs, uint32_t index) | Obtains the value based on the specified index from the KV pairs.| 
44e41f4b71Sopenharmony_ci| [Preference_ValueType](_preferences.md#preference_valuetype) [OH_PreferencesValue_GetValueType](_preferences.md#oh_preferencesvalue_getvaluetype) (const [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) \*object) | Obtains the data type of a **PreferencesValue** instance.| 
45e41f4b71Sopenharmony_ci| int [OH_PreferencesValue_GetInt](_preferences.md#oh_preferencesvalue_getint) (const [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) \*object, int \*value) | Obtains an integer value from an [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) instance.| 
46e41f4b71Sopenharmony_ci| int [OH_PreferencesValue_GetBool](_preferences.md#oh_preferencesvalue_getbool) (const [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) \*object, bool \*value) | Obtains a Boolean value from an [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) instance.| 
47e41f4b71Sopenharmony_ci| int [OH_PreferencesValue_GetString](_preferences.md#oh_preferencesvalue_getstring) (const [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) \*object, char \*\*value, uint32_t \*valueLen) | Obtains a string from an [OH_PreferencesValue](_preferences.md#oh_preferencesvalue) instance.| 
48