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.

78 lines
2.1 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. pragma.hxx
  5. Abstract:
  6. An object that maintains flags for each warning/error message.
  7. The flag indicates whether or not the warning should be emitted.
  8. Error messages are always emitted.
  9. Notes:
  10. Author:
  11. NishadM Dec-30-1997 Created.
  12. Notes:
  13. ----------------------------------------------------------------------------*/
  14. #ifndef __PRAGMA_HXX__
  15. #define __PRAGMA_HXX__
  16. #include "errors.hxx"
  17. // calculate the number of unsigned longs
  18. const unsigned long c_nMsgs = ( D_ERR_MAX-D_ERR_START+C_ERR_MAX-C_ERR_START ) /
  19. ( sizeof(unsigned long) * 8 ) + 1;
  20. class CMessageNumberList
  21. {
  22. private:
  23. unsigned long fMessageNumber [c_nMsgs];
  24. protected:
  25. // maps warning number to the apprpriate bit.
  26. unsigned long BitIndex( unsigned long ulMsg );
  27. public:
  28. CMessageNumberList();
  29. ~CMessageNumberList()
  30. {
  31. }
  32. // queries for the warning message flag
  33. unsigned long GetMessageFlag( unsigned long ulMsg )
  34. {
  35. ulMsg = BitIndex( ulMsg );
  36. return ( fMessageNumber[ ulMsg / ( sizeof(unsigned long) * 8 ) ] &
  37. ( 1 << ( ulMsg % ( sizeof(unsigned long) * 8 ) ) ) );
  38. }
  39. // turns on all flags specified by list
  40. void SetMessageFlags( CMessageNumberList& list );
  41. // turns on warning specified by ulMsg
  42. void SetMessageFlag( unsigned long ulMsg )
  43. {
  44. ulMsg = BitIndex( ulMsg );
  45. fMessageNumber[ ulMsg / ( sizeof(unsigned long) * 8 ) ] |=
  46. ( 1 << ( ulMsg % ( sizeof(unsigned long) * 8 ) ) );
  47. }
  48. // turns off all flags specified by list
  49. void ResetMessageFlags( CMessageNumberList& list );
  50. // turns off warning specified by ulMsg
  51. void ResetMessageFlag( unsigned long ulMsg )
  52. {
  53. ulMsg = BitIndex( ulMsg );
  54. fMessageNumber[ ulMsg / ( sizeof(unsigned long) * 8 ) ] &=
  55. ~( 1 << ( ulMsg % ( sizeof(unsigned long) * 8 ) ) );
  56. }
  57. void ResetAll();
  58. void SetAll();
  59. };
  60. #endif __PRAGMA_HXX__