| AnyConnect Secure Mobility Client 5.0.02075

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

# include/Preference.h

    00001 /**************************************************************************
    00002 *   Copyright (c) 2008, 2022 Cisco Systems, Inc.
    00003 *   All Rights Reserved. Cisco Highly Confidential.
    00004 ***************************************************************************
    00005 *
    00006 *   File:   Preference.h
    00007 *   Date:   07/2008
    00008 *
    00009 ***************************************************************************
    00010 *   Preference class declaration for the Client API.
    00011 ***************************************************************************/
    00012
    00013 #ifndef _PREFERENCE_
    00014 #define _PREFERENCE_
    00015
    00016 /**
    00017 * The Preference class represents a single preference setting that is read
    00018 * from disk.  Some preferences can be controlled by the user, as specified
    00019 * by administrator policy.  In these instances, the UI layer will represent
    00020 * the controls/widgets used to modify a preference by rendering an associated
    00021 * PromptEntry object, accessible via the getPromptEntry() method, similar to
    00022 * the mechanism used to obtain user input in a ClientIfc::UserPromptCB call.
    00023 */
    00024
    00025 #include "PreferenceBase.h"
    00026
    00027 class VPN_VPNAPI Preference : public PreferenceBase
    00028 {
    00029
    00030     public:
    00031
    00032         /**
    00033         * Sets the value associated with this preference.  Returns true on
    00034         * success, false if the value is not in the range of allowed values
    00035         * for this preference (e.g. setting a value of "fish" for a true/false
    00036         * preference).
    00037         */
    00038         bool setPreferenceValue(const tstring& value);
    00039
    00040
    00041         /**
    00042         * Returns the current value of this preference as returned by
    00043         * PromptEntry::getTrueValue(). The values "true" and "false" are
    00044         * returned for preferences represented by a checkbox.
    00045         */
    00046         const tstring& getPreferenceValue() const;
    00047
    00048
    00049         /**
    00050         * Returns the ID of this Preference. For a complete list of preference
    00051         * ID's see the ::PreferenceId enum in api.h.
    00052         */
    00053         const PreferenceId& getPreferenceId() const;
    00054
    00055
    00056         /**
    00057         * Returns a reference to an internal list of child preferences for this
    00058         * class.  Callers may modify the value of the Preference objects contained
    00059         * within, but should not alter the list or delete individual objects.
    00060         */
    00061         const std::list<Preference*>& getChildren() const;
    00062
    00063
    00064         /**
    00065         * Returns a pointer to an internal PromptEntry used to modify the value
    00066         * of this Preference. By checking the type of the PromptEntry, an
    00067         * appropriate UI layer control/widget should be created that can be
    00068         * used to update the value of the preference. The caller should not
    00069         * delete the returned pointer.
    00070         *
    00071         * From the ::PromptType enum in api.h, Prompt_Combo and Prompt_Checkbox
    00072         * are used by this class.
    00073         *
    00074         * @see PromptEntry
    00075         */
    00076         PromptEntry* getPromptEntry() const;
    00077
    00078
    00079         Preference(PreferenceId preferenceId,
    00080                    const tstring& label,
    00081                    PromptType prefType,
    00082                    const tstring& initialValue,
    00083                    ApiStringMap* pOptions = NULL,
    00084                    Preference* pParent = NULL);
    00085
    00086         virtual ~Preference() {};
    00087
    00088         /**
    00089         * Deep Copy Constructor
    00090         */
    00091         explicit Preference(
    00092             const Preference& existingPref)
    00093             :
    00094             PreferenceBase(existingPref)
    00095         {
    00096         }
    00097
    00098         /**
    00099         * Deep Copy Assignment Operator
    00100         */
    00101         Preference& operator=(const Preference& existingPref)
    00102         {
    00103             if (std::addressof(existingPref) != this)
    00104             {
    00105                 PreferenceBase::operator=(existingPref);
    00106             }
    00107             return *this;
    00108         }
    00109
    00110 };
    00111
    00112 #endif // _PREFERENCE_