File: OutputState.h

package info (click to toggle)
opensp 1.5.2-15.2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,168 kB
  • sloc: cpp: 65,784; ansic: 17,124; sh: 11,193; xml: 2,704; makefile: 895; perl: 561; yacc: 288; sed: 16
file content (78 lines) | stat: -rw-r--r-- 1,782 bytes parent folder | download | duplicates (22)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.

#ifndef OutputState_INCLUDED
#define OutputState_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif

#include "Location.h"
#include "IList.h"
#include "Link.h"
#include "Boolean.h"
#include "types.h"
#include "EventsWanted.h"

#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif

struct OutputStateLevel : public Link {
  OutputStateLevel();
  Boolean hasPendingRe() const;
  char state;			// should be OutputState::State
  unsigned long reSerial;
  Location reLocation;
};

class EventHandler;
class Allocator;

class OutputState {
public:
  OutputState();
  void init();
  void handleRe(EventHandler &, Allocator &, const EventsWanted &,
		Char, const Location &);
  void noteRs(EventHandler &, Allocator &, const EventsWanted &);
  void noteMarkup(EventHandler &, Allocator &, const EventsWanted &);
  void noteData(EventHandler &, Allocator &, const EventsWanted &);
  void noteStartElement(Boolean included,
			EventHandler &, Allocator &, const EventsWanted &);
  void noteEndElement(Boolean included,
		      EventHandler &, Allocator &, const EventsWanted &);
private:
  OutputState(const OutputState &); // undefined
  void operator=(const OutputState &); // undefined
  enum State {
    afterStartTag,
    afterRsOrRe,
    afterData,
    pendingAfterRsOrRe,
    pendingAfterMarkup
  };
  IList<OutputStateLevel> stack_;
  OutputStateLevel &top();
  Char re_;
  unsigned long nextSerial_;
  friend struct OutputStateLevel;
};

inline
Boolean OutputStateLevel::hasPendingRe() const
{
  return int(state) >= int(OutputState::pendingAfterRsOrRe);
}

inline
OutputStateLevel &OutputState::top()
{
  return *stack_.head();
}

#ifdef SP_NAMESPACE
}
#endif

#endif /* not OutputState_INCLUDED */