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.

81 lines
2.7 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: CPropDesc
  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. BOOL fModifiable = TRUE )
  36. {
  37. _pid = pid;
  38. _vt = vt;
  39. _oStart = oStart;
  40. _cbMax = cbMax;
  41. _ordinal = ordinal;
  42. _mask = 1 << ((ordinal % 16) * 2);
  43. _rec = rec;
  44. _fModifiable = fModifiable;
  45. }
  46. PROPID Pid() const { return _pid; }
  47. ULONG Type() const { return _vt; }
  48. DWORD Offset() const { return _oStart; }
  49. DWORD Size() const { return _cbMax; }
  50. DWORD Ordinal() const { return _ordinal; }
  51. DWORD Mask() const { return _mask; }
  52. DWORD Record() const { return _rec; }
  53. BOOL Modifiable() const { return _fModifiable; }
  54. BOOL IsInUse() const { return (_pid != pidInvalid); }
  55. void Free() { _pid = pidInvalid - 1; }
  56. BOOL IsFree() const { return (_pid == (pidInvalid - 1) || _pid == pidInvalid); }
  57. BOOL IsFixedSize() const { return (_oStart != 0xFFFFFFFF); }
  58. void SetOrdinal( DWORD ordinal ) { _ordinal = ordinal; _mask = 1 << ((ordinal % 16) * 2); }
  59. void SetOffset( DWORD oStart ) { _oStart = oStart; }
  60. void SetRecord( DWORD rec ) { _rec = rec; }
  61. private:
  62. PROPID _pid; // Propid
  63. ULONG _vt; // Data type (fixed types only)
  64. DWORD _oStart; // Offset in fixed area to property (fixed types only)
  65. DWORD _cbMax; // Max size of property (used to compute record size)
  66. DWORD _ordinal; // Position of property in record. Zero based.
  67. DWORD _mask; // 1 << Ordinal. Stored for efficiency
  68. DWORD _rec; // Position of metadata object in metadata stream.
  69. BOOL _fModifiable;// Can this property meta info be modified after initial setting?
  70. };