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