![]() |
AnyConnect Secure Mobility Client 5.1.9.113
|
00001 /************************************************************************** 00002 * Copyright (c) 2008, 2022 Cisco Systems, Inc. 00003 * All Rights Reserved. Cisco Highly Confidential. 00004 *************************************************************************** 00005 * 00006 * File: PreferenceInfoBase.h 00007 * Date: 07/2008 00008 * 00009 *************************************************************************** 00010 * Preference Info Base class declaration for the Client API. 00011 ***************************************************************************/ 00012 00013 // The PreferenceInfoBase class contains the majority of private methods and 00014 // members. The purpose of this class is to hide all but the necessary methods 00015 // from being exposed. 00016 // 00017 00018 #ifndef _PREFERENCEINFOBASE_ 00019 #define _PREFERENCEINFOBASE_ 00020 00021 #include "api.h" 00022 #include <vector> 00023 #include <list> 00024 #include <map> 00025 00026 class Preference; 00027 class PreferenceInfo; 00028 00029 typedef std::vector<Preference*> PreferenceVector; 00030 typedef std::map<PreferenceId, unsigned int> PrefIdToPrefPositionMap; 00031 typedef std::map<PreferenceId, Preference*> PrefIdToPrefPtrMap; 00032 00033 typedef std::pair<Preference *, unsigned int> PrefWithDepth; 00034 typedef std::list<PrefWithDepth> PrefWithDepthList; 00035 00036 00037 class VPN_VPNAPI PreferenceInfoBase 00038 { 00039 protected: 00040 00041 PreferenceInfoBase(); 00042 00043 public: 00044 00045 PreferenceScope getPreferencesType() const; 00046 void setPreferencesType(const PreferenceScope scope); 00047 00048 unsigned int countPreferences() const; 00049 00050 static PreferenceInfo* createDefaultPreferenceInfo(); 00051 00052 const PreferenceVector& getListPreferences() const; 00053 00054 PreferenceVector getAllPreferences() const; 00055 00056 void getAllPreferencesSorted(OUT PrefWithDepthList &outSortedPrefs) const; 00057 00058 bool getPreference(const PreferenceId preferenceId, 00059 OUT Preference*& rpPreference) const; 00060 00061 bool addPreference(Preference* pPreference); 00062 bool addNewPreference(const tstring& name, 00063 const tstring& value, 00064 ApiStringMap& attributes, 00065 const tstring& parent = EmptyString); 00066 bool movePreference(Preference* pPreference, unsigned int& position); 00067 00068 bool removeAndDeletePreference(const PreferenceId& preferenceId, bool bDontRemoveFromParent = false); 00069 void removeAllPreferences(); 00070 00071 void setPreferenceHeading(const tstring& preferenceHeading); 00072 const tstring getPreferenceHeading() const; 00073 00074 PreferenceInfoBase& operator=(const PreferenceInfoBase& existingPrefInfo) 00075 { 00076 return deepCopy(existingPrefInfo); 00077 } 00078 explicit PreferenceInfoBase(const PreferenceInfoBase& existingPrefInfo) 00079 { 00080 deepCopy(existingPrefInfo); 00081 } 00082 virtual ~PreferenceInfoBase(); 00083 00084 tstring getString(); 00085 00086 private: 00087 PreferenceInfoBase& deepCopy(const PreferenceInfoBase& existingPrefInfo); 00088 00089 PreferenceVector m_ParentPrefPtrVector; 00090 PrefIdToPrefPositionMap m_ParentPrefIdToPositionMap; 00091 PrefIdToPrefPtrMap m_PrefIdToPrefPtrMap; 00092 PreferenceScope m_PreferenceScope; 00093 tstring m_preferenceHeading; 00094 00095 static tstring EmptyString; 00096 00097 }; 00098 00099 00100 #endif // _PREFERENCEINFOBASE_