AnyConnect Secure Mobility Client 4.4.00243

include/PreferenceInfoBase.h

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