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.

75 lines
1.3 KiB

  1. //
  2. // spans.h
  3. //
  4. // CSpanSet
  5. //
  6. #ifndef SPANS_H
  7. #define SPANS_H
  8. #include "private.h"
  9. #include "strary.h"
  10. #include "globals.h"
  11. typedef struct
  12. {
  13. IAnchor *paStart;
  14. IAnchor *paEnd;
  15. DWORD dwFlags;
  16. } SPAN;
  17. class CSpanSet
  18. {
  19. public:
  20. CSpanSet()
  21. {
  22. Dbg_MemSetThisNameIDCounter(TEXT("CSpanSet"), PERF_SPANSET_COUNTER);
  23. }
  24. virtual ~CSpanSet()
  25. {
  26. Clear();
  27. }
  28. void Add(DWORD dwFlags, IAnchor *paStart, IAnchor *paEnd, AnchorOwnership ao);
  29. int GetCount() { return _rgSpans.Count(); }
  30. SPAN *GetSpans() { return _rgSpans.GetPtr(0); }
  31. void Clear()
  32. {
  33. _AnchorsAway();
  34. _rgSpans.Clear();
  35. }
  36. void Reset()
  37. {
  38. _AnchorsAway();
  39. _rgSpans.Reset(4);
  40. }
  41. BOOL Normalize(ITextStoreAnchor *ptsi);
  42. protected:
  43. SPAN *_Find(IAnchor *pa, int *piOut);
  44. BOOL _AllSpansCovered()
  45. {
  46. BOOL fRet = (_rgSpans.Count() == 1 &&
  47. _rgSpans.GetPtr(0)->paStart == NULL);
  48. // paStart == NULL implies paEnd == NULL
  49. Assert(!fRet || _rgSpans.GetPtr(0)->paEnd == NULL);
  50. return fRet;
  51. }
  52. SPAN *_InsertNewSpan(int iIndex);
  53. CStructArray<SPAN> _rgSpans;
  54. private:
  55. void _AnchorsAway();
  56. DBG_ID_DECLARE;
  57. };
  58. #endif // SPANS_H