AnyConnect Secure Mobility Client  5.1.2.42
PreferenceInfoBase.h
1 /**************************************************************************
2 * Copyright (c) 2008, 2022 Cisco Systems, Inc.
3 * All Rights Reserved. Cisco Highly Confidential.
4 ***************************************************************************
5 *
6 * File: PreferenceInfoBase.h
7 * Date: 07/2008
8 *
9 ***************************************************************************
10 * Preference Info Base class declaration for the Client API.
11 ***************************************************************************/
12 
13 // The PreferenceInfoBase class contains the majority of private methods and
14 // members. The purpose of this class is to hide all but the necessary methods
15 // from being exposed.
16 //
17 
18 #ifndef _PREFERENCEINFOBASE_
19 #define _PREFERENCEINFOBASE_
20 
21 #include "api.h"
22 #include <vector>
23 #include <list>
24 #include <map>
25 
26 class Preference;
27 class PreferenceInfo;
28 
29 typedef std::vector<Preference*> PreferenceVector;
30 typedef std::map<PreferenceId, unsigned int> PrefIdToPrefPositionMap;
31 typedef std::map<PreferenceId, Preference*> PrefIdToPrefPtrMap;
32 
33 typedef std::pair<Preference *, unsigned int> PrefWithDepth;
34 typedef std::list<PrefWithDepth> PrefWithDepthList;
35 
36 
37 class VPN_VPNAPI PreferenceInfoBase
38 {
39 protected:
40 
42 
43 public:
44 
45  PreferenceScope getPreferencesType() const;
46  void setPreferencesType(const PreferenceScope scope);
47 
48  unsigned int countPreferences() const;
49 
50  static PreferenceInfo* createDefaultPreferenceInfo();
51 
52  const PreferenceVector& getListPreferences() const;
53 
54  PreferenceVector getAllPreferences() const;
55 
56  void getAllPreferencesSorted(OUT PrefWithDepthList &outSortedPrefs) const;
57 
58  bool getPreference(const PreferenceId preferenceId,
59  OUT Preference*& rpPreference) const;
60 
61  bool addPreference(Preference* pPreference);
62  bool addNewPreference(const tstring& name,
63  const tstring& value,
64  ApiStringMap& attributes,
65  const tstring& parent = EmptyString);
66  bool movePreference(Preference* pPreference, unsigned int& position);
67 
68  bool removeAndDeletePreference(const PreferenceId& preferenceId, bool bDontRemoveFromParent = false);
69  void removeAllPreferences();
70 
71  void setPreferenceHeading(const tstring& preferenceHeading);
72  const tstring getPreferenceHeading() const;
73 
74  PreferenceInfoBase& operator=(const PreferenceInfoBase& existingPrefInfo)
75  {
76  return deepCopy(existingPrefInfo);
77  }
78  explicit PreferenceInfoBase(const PreferenceInfoBase& existingPrefInfo)
79  {
80  deepCopy(existingPrefInfo);
81  }
82  virtual ~PreferenceInfoBase();
83 
84  tstring getString();
85 
86 private:
87  PreferenceInfoBase& deepCopy(const PreferenceInfoBase& existingPrefInfo);
88 
89  PreferenceVector m_ParentPrefPtrVector;
90  PrefIdToPrefPositionMap m_ParentPrefIdToPositionMap;
91  PrefIdToPrefPtrMap m_PrefIdToPrefPtrMap;
92  PreferenceScope m_PreferenceScope;
93  tstring m_preferenceHeading;
94 
95  static tstring EmptyString;
96 
97 };
98 
99 
100 #endif // _PREFERENCEINFOBASE_
PreferenceId
PreferenceId
Definition: api.h:284
tstring
#define tstring
Definition: api.h:35
Preference
Definition: Preference.h:28
PreferenceInfoBase
Definition: PreferenceInfoBase.h:38
PreferenceInfo
Definition: PreferenceInfo.h:27
PreferenceScope
PreferenceScope
Definition: api.h:520
api.h