Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

  1. #ifndef _CSE_CONTAINERS_H_
  2. #define _CSE_CONTAINERS_H_
  3. #include <FlexArry.h>
  4. #include <WString.h>
  5. // container for MSFT_PolicyTemplates which are all alike (have same path)
  6. class LikeTemplateList
  7. {
  8. public:
  9. LikeTemplateList(const WCHAR* path)
  10. : m_path(path)
  11. {
  12. if ((path == NULL) || (wcslen(path) == 0))
  13. throw WBEM_E_INVALID_PARAMETER;
  14. }
  15. ~LikeTemplateList();
  16. // adds to end of list
  17. HRESULT Add(IWbemClassObject* pObj);
  18. // returns variant containing safearray of objects
  19. SAFEARRAY* GetArray();
  20. // returns 0 if pOther is == path
  21. // negative # is pOther is < path
  22. // case insensitive compare
  23. int Compare(WCHAR* pOther)
  24. { return _wcsicmp(pOther, (wchar_t*)m_path); };
  25. private:
  26. WString m_path;
  27. CFlexArray m_objects;
  28. };
  29. // contains list of policy templates,
  30. // sorted by path
  31. class TemplateMap
  32. {
  33. public:
  34. TemplateMap()
  35. {}
  36. ~TemplateMap();
  37. // creates new entry if needed
  38. HRESULT Add(WCHAR* pPath, IWbemClassObject* pObj);
  39. // get each template list in turn
  40. // set cookie to zero to get the first one
  41. SAFEARRAY* GetTemplateList(int& cookie);
  42. private:
  43. // array of template lists
  44. // sorted by path
  45. CFlexArray m_lists;
  46. };
  47. #endif // _CSE_CONTAINERS_H_