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.

77 lines
2.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1998.
  5. //
  6. // File: strsort.hxx
  7. //
  8. // Contents: Parse a sort string and build a DB sort object.
  9. // Parse a GroupBy string and build a DB nesting node object.
  10. //
  11. // History: 96/Jan/3 DwightKr Created
  12. // 97 Apr 16 Alanw Added grouping function, class
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. class CQueryScanner;
  17. CDbSortNode * GetStringDbSortNode( const WCHAR * pwszSort,
  18. IColumnMapper * pList,
  19. LCID locale );
  20. CDbNestingNode * GetStringDbGroupNode( const WCHAR * pwszGroup,
  21. IColumnMapper * pList );
  22. class CParseGrouping
  23. {
  24. enum ECategoryType {
  25. eInvalidCategory = 0,
  26. eUnique = 1,
  27. eBuckets,
  28. eAlpha,
  29. eTime,
  30. eRange,
  31. eCluster,
  32. };
  33. public:
  34. CParseGrouping( CQueryScanner & scanner,
  35. IColumnMapper *pPropList,
  36. BOOL fKeepFriendlyNames ) :
  37. _Scanner( scanner ),
  38. _xPropList( pPropList ),
  39. _CatType( eUnique ),
  40. _xNode( 0 ),
  41. _cNestings( 0 ),
  42. _fNeedSortNode( FALSE ),
  43. _fKeepFriendlyNames( fKeepFriendlyNames )
  44. {
  45. _xPropList->AddRef();
  46. }
  47. ~CParseGrouping() { }
  48. void Parse();
  49. void AddSortList( XPtr<CDbSortNode> & SortNode );
  50. CDbNestingNode * AcquireNode() { return _xNode.Acquire(); }
  51. private:
  52. CDbNestingNode * ParseGrouping();
  53. ECategoryType ParseGroupingType();
  54. CQueryScanner & _Scanner;
  55. XInterface<IColumnMapper> _xPropList;
  56. XPtr<CDbNestingNode> _xNode;
  57. XPtr<CDbSortNode> _xSortNode;
  58. unsigned _cNestings;
  59. BOOL _fNeedSortNode;
  60. ECategoryType _CatType;
  61. BOOL _fKeepFriendlyNames; // Flag indicating if
  62. // columns names should be retained
  63. };