ClassCategoryProbe Class Reference

#include <registry.h>

Inheritance diagram for ClassCategoryProbe:

WizOpProbe List of all members.

Public Member Functions

 ClassCategoryProbe ()
 This default constructor should be followed by a call to InitializeEnumerator() if you want it to work.
 ClassCategoryProbe (const ClassCategoryProbe &OtherProbe)
 This copy constructor stops any COM objects disappearing between copies.
 ~ClassCategoryProbe ()
 This destructor Releases any COM objects.
BOOL Init ()
 This is the second part of the two part constructor. It can fail. I wanted the names of Template handler/op things from the registry which are under CATID.
BOOL GetNextEntry (ClassRegistryEntry *const pEntry)
 Does the enumeration returning the ClassRegistryEntry of the next class in the category.
BOOL IsLast () const
 Determines when to finish the enumeration.

Protected Member Functions

BOOL GetNextCLSID (CLSID *const pNextCLSID)
 Does the enumeration returning the CLSID of any classes that implement the Category for this probe.
ICatInformation * CreateCatInformer ()
 Support function to get us an instance of ICatInformation. Don't forget to Release it.
virtual const CATIDGetCategoryID () const =0

Private Attributes

IEnumCLSID * m_pEnumCLSID
CLSID m_NextCLSIDToReturn

Static Private Attributes

static const String_256 s_CLSIDKey

Detailed Description

Definition at line 357 of file registry.h.


Constructor & Destructor Documentation

ClassCategoryProbe::ClassCategoryProbe  ) 
 

This default constructor should be followed by a call to InitializeEnumerator() if you want it to work.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97

Definition at line 1536 of file registry.cpp.

01537 {
01538     m_pEnumCLSID = NULL;
01539 }

ClassCategoryProbe::ClassCategoryProbe const ClassCategoryProbe OtherProbe  ) 
 

This copy constructor stops any COM objects disappearing between copies.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97

Definition at line 1665 of file registry.cpp.

01666 {
01667     m_pEnumCLSID = OtherProbe.m_pEnumCLSID;
01668     if (m_pEnumCLSID != NULL)
01669     {
01670         m_pEnumCLSID->AddRef();
01671     }
01672 }

ClassCategoryProbe::~ClassCategoryProbe  ) 
 

This destructor Releases any COM objects.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97

Definition at line 1685 of file registry.cpp.

01686 {
01687     if (m_pEnumCLSID != NULL)
01688     {
01689         m_pEnumCLSID->Release();
01690         m_pEnumCLSID = NULL;
01691     }
01692 }


Member Function Documentation

ICatInformation * ClassCategoryProbe::CreateCatInformer  )  [protected]
 

Support function to get us an instance of ICatInformation. Don't forget to Release it.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97
Returns:
An ICatInformation interface. NULL if it failed in any way
Notes: It should probably have an argument giving the registry to use

Definition at line 1634 of file registry.cpp.

01635 {
01636     HRESULT Result = S_OK;
01637 
01638     ICatInformation* pCatInformer = NULL;
01639 
01640     Result = CoCreateInstance(  CLSID_StdComponentCategoriesMgr,    //Class identifier (CLSID) of the object
01641                                 NULL,                   //Pointer to whether object is or isn't part of an aggregate 
01642                                 CLSCTX_INPROC_SERVER,   //Context for running executable code
01643                                 IID_ICatInformation,    //Reference to the identifier of the interface
01644                                 (LPVOID*)&pCatInformer  //Indirect pointer to requested interface
01645                             );
01646     if (FAILED(Result))
01647     {
01648         TRACE( _T("ClassCategoryProbe::CreateCatInfoInterface failed with %x\n"), Result);
01649     }
01650 
01651     return pCatInformer;
01652 }

virtual const CATID& ClassCategoryProbe::GetCategoryID  )  const [protected, pure virtual]
 

Implemented in WizOpProbe.

BOOL ClassCategoryProbe::GetNextCLSID CLSID *const   pNextCLSID  )  [protected]
 

Does the enumeration returning the CLSID of any classes that implement the Category for this probe.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97
Returns:
TRUE if all was OK, FALSE otherwise

Definition at line 1738 of file registry.cpp.

