# SoftBank Robotics documentation What's new in NAOqi 2.8?

# ALPreferences API

NAOqi Core - Overview | API

Namespace : AL

    #include <alproxies/alpreferencesproxy.h>

ALPreferences allows access to xml preference files. A preference is defined as follows :

- pParams[0]: Name of the preference
- pParams[1]: Description of the preference
- pParams[2]: The value of the preference (can contain other preferences)
- pParams[3]: (optional) The name of the data when inserted into memory

    #include <alproxies/alpreferencesproxy.h>

## Method list

As any module, this module inherits methods from ALModule API. It also has the following specific methods:

class `ALPreferencesProxy`

- `ALPreferencesProxy::readPrefFile` (deprecated)
- `ALPreferencesProxy::saveToMemory` (deprecated)
- `ALPreferencesProxy::writePrefFile` (deprecated)
- `ALPreferencesProxy::removePrefFile` (deprecated)

## Methods

AL::ALValue `ALPreferencesProxy::``readPrefFile`(const std::string& fileName, const bool& autoGenerateMemoryNames)

  Deprecated since version 1.20: use `ALPreferenceManagerProxy::importPrefFile` and `ALPreferenceManagerProxy::getValueList` instead.

  Reads all preferences from an xml files and stores them in an ALValue.

  Parameters: | fileName – Name of the module associated to the preference. autoGenerateMemoryNames – If true a memory name will be generated for each non-array preference.
  Returns: | array representing the whole file.

bool `ALPreferencesProxy::``saveToMemory`(const AL::ALValue& prefs)

  Deprecated since version 1.20: use `ALPreferenceManagerProxy::setValue` instead

  Writes all preferences from ALValue to individual memory keys.

  Parameters: | prefs – array representing the whole file.
  Returns: | True upon success.

void `ALPreferencesProxy::``writePrefFile`(const std::string& fileName, const AL::ALValue& prefs, const bool& ignoreMemoryNames)

  Deprecated since version 1.20: use `ALPreferenceManagerProxy::setValue` instead

  Writes all preferences from ALValue to an xml file.

  Parameters: | fileName – Name of the module associated to the preference. prefs – array representing the whole file. ignoreMemoryNames – If true all memory names will be removed before saving.

void `ALPreferencesProxy::``removePrefFile`(const std::string& fileName)

  Deprecated since version 1.20: use `ALPreferenceManagerProxy::removeValue` instead

  Removes the xml file.

  Parameters: | fileName – Name of the module associated to the preference.

Glossary Site map Index Support Contact Legal Notices