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.

77 lines
2.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: PropDesc.hxx
  7. //
  8. // Contents: Persistent property store metadata
  9. //
  10. // Classes: CPropertyStore
  11. //
  12. // History: 27-Dec-19 KyleP Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. //+-------------------------------------------------------------------------
  17. //
  18. // Class: CPropDesc
  19. //
  20. // Purpose: Description of metadata for a single property
  21. //
  22. // History: 27-Dec-95 KyleP Created
  23. //
  24. //--------------------------------------------------------------------------
  25. class CPropDesc
  26. {
  27. public:
  28. CPropDesc() { _pid = pidInvalid; }
  29. void Init( PROPID pid,
  30. ULONG vt,
  31. DWORD oStart,
  32. DWORD cbMax,
  33. DWORD ordinal,
  34. DWORD rec )
  35. {
  36. _pid = pid;
  37. _vt = vt;
  38. _oStart = oStart;
  39. _cbMax = cbMax;
  40. _ordinal = ordinal;
  41. _mask = 1 << ((ordinal % 16) * 2);
  42. _rec = rec;
  43. }
  44. PROPID Pid() const { return _pid; }
  45. ULONG Type() const { return _vt; }
  46. DWORD Offset() const { return _oStart; }
  47. DWORD Size() const { return _cbMax; }
  48. DWORD Ordinal() const { return _ordinal; }
  49. DWORD Mask() const { return _mask; }
  50. DWORD Record() const { return _rec; }
  51. BOOL IsInUse() const { return (_pid != pidInvalid); }
  52. void Free() { _pid = pidInvalid - 1; }
  53. BOOL IsFree() const { return (_pid == (pidInvalid - 1) || _pid == pidInvalid); }
  54. BOOL IsFixedSize() const { return (_oStart != 0xFFFFFFFF); }
  55. void SetOrdinal( DWORD ordinal ) { _ordinal = ordinal; _mask = 1 << ((ordinal % 16) * 2); }
  56. void SetOffset( DWORD oStart ) { _oStart = oStart; }
  57. void SetRecord( DWORD rec ) { _rec = rec; }
  58. private:
  59. PROPID _pid; // Propid
  60. ULONG _vt; // Data type (fixed types only)
  61. DWORD _oStart; // Offset in fixed area to property (fixed types only)
  62. DWORD _cbMax; // Max size of property (used to compute record size)
  63. DWORD _ordinal; // Position of property in record. Zero based.
  64. DWORD _mask; // 1 << Ordinal. Stored for efficiency
  65. DWORD _rec; // Position of metadata object in metadata stream.
  66. };