summaryrefslogtreecommitdiff
path: root/Common/ComponentArray.h
diff options
context:
space:
mode:
Diffstat (limited to 'Common/ComponentArray.h')
-rw-r--r--Common/ComponentArray.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/Common/ComponentArray.h b/Common/ComponentArray.h
new file mode 100644
index 0000000..892faae
--- /dev/null
+++ b/Common/ComponentArray.h
@@ -0,0 +1,80 @@
+//////////////////////////////////////////////////////////////////
+//
+// ComponentArray.h: interface for the CComponentArray class.
+//
+// Class that holds all the components for the application
+// Need to call LoadComponents before you can use them
+//
+// Derived from a vector so you can access the components each
+// as it's own CComponentHolder, but takes care of the Loading
+// and Unloading itself.
+//
+// 'Installed Components' are components that haven't been used
+// yet by a user, but have been installed on the system.
+// The Loading code first loops through all the user's components
+// and then sees if it's missing anything that's installed but
+// hasn't been used yet.
+//
+// The reason for a distiction between a Program ID and a Registry
+// Key is to support multiple instances of components in the future
+// if needed. Each component would be inited from it's own Key. The
+// keys could also be used as Stream ID's in a OLE Storage etc...
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(COMPONENTARRAY_H__ADB16FE6_1B31_11D2_B2D4_0020182B97FC__INCLUDED_)
+#define COMPONENTARRAY_H__ADB16FE6_1B31_11D2_B2D4_0020182B97FC__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include "..\Common\ComponentHolder.h"
+
+#include <mystring.h>
+#include <vector>
+using std::vector;
+
+// An Array of CComponentHolder's with inbuilt Loading and Unloading
+
+typedef vector<CComponentHolder*> ArrayComponents;
+typedef vector<string> string_array;
+class CComponentArray
+ : public ArrayComponents
+{
+public:
+ CComponentArray();
+ virtual ~CComponentArray();
+
+public:
+
+ // Load Components from Registry
+ UINT LoadComponents();
+
+ // Remove Components from Memory
+ UINT UnloadComponents();
+
+ // Save Comoponents Data to Registry
+ HRESULT SaveComponentData();
+
+protected:
+
+ /////////////////////////////////////////////////////////
+ // List of All Installed Components
+ // Used to Compare with User's Current Components
+ string_array m_asInstalledComponents;
+
+ // Load List of All Installed Components
+ UINT LoadInstalledComponents();
+
+ // Called when Loading a Component
+ bool CheckOffInstalledComponent(const string& sID);
+ HRESULT AddComponent(const string& sID);
+
+ // Gets the Component ID from a Registry KeyName
+ // eg: 'NightSecurity.ClearInetCache' would come from 'NightSecurity.ClearInetCache 2'
+ string GetIDFromKey(const string& sKeyName);
+
+};
+
+#endif // !defined(COMPONENTARRAY_H__ADB16FE6_1B31_11D2_B2D4_0020182B97FC__INCLUDED_)