Preference Class Reference

`#include <Preference.h>`

## 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)
Public Member Functions inherited from PreferenceBase
const PreferenceId & | getPreferenceId () const
PreferenceScope | getPreferenceScope () const
const tstring & | getPreferenceValue () const
bool | setPreferenceValue (const tstring &value)
bool | getPreferenceAttribute (const PreferenceAttribute &attribute)
void | setPreferenceAttribute (const PreferenceAttribute &attribute, bool value)
const PreferenceList & | getChildren () const
void | addChildPreference (Preference *pPref)
void | removeChildPreference (Preference *pPref)
PromptEntry * | getPromptEntry () const
PreferenceBase & | operator= (const PreferenceBase &existingPref)
| PreferenceBase (const PreferenceBase &existingPref)

## Additional Inherited Members

Static Public Member Functions inherited from PreferenceBase
static Preference * | createPreferenceFromId (PreferenceId prefId)
static tstring | getPreferenceNameFromId (PreferenceId prefId)
static PreferenceId | getPreferenceIdFromName (const tstring &name)
static PreferenceAttribute | getAttributeIdFromName (const tstring &attributeName)
static tstring | getAttributeNameFromId (const PreferenceAttribute attrId)
static PreferenceId | getParentId (const PreferenceId prefId)
static PreferenceScope | getPreferenceScopeFromId (PreferenceId prefId)
static tstring | getDefaultValue (PreferenceId prefId)
static bool | getDefaultAttribute (PreferenceId prefId, PreferenceAttribute attribute)
static bool | isParentPreference (const PreferenceId prefId)
static bool | isPreferenceDefined (const PreferenceId prefId)
static bool | isValidPreference (const PreferenceId prefId)
Static Public Attributes inherited from PreferenceBase
static const tstring | PreferenceEnabled
static const tstring | PreferenceDisabled
static const tstring | DisconnectOnSuspend
static const tstring | ReconnectAfterResume
static const tstring | AllStores
static const tstring | MachineStore
static const tstring | UserStore
static const tstring | SystemStore
static const tstring | LoginStore
static const tstring | UserFirefoxNSS
static const tstring | UserPEMFile
static const tstring | Automatic
static const tstring | SoftwareToken
static const tstring | HardwareToken
static const tstring | SingleLogon
static const tstring | SingleLocalLogon
static const tstring | SingleLogonNoRemote
static const tstring | LocalUsersOnly
static const tstring | AllowRemoteUsers
static const tstring | ProxyNative
static const tstring | ProxyIgnoreProxy
static const tstring | ProxyOverride
static const tstring | PPPExclusionAutomatic
static const tstring | PPPExclusionDisable
static const tstring | PPPExclusionOverride
static const tstring | Connect
static const tstring | Pause
static const tstring | Disconnect
static const tstring | DoNothing
static const tstring | SameUserOnly
static const tstring | AnyUser
static const tstring | PasswordComplexityAlpha
static const tstring | PasswordComplexityPin
static const tstring | PasswordComplexityStrong
static const tstring | Open
static const tstring | Closed
static const tstring | IPv4
static const tstring | IPv6
static const tstring | IPv4_IPv6
static const tstring | IPv6_IPv4
Protected Member Functions inherited from PreferenceBase
| PreferenceBase (PreferenceId preferenceId, const tstring &label, PromptType prefType, const tstring &initialValue, ApiStringMap *pOptions=NULL, Preference *pParent=NULL)

## 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::Preference | ( | const Preference & | existingPref | ) |

inline explicit

Deep Copy Constructor

:
PreferenceBase(existingPref)
{
}
PreferenceBase
Definition: PreferenceBase.h:38

## Member Function Documentation

## getChildren()

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.

## getPreferenceId()

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.

## getPreferenceValue()

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.

## getPromptEntry()

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

## operator=()

Preference& Preference::operator= | ( | const Preference & | existingPref | ) |

inline

Deep Copy Assignment Operator

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

## setPreferenceValue()

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).