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.

61 lines
1.5 KiB

  1. //
  2. // enumprop.cpp
  3. //
  4. #include "private.h"
  5. #include "ic.h"
  6. #include "enumprop.h"
  7. #include "range.h"
  8. #include "attr.h"
  9. #include "saa.h"
  10. DBG_ID_INSTANCE(CEnumPropertyRanges);
  11. //+---------------------------------------------------------------------------
  12. //
  13. // _Init
  14. //
  15. //----------------------------------------------------------------------------
  16. BOOL CEnumPropertyRanges::_Init(CInputContext *pic, IAnchor *paStart, IAnchor *paEnd, CProperty *pProperty)
  17. {
  18. TfGuidAtom atom;
  19. LONG cSpans;
  20. Assert(_iCur == 0);
  21. Assert(_pic == NULL);
  22. Assert(_prgAnchors == NULL);
  23. cSpans = pProperty->GetPropNum();
  24. if (cSpans == 0)
  25. {
  26. // special case the no spans case since paStart, paEnd may be NULL
  27. _prgAnchors = new CSharedAnchorArray;
  28. }
  29. else
  30. {
  31. // property has one or more spans
  32. if (paStart == NULL)
  33. {
  34. Assert(paEnd == NULL);
  35. // CalcCicPropertyTrackerAnchors won't accept NULL, get that here
  36. // NULL means enum all spans
  37. paStart = pProperty->QuickGetPropList(0)->_paStart;
  38. paEnd = pProperty->QuickGetPropList(cSpans-1)->_paEnd;
  39. }
  40. atom = pProperty->GetPropGuidAtom();
  41. _prgAnchors = CalcCicPropertyTrackerAnchors(pic, paStart, paEnd, 1, &atom);
  42. }
  43. if (_prgAnchors == NULL)
  44. return FALSE; // out of memory
  45. _pic = pic;
  46. _pic->AddRef();
  47. return TRUE;
  48. }