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.

102 lines
2.3 KiB

  1. /*
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. */
  4. #ifndef __SDP_LINE_TRANSITION__
  5. #define __SDP_LINE_TRANSITION__
  6. #include "sdpdef.h"
  7. // this value indicates that line transitions have reached an end state
  8. // this value needs to be different from the value of any of the line states
  9. const DWORD LINE_END = 10000;
  10. struct LINE_TRANSITION
  11. {
  12. CHAR m_SeparatorChar;
  13. DWORD m_NewLineState;
  14. };
  15. struct LINE_TRANSITION_INFO
  16. {
  17. DWORD m_LineState;
  18. CHAR *m_SeparatorChars;
  19. BYTE m_NumTransitions;
  20. const LINE_TRANSITION *m_Transitions; // array of state transitions
  21. };
  22. #define LINE_TRANSITION_ENTRY(State, TransitionsArray) \
  23. { \
  24. State, \
  25. NULL, \
  26. (BYTE)((NULL == TransitionsArray)? 0 : sizeof(TransitionsArray)/sizeof(LINE_TRANSITION)), \
  27. TransitionsArray \
  28. }
  29. class SDP_LINE_TRANSITION
  30. {
  31. public:
  32. SDP_LINE_TRANSITION(
  33. IN LINE_TRANSITION_INFO *LineTransitionInfo,
  34. IN DWORD NumStates
  35. );
  36. inline BOOL IsValid() const;
  37. inline DWORD GetNumStates() const;
  38. inline const LINE_TRANSITION_INFO *GetAt(IN DWORD LineState) const;
  39. ~SDP_LINE_TRANSITION();
  40. protected:
  41. BOOL m_IsValid;
  42. LINE_TRANSITION_INFO * const m_LineTransitionInfo;
  43. DWORD m_NumStates;
  44. };
  45. inline BOOL
  46. SDP_LINE_TRANSITION::IsValid(
  47. ) const
  48. {
  49. return m_IsValid;
  50. }
  51. inline DWORD
  52. SDP_LINE_TRANSITION::GetNumStates(
  53. ) const
  54. {
  55. return m_NumStates;
  56. }
  57. inline const LINE_TRANSITION_INFO *
  58. SDP_LINE_TRANSITION::GetAt(
  59. IN DWORD LineState
  60. ) const
  61. {
  62. ASSERT(LineState < m_NumStates);
  63. if ( LineState >= m_NumStates )
  64. {
  65. SetLastError(SDP_INTERNAL_ERROR);
  66. return NULL;
  67. }
  68. return &m_LineTransitionInfo[LineState];
  69. }
  70. #endif // __SDP_LINE_TRANSITION__