summaryrefslogtreecommitdiff
path: root/ACEXML/parser/parser/Parser.i
blob: 562923e11c78e4c3b30daba4967e086ff9fab2cf (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// $Id$

ACEXML_INLINE ACEXML_ContentHandler *
ACEXML_Parser::getContentHandler (void) const
{
  return this->content_handler_;
}

ACEXML_INLINE ACEXML_DTDHandler *
ACEXML_Parser::getDTDHandler (void) const
{
  return this->dtd_handler_;
}

ACEXML_INLINE ACEXML_EntityResolver *
ACEXML_Parser::getEntityResolver (void) const
{
  return this->entity_resolver_;
}

ACEXML_INLINE ACEXML_ErrorHandler *
ACEXML_Parser::getErrorHandler (void) const
{
  return this->error_handler_;
}

ACEXML_INLINE void
ACEXML_Parser::setContentHandler (ACEXML_ContentHandler *handler)
{
  this->content_handler_ = handler;
}

ACEXML_INLINE void
ACEXML_Parser::setDTDHandler (ACEXML_DTDHandler *handler)
{
  this->dtd_handler_ = handler;
}

ACEXML_INLINE void
ACEXML_Parser::setEntityResolver (ACEXML_EntityResolver *resolver)
{
  this->entity_resolver_ = resolver;
}

ACEXML_INLINE void
ACEXML_Parser::setErrorHandler (ACEXML_ErrorHandler *handler)
{
  this->error_handler_ = handler;
}

ACEXML_INLINE int
ACEXML_Parser::is_whitespace (ACEXML_Char c)
{
  switch (c)
    {
    case 0x20:
    case 0x9:
    case 0xd:
    case 0xa:
      return 1;
    default:
      return 0;
    }
}


ACEXML_INLINE int
ACEXML_Parser::is_whitespace_or_equal (ACEXML_Char c)
{
  switch (c)
    {
    case 0x20:
    case 0x9:
    case 0xd:
    case 0xa:
    case '=':
      return 1;
    default:
      return 0;
    }
}

ACEXML_INLINE int
ACEXML_Parser::is_nonname (ACEXML_Char c)
{
  switch (c)
    {
    case 0x20:
    case 0x9:
    case 0xd:
    case 0xa:
    case '=':
    case '/':
    case '?':
    case '>':
    case '<':
      return 1;
    default:
      return 0;
    }
}

ACEXML_INLINE ACEXML_Char
ACEXML_Parser::get (void)
{
  // Using an extra level of indirection so we can
  // manage document location in the future.

  if (this->instream_ != 0)
    {
      ACEXML_Char ch;
      this->instream_->get (ch);
      return ch;
    }
  return 0;
}

ACEXML_INLINE ACEXML_Char
ACEXML_Parser::peek (void)
{
  // Using an extra level of indirection so we can
  // manage document location in the future.

  if (this->instream_ != 0)
    return this->instream_->peek ();
  return 0;

}