/usr/include/OpenSP/InputSource.h is in libosp-dev 1.5.2-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | // Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef InputSource_INCLUDED
#define InputSource_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "types.h"
#include "Link.h"
#include "Ptr.h"
#include "Location.h"
#include "XcharMap.h"
#include <stddef.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Messenger;
class NamedCharRef;
class CharsetInfo;
class InternalInputSource;
class SP_API InputSource : public Link {
public:
enum { eE = -1 }; // end of entity signal
virtual ~InputSource();
Xchar get(Messenger &);
virtual void pushCharRef(Char ch, const NamedCharRef &) = 0;
const Location ¤tLocation() const;
const Char *currentTokenStart() const;
size_t currentTokenLength() const;
const Char *currentTokenEnd() const;
Index nextIndex() const;
// Discard all but the last character of the current token.
void discardInitial();
void startToken();
void startTokenNoMulticode();
void endToken(size_t length);
Xchar tokenChar(Messenger &);
Xchar tokenCharInBuffer(Messenger &);
void ungetToken();
void setMarkupScanTable(const XcharMap<unsigned char> &);
Boolean scanSuppress() const;
void extendToBufferEnd();
virtual void willNotRewind();
virtual Boolean rewind(Messenger &) = 0;
Boolean accessError() const;
virtual void setDocCharset(const CharsetInfo &docCharset,
const CharsetInfo &emCharset);
virtual void willNotSetDocCharset();
virtual InternalInputSource *asInternalInputSource();
protected:
InputSource(InputSourceOrigin *origin, const Char *start, const Char *end);
void reset(const Char *start, const Char *end);
InputSourceOrigin *inputSourceOrigin();
void noteCharRef(Index replacementIndex, const NamedCharRef &);
const Char *cur();
const Char *start();
const Char *end();
Index startIndex();
void changeBuffer(const Char *newBase, const Char *oldBase);
void advanceEnd(const Char *newEnd);
void moveLeft();
void moveStart(const Char *newStart);
Char nextChar();
void setAccessError();
private:
InputSource(const InputSource &); // undefined
void operator=(const InputSource &); // undefined
virtual Xchar fill(Messenger &) = 0;
void advanceStart(const Char *to);
void advanceStartMulticode(const Char *to);
const Char *cur_;
const Char *start_;
const Char *end_;
Location startLocation_;
Ptr<InputSourceOrigin> origin_;
Boolean accessError_;
Boolean scanSuppress_;
Boolean scanSuppressSingle_;
Index scanSuppressIndex_;
Boolean multicode_;
XcharMap<unsigned char> markupScanTable_;
};
inline
void InputSource::advanceStart(const Char *to)
{
if (multicode_)
advanceStartMulticode(to);
else {
startLocation_ += to - start_;
start_ = to;
}
}
inline
Xchar InputSource::get(Messenger &mgr)
{
advanceStart(cur_);
return cur_ < end_ ? *cur_++ : fill(mgr);
}
inline
void InputSource::startTokenNoMulticode()
{
startLocation_ += cur_ - start_;
start_ = cur_;
}
inline
void InputSource::startToken()
{
advanceStart(cur_);
}
inline
void InputSource::endToken(size_t length)
{
cur_ = start_ + length;
}
inline
Xchar InputSource::tokenChar(Messenger &mgr)
{
return cur_ < end_ ? *cur_++ : fill(mgr);
}
inline
Xchar InputSource::tokenCharInBuffer(Messenger &mgr)
{
return cur_ < end_ ? (Xchar)*cur_++ : eE;
}
inline
void InputSource::extendToBufferEnd()
{
cur_ = end_;
}
inline
const Char *InputSource::cur()
{
return cur_;
}
inline
const Char *InputSource::start()
{
return start_;
}
inline
const Char *InputSource::end()
{
return end_;
}
inline
void InputSource::changeBuffer(const Char *newBase, const Char *oldBase)
{
cur_ = newBase + (cur_ - oldBase);
start_ = newBase + (start_ - oldBase);
end_ = newBase + (end_ - oldBase);
}
inline
void InputSource::moveStart(const Char *newStart)
{
cur_ = newStart + (cur_ - start_);
end_ = newStart + (end_ - start_);
start_ = newStart;
}
inline
void InputSource::advanceEnd(const Char *newEnd)
{
end_ = newEnd;
}
inline
Char InputSource::nextChar()
{
return *cur_++;
}
inline
Index InputSource::startIndex()
{
return startLocation_.index();
}
inline
void InputSource::moveLeft()
{
start_--;
cur_--;
}
inline
void InputSource::noteCharRef(Index replacementIndex, const NamedCharRef &ref)
{
origin_->noteCharRef(replacementIndex, ref);
}
inline
const Location &InputSource::currentLocation() const
{
return startLocation_;
}
inline
const Char *InputSource::currentTokenStart() const
{
return start_;
}
inline
size_t InputSource::currentTokenLength() const
{
return cur_ - start_;
}
inline
Index InputSource::nextIndex() const
{
return startLocation_.index() + (cur_ - start_);
}
inline
const Char *InputSource::currentTokenEnd() const
{
return cur_;
}
inline
void InputSource::discardInitial()
{
advanceStart(cur_ - 1);
}
inline
void InputSource::ungetToken()
{
cur_ = start_;
}
inline
void InputSource::setMarkupScanTable(const XcharMap<unsigned char> &table)
{
markupScanTable_ = table;
multicode_ = 1;
}
inline
Boolean InputSource::scanSuppress() const
{
return scanSuppress_ && (!scanSuppressSingle_
|| startLocation_.index() == scanSuppressIndex_);
}
inline
InputSourceOrigin *InputSource::inputSourceOrigin()
{
return origin_.pointer();
}
inline
void InputSource::setAccessError()
{
accessError_ = 1;
}
inline
Boolean InputSource::accessError() const
{
return accessError_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not InputSource_INCLUDED */
|