Leaked source code of windows server 2003
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.

92 lines
2.3 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // dsobj.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the class DataStoreObject.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/12/2000 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef DSOBJ_H
  19. #define DSOBJ_H
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif
  23. #include <datastore2.h>
  24. _COM_SMARTPTR_TYPEDEF(IDataStoreObject, __uuidof(IDataStoreObject));
  25. _COM_SMARTPTR_TYPEDEF(IDataStoreContainer, __uuidof(IDataStoreContainer));
  26. _COM_SMARTPTR_TYPEDEF(IDataStoreProperty, __uuidof(IDataStoreProperty));
  27. ///////////////////////////////////////////////////////////////////////////////
  28. //
  29. // CLASS
  30. //
  31. // DataStoreObject
  32. //
  33. // DESCRIPTION
  34. //
  35. // Provides a read-only wrapper around IDataStoreObject and
  36. // IDataStoreContainer.
  37. //
  38. ///////////////////////////////////////////////////////////////////////////////
  39. class DataStoreObject
  40. {
  41. public:
  42. DataStoreObject() throw ();
  43. DataStoreObject(IUnknown* pUnk, PCWSTR path = NULL);
  44. ~DataStoreObject() throw ();
  45. //////////
  46. // Methods for reading mandatory and optional properties.
  47. //////////
  48. void getValue(PCWSTR name, BSTR* value);
  49. void getValue(PCWSTR name, BSTR* value, BSTR defaultValue);
  50. void getValue(PCWSTR name, ULONG* value);
  51. void getValue(PCWSTR name, ULONG* value, ULONG defaultValue);
  52. void getValue(PCWSTR name, bool* value);
  53. void getValue(PCWSTR name, bool* value, bool defaultValue);
  54. //////////
  55. // Methods for iterating through the children.
  56. //////////
  57. LONG numChildren();
  58. bool nextChild(DataStoreObject& obj);
  59. // Returns true if the embedded in IDataStoreObject is NULL.
  60. bool empty() const throw ();
  61. private:
  62. void attach(IDataStoreObject* obj) throw ();
  63. bool getChild(PCWSTR name, DataStoreObject& obj);
  64. bool hasChildren();
  65. bool getValue(
  66. PCWSTR name,
  67. VARTYPE vt,
  68. VARIANT* value,
  69. bool mandatory
  70. );
  71. IDataStoreObjectPtr object;
  72. IDataStoreContainerPtr container;
  73. IEnumVARIANTPtr children;
  74. };
  75. #endif // DSOBJ_H