| AnyConnect Secure Mobility Client 5.1.5.65

- Main Page
- Related Pages
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions

# Preference Class Reference

`#include <Preference.h>`

List of all members.

## Public Member Functions
bool | setPreferenceValue (const tstring &value)
const tstring & | getPreferenceValue () const
const PreferenceId & | getPreferenceId () const
const std::list< Preference * > & | getChildren () const
PromptEntry * | getPromptEntry () const
| Preference (PreferenceId preferenceId, const tstring &label, PromptType prefType, const tstring &initialValue, ApiStringMap *pOptions=NULL, Preference *pParent=NULL)
| Preference (const Preference &existingPref)
Preference & | operator= (const Preference &existingPref)

## Detailed Description

The Preference class represents a single preference setting that is read from disk. Some preferences can be controlled by the user, as specified by administrator policy. In these instances, the UI layer will represent the controls/widgets used to modify a preference by rendering an associated PromptEntry object, accessible via the getPromptEntry() method, similar to the mechanism used to obtain user input in a ClientIfc::UserPromptCB call.

## Constructor & Destructor Documentation

Preference::Preference | ( | const Preference & | existingPref | ) | `[inline, explicit]`

Deep Copy Constructor

                :
                PreferenceBase(existingPref)
            {
            }

## Member Function Documentation

const std::list<Preference*>& Preference::getChildren | ( |  | ) | const

Returns a reference to an internal list of child preferences for this class. Callers may modify the value of the Preference objects contained within, but should not alter the list or delete individual objects.

Reimplemented from PreferenceBase.

const PreferenceId& Preference::getPreferenceId | ( |  | ) | const

Returns the ID of this Preference. For a complete list of preference ID's see the PreferenceId enum in api.h.

Reimplemented from PreferenceBase.

const tstring& Preference::getPreferenceValue | ( |  | ) | const

Returns the current value of this preference as returned by PromptEntry::getTrueValue(). The values "true" and "false" are returned for preferences represented by a checkbox.

Reimplemented from PreferenceBase.

PromptEntry* Preference::getPromptEntry | ( |  | ) | const

Returns a pointer to an internal PromptEntry used to modify the value of this Preference. By checking the type of the PromptEntry, an appropriate UI layer control/widget should be created that can be used to update the value of the preference. The caller should not delete the returned pointer.

From the PromptType enum in api.h, Prompt_Combo and Prompt_Checkbox are used by this class.

See also:
  PromptEntry

Reimplemented from PreferenceBase.

Preference& Preference::operator= | ( | const Preference & | existingPref | ) | `[inline]`

Deep Copy Assignment Operator

            {
                if (std::addressof(existingPref) != this)
                {
                    PreferenceBase::operator=(existingPref);
                }
                return *this;
            }

bool Preference::setPreferenceValue | ( | const tstring & | value | ) |

Sets the value associated with this preference. Returns true on success, false if the value is not in the range of allowed values for this preference (e.g. setting a value of "fish" for a true/false preference).

Reimplemented from PreferenceBase.