AnyConnect Secure Mobility Client 4.4.00243

include/PromptEntryBase.h

00001 /**************************************************************************
00002 *       Copyright (c) 2008, Cisco Systems, All Rights Reserved
00003 ***************************************************************************
00004 *
00005 *  File:    PromptEntryBase.h
00006 *  Date:    01/2008
00007 *
00008 ***************************************************************************
00009 *
00010 *   Prompt Entry base class implementation for the Client API.
00011 *
00012 ***************************************************************************/
00013 
00014 #ifndef _PROMPTENTRYBASE_
00015 #define _PROMPTENTRYBASE_
00016 
00017 
00018 #include "api.h"
00019 #include <list>
00020 
00021 
00022 #define PROMPT_ENTRY_VALUE_TRUE  _T("true")
00023 #define PROMPT_ENTRY_VALUE_FALSE  _T("false")
00024 
00025 class VPN_VPNAPI PromptEntryBase
00026 {
00027     public:
00028 
00029         bool setValue(tstring value);
00030 
00031         const tstring &getPromptName() const;
00032 
00033         const tstring &getPromptLabel() const;
00034 
00035         bool isEnabled() const;
00036 
00037         void setEnabled(bool bIsEnabled);
00038 
00039         bool isVisible() const;
00040 
00041         void setVisible(bool bIsVisible);
00042 
00043         // if this is a PromptEntry that has a list of values
00044         // (e.g. combo box style) the default will be to mark it as a group
00045         // combo.  This method allows the group designation to be set directly.
00046         //
00047         void setEntryGroup(bool bIsEntryGroup);
00048 
00049 
00050         PromptEntryBase(tstring PromptName,
00051                         tstring PromptLabel,
00052                         PromptType promptType = Prompt_Input,
00053                         tstring DefaultValue = EmptyString,
00054                         ApiStringMap LabelValues = EmptyLabelValues);
00055 
00056 
00057         void setPromptLabel(tstring label);
00058 
00059         // In cases of prompt types with options (checkbox, combobox),
00060         // this will return the translated label (of the option).
00061         const tstring &getValue() const;
00062 
00063         // this function returns the internal representation of the value
00064         const tstring &getTrueValue() const;
00065 
00066         const std::list<tstring> &getValueOptions() const;
00067 
00068         bool isEntryGroup() const;
00069 
00070         PromptType getPromptType() const;
00071 
00072         size_t GetGroupAttributesCount();
00073 
00074 
00075         ~PromptEntryBase();
00076 
00077         static const tstring EmptyString;
00078 
00079         static const std::list<tstring> EmptyList;
00080 
00081         static const ApiStringMap EmptyLabelValues;
00082 
00083         PromptEntryBase& operator=(const PromptEntryBase& assignmentOperator);
00084 
00085         PromptEntryBase(const PromptEntryBase& existingEntry);
00086 
00087 
00088     private:
00089 
00090         tstring ms_PromptName;
00091 
00092         tstring ms_PromptLabel;
00093 
00094         PromptType me_PromptType;
00095 
00096         tstring ms_Value;
00097 
00098         ApiStringMap msm_LabelValueMap;
00099 
00100         std::list<tstring> mls_ValueOptions;
00101 
00102         bool mb_IsEntryGroup;
00103 
00104         bool mb_Enabled;
00105 
00106         bool mb_Visible;
00107 
00108     public:
00109         
00110         class GroupAttributes
00111         {
00112         public:
00113             GroupAttributes() :
00114               CredRequired(true),
00115               UsesSDIAuth(false),
00116               UsernameEditable(true),
00117               Username(),
00118               SecondaryUsernameEditable(true),
00119               SecondaryUsername(),
00120               UsesSecondaryAuth(false) {}
00121 
00122             bool CredRequired;
00123             bool UsesSDIAuth;
00124             bool UsernameEditable;
00125             tstring Username;
00126             bool SecondaryUsernameEditable;
00127             tstring SecondaryUsername;
00128             bool UsesSecondaryAuth;
00129         };
00130 
00131         class SingleAttributes
00132         {
00133         public:
00134             SingleAttributes() :
00135               SecondaryAuthEntry(false) {}
00136 
00137             bool SecondaryAuthEntry;
00138         };
00139 
00140         typedef std::map<tstring, GroupAttributes> GroupAttributeMap;
00141 
00142         const GroupAttributes& getGroupAttributes(const tstring& group) const;
00143         void setGroupAttributeMap(const GroupAttributeMap& groupAttributeMap);
00144 
00145         const SingleAttributes& getSingleAttributes() const;
00146         void setSingleAttributes(const SingleAttributes& singleAttributes);
00147 
00148     private:
00149 
00150         void copyGroupAttributeMap (const GroupAttributeMap &source,
00151                                     GroupAttributeMap &destination);
00152         static const GroupAttributes DefaultGroupAttributes;
00153         GroupAttributeMap m_GroupAttributeMap;
00154 
00155         SingleAttributes m_SingleAttributes;
00156 };
00157 
00158 
00159 #endif // _PROMPTENTRYBASE_