/usr/include/sp/Markup.h is in libsp1-dev 1.3.4-1.2.1-47.3ubuntu1.
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 | // Copyright (c) 1995 James Clark
// See the file COPYING for copying permission.
#ifndef Markup_INCLUDED
#define Markup_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "StringC.h"
#include "Syntax.h"
#include "Sd.h"
#include "Vector.h"
#include "Text.h"
#include "SdText.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class EntityOrigin;
struct SP_API MarkupItem {
MarkupItem();
MarkupItem(const MarkupItem &);
~MarkupItem();
void operator=(const MarkupItem &);
unsigned char type;
unsigned char index;
union {
size_t nChars;
ConstPtr<Origin> *origin; // type == entityStart
Text *text; // type == literal
SdText *sdText; // type == sdLiteral
};
};
class InputSource;
class SP_API Markup {
public:
enum Type {
reservedName,
sdReservedName,
name,
nameToken,
attributeValue,
number,
comment,
s,
shortref,
delimiter,
refEndRe,
entityStart,
entityEnd,
literal,
sdLiteral
};
Markup();
size_t size() const;
void clear();
void resize(size_t);
void addDelim(Syntax::DelimGeneral);
void addReservedName(Syntax::ReservedName, const InputSource *);
void addReservedName(Syntax::ReservedName, const StringC &);
void addSdReservedName(Sd::ReservedName, const InputSource *);
void addSdReservedName(Sd::ReservedName, const Char *, size_t);
void addS(Char);
void addS(const InputSource *);
void addRefEndRe();
void addShortref(const InputSource *);
void addCommentStart();
void addCommentChar(Char);
void addName(const InputSource *);
void addName(const Char *, size_t);
void addNameToken(const InputSource *);
void addNumber(const InputSource *);
void addAttributeValue(const InputSource *);
void addEntityStart(const Ptr<EntityOrigin> &);
void addEntityEnd();
void addLiteral(const Text &);
void addSdLiteral(const SdText &);
void changeToAttributeValue(size_t index);
void changeToSdReservedName(size_t index, Sd::ReservedName);
void swap(Markup &);
private:
StringC chars_;
Vector<MarkupItem> items_;
friend class MarkupIter;
};
class Location;
class SP_API MarkupIter {
public:
MarkupIter(const Markup &);
Markup::Type type() const;
Boolean valid() const;
void advance();
// This updates a Location.
void advance(Location &, const ConstPtr<Syntax> &);
size_t index() const;
const Char *charsPointer() const;
size_t charsLength() const;
const Text &text() const;
const EntityOrigin *entityOrigin() const; // valid for type == entityStart
const SdText &sdText() const;
Syntax::DelimGeneral delimGeneral() const;
Syntax::ReservedName reservedName() const;
Sd::ReservedName sdReservedName() const;
private:
const Char *chars_;
Vector<MarkupItem>::const_iterator items_;
size_t nItems_;
size_t index_;
size_t charIndex_;
};
inline
void Markup::clear()
{
chars_.resize(0);
items_.resize(0);
}
inline
size_t Markup::size() const
{
return items_.size();
}
inline
Boolean MarkupIter::valid() const
{
return index_ < nItems_;
}
inline
size_t MarkupIter::index() const
{
return index_;
}
inline
Markup::Type MarkupIter::type() const
{
return Markup::Type(items_[index_].type);
}
inline
const EntityOrigin *MarkupIter::entityOrigin() const
{
return (*items_[index_].origin)->asEntityOrigin();
}
inline
const Char *MarkupIter::charsPointer() const
{
return chars_ + charIndex_;
}
inline
size_t MarkupIter::charsLength() const
{
return items_[index_].nChars;
}
inline
const Text &MarkupIter::text() const
{
return *items_[index_].text;
}
inline
const SdText &MarkupIter::sdText() const
{
return *items_[index_].sdText;
}
inline
Syntax::DelimGeneral MarkupIter::delimGeneral() const
{
return Syntax::DelimGeneral(items_[index_].index);
}
inline
Syntax::ReservedName MarkupIter::reservedName() const
{
return Syntax::ReservedName(items_[index_].index);
}
inline
Sd::ReservedName MarkupIter::sdReservedName() const
{
return Sd::ReservedName(items_[index_].index);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Markup_INCLUDED */
|