01739 {
01740     HRESULT Result = S_OK;
01741 
01742     *pNextCLSID = m_NextCLSIDToReturn;
01743 
01744     if (m_pEnumCLSID != NULL)
01745     {
01746         Result = m_pEnumCLSID->Next(1,                      //Number of elements requested
01747                                     &m_NextCLSIDToReturn,   //Array of the elements
01748                                     NULL                    //Pointer to the number of elements actually supplied
01749                                     );
01750     }
01751     else
01752     {
01753         TRACE( _T("ClassCategoryProbe::operator++(INT32) - NULL m_pEnumCLSID\n"));
01754         Result = E_UNEXPECTED;
01755     }
01756 
01757     if (Result == S_FALSE)
01758     {
01759         // That was the last one so make this the NULL probe
01760         m_pEnumCLSID->Release();
01761         m_pEnumCLSID = NULL;
01762     }
01763 
01764     return SUCCEEDED(Result);
01765 }

BOOL ClassCategoryProbe::GetNextEntry ClassRegistryEntry *const   pEntry  ) 
 

Does the enumeration returning the ClassRegistryEntry of the next class in the category.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97
Parameters:
The next RegistryEntry in the enumeration [OUTPUTS]
Returns:
TRUE if all was OK, FALSE otherwise

Definition at line 1709 of file registry.cpp.

01710 {
01711     BOOL Ok = TRUE;
01712 
01713     CLSID NextCLSID;
01714     Ok = GetNextCLSID(&NextCLSID);
01715 
01716     if (Ok)
01717     {
01718         Ok = pEntry->InitFromCLSID(NextCLSID);
01719     }
01720 
01721     return Ok;
01722 }

BOOL ClassCategoryProbe::Init void   ) 
 

This is the second part of the two part constructor. It can fail. I wanted the names of Template handler/op things from the registry which are under CATID.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97
Parameters:
ComponentCategoryCLSID,: The CLSID of the Component Category for which this [INPUTS] probe will return CLSIDs of classes that implement the interfaces of that category.
Returns:
S_OK if you're lucky E_... if you're not E_OUTOFMEMORY if the creation of ICatInformation failed in any way.
Notes: There should probably be another argument that the registry passes in (for remote registries etc)

Definition at line 1565 of file registry.cpp.

01566 {
01567     // Don't try the enumeration more than once 'cos I haven't checked it will work
01568     ERROR2IF(m_pEnumCLSID != NULL, FALSE, "NULL Args");
01569 
01570     HRESULT Result = S_OK;
01571 
01572     ICatInformation* const pCatInformer = CreateCatInformer();
01573     if (pCatInformer == NULL)
01574     {
01575         Result = E_OUTOFMEMORY;
01576     }
01577 
01578     // Create an enumerator for all the CLSIDs in the given component category
01579     if (SUCCEEDED(Result))
01580     {
01581         CATID Implements = GetCategoryID();
01582 
01583         Result = pCatInformer->EnumClassesOfCategories(
01584                                 1,              //Number of category IDs in the rgcatidImpl array
01585                                 &Implements,    //Array of category identifiers
01586                                 0,              //Number of category IDs in the rgcatidReq array
01587                                 &Implements,    //Array of category identifiers
01588                                 &m_pEnumCLSID   //Location in which to return an IEnumCLSID interface 
01589                                        );
01590     }
01591 
01592     // Get rid of our local ICatInfo
01593     if (pCatInformer != NULL)
01594     {
01595         pCatInformer->Release();
01596     }
01597 
01598     // Get the first CLSID so it's returned by GetNextCLSID and IsLast works properly
01599     if (SUCCEEDED(Result))
01600     {
01601         Result = m_pEnumCLSID->Next(1,                      //Number of elements requested
01602                                     &m_NextCLSIDToReturn,   //Array of the elements
01603                                     NULL                    //Pointer to the number of elements actually supplied
01604                                     );
01605 
01606         if (Result == S_FALSE)
01607         {
01608             // There weren't any CLSIDs so make this the NULL probe
01609             m_pEnumCLSID->Release();
01610             m_pEnumCLSID = NULL;
01611         }
01612     }
01613 
01614     return SUCCEEDED(Result);
01615 }

BOOL ClassCategoryProbe::IsLast  )  const
 

Determines when to finish the enumeration.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97
Returns:
FALSE if there are any class id's to be had, otherwise TRUE

Definition at line 1780 of file registry.cpp.

01781 {
01782     return m_pEnumCLSID == NULL;
01783 }


Member Data Documentation

CLSID ClassCategoryProbe::m_NextCLSIDToReturn [private]
 

Definition at line 378 of file registry.h.

IEnumCLSID* ClassCategoryProbe::m_pEnumCLSID [private]
 

Definition at line 377 of file registry.h.

const String_256 ClassCategoryProbe::s_CLSIDKey [static, private]
 

Definition at line 380 of file registry.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:52:33 2007 for Camelot by  doxygen 1.4.4