home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_jade.idb / usr / freeware / include / sp / lib / OutputState.h.z / OutputState.h
Encoding:
C/C++ Source or Header  |  1999-07-21  |  1.7 KB  |  79 lines

  1. // Copyright (c) 1994 James Clark
  2. // See the file COPYING for copying permission.
  3.  
  4. #ifndef OutputState_INCLUDED
  5. #define OutputState_INCLUDED 1
  6. #ifdef __GNUG__
  7. #pragma interface
  8. #endif
  9.  
  10. #include "Location.h"
  11. #include "IList.h"
  12. #include "Link.h"
  13. #include "Boolean.h"
  14. #include "types.h"
  15. #include "EventsWanted.h"
  16.  
  17. #ifdef SP_NAMESPACE
  18. namespace SP_NAMESPACE {
  19. #endif
  20.  
  21. struct OutputStateLevel : public Link {
  22.   OutputStateLevel();
  23.   Boolean hasPendingRe() const;
  24.   char state;            // should be OutputState::State
  25.   unsigned long reSerial;
  26.   Location reLocation;
  27. };
  28.  
  29. class EventHandler;
  30. class Allocator;
  31.  
  32. class OutputState {
  33. public:
  34.   OutputState();
  35.   void init();
  36.   void handleRe(EventHandler &, Allocator &, const EventsWanted &,
  37.         Char, const Location &);
  38.   void noteRs(EventHandler &, Allocator &, const EventsWanted &);
  39.   void noteMarkup(EventHandler &, Allocator &, const EventsWanted &);
  40.   void noteData(EventHandler &, Allocator &, const EventsWanted &);
  41.   void noteStartElement(Boolean included,
  42.             EventHandler &, Allocator &, const EventsWanted &);
  43.   void noteEndElement(Boolean included,
  44.               EventHandler &, Allocator &, const EventsWanted &);
  45. private:
  46.   OutputState(const OutputState &); // undefined
  47.   void operator=(const OutputState &); // undefined
  48.   enum State {
  49.     afterStartTag,
  50.     afterRsOrRe,
  51.     afterData,
  52.     pendingAfterRsOrRe,
  53.     pendingAfterMarkup
  54.   };
  55.   IList<OutputStateLevel> stack_;
  56.   OutputStateLevel &top();
  57.   Char re_;
  58.   unsigned long nextSerial_;
  59.   friend struct OutputStateLevel;
  60. };
  61.  
  62. inline
  63. Boolean OutputStateLevel::hasPendingRe() const
  64. {
  65.   return int(state) >= int(OutputState::pendingAfterRsOrRe);
  66. }
  67.  
  68. inline
  69. OutputStateLevel &OutputState::top()
  70. {
  71.   return *stack_.head();
  72. }
  73.  
  74. #ifdef SP_NAMESPACE
  75. }
  76. #endif
  77.  
  78. #endif /* not OutputState_INCLUDED */
  79.