AnyConnect Secure Mobility Client  4.10.06090
Preference.h
1 /**************************************************************************
2 * Copyright © 2008, Cisco Systems, All Rights Reserved
3 ***************************************************************************
4 *
5 * File: Preference.h
6 * Date: 7/2008
7 *
8 ***************************************************************************
9 *
10 * Preference class declaration for the Client API.
11 *
12 ***************************************************************************/
13 
14 #ifndef _PREFERENCE_
15 #define _PREFERENCE_
16 
17 /**
18 * The Preference class represents a single preference setting that is read
19 * from disk. Some preferences can be controlled by the user, as specified
20 * by administrator policy. In these instances, the UI layer will represent
21 * the controls/widgets used to modify a preference by rendering an associated
22 * PromptEntry object, accessible via the getPromptEntry() method, similar to
23 * the mechanism used to obtain user input in a ClientIfc::UserPromptCB call.
24 */
25 
26 #include "PreferenceBase.h"
27 
28 class VPN_VPNAPI Preference : public PreferenceBase
29 {
30 
31  public:
32 
33  /**
34  * Sets the value associated with this preference. Returns true on
35  * success, false if the value is not in the range of allowed values
36  * for this preference (e.g. setting a value of "fish" for a true/false
37  * preference).
38  */
39  bool setPreferenceValue(const tstring& value);
40 
41 
42  /**
43  * Returns the current value of this preference as returned by
44  * PromptEntry::getTrueValue(). The values "true" and "false" are
45  * returned for preferences represented by a checkbox.
46  */
47  const tstring& getPreferenceValue() const;
48 
49 
50  /**
51  * Returns the ID of this Preference. For a complete list of preference
52  * ID's see the ::PreferenceId enum in api.h.
53  */
54  const PreferenceId& getPreferenceId() const;
55 
56 
57  /**
58  * Returns a reference to an internal list of child preferences for this
59  * class. Callers may modify the value of the Preference objects contained
60  * within, but should not alter the list or delete individual objects.
61  */
62  const std::list<Preference*>& getChildren() const;
63 
64 
65  /**
66  * Returns a pointer to an internal PromptEntry used to modify the value
67  * of this Preference. By checking the type of the PromptEntry, an
68  * appropriate UI layer control/widget should be created that can be
69  * used to update the value of the preference. The caller should not
70  * delete the returned pointer.
71  *
72  * From the ::PromptType enum in api.h, Prompt_Combo and Prompt_Checkbox
73  * are used by this class.
74  *
75  * @see PromptEntry
76  */
77  PromptEntry* getPromptEntry() const;
78 
79 
80  Preference(PreferenceId preferenceId,
81  const tstring& label,
82  PromptType prefType,
83  const tstring& initialValue,
84  ApiStringMap* pOptions = NULL,
85  Preference* pParent = NULL);
86 
87 };
88 
89 #endif // _PREFERENCE_
#define tstring
Definition: api.h:35
Definition: PreferenceBase.h:35
PreferenceId
Definition: api.h:274
Definition: PromptEntry.h:40
PromptType
Definition: api.h:249
Definition: Preference.h:28