This file is indexed.

/usr/include/OpenSP/Event.h is in libosp-dev 1.5.2-10ubuntu3.

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
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.

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

#include "Link.h"
#include "Allocator.h"
#include "Location.h"
#include "Vector.h"
#include "Owner.h"
#include "Boolean.h"
#include "types.h"
#include "Ptr.h"
#include "StringC.h"
#include "Notation.h"
#include "Sd.h"
#include "Syntax.h"
#include "Dtd.h"
#include "ElementType.h"
#include "Text.h"
#include "Lpd.h"
#include "Message.h"
#include "Markup.h"
#include "ShortReferenceMap.h"

#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif

class EventHandler;

class SP_API Event : public Link {
public:
  enum Type {
    message,
    characterData,
    startElement,
    endElement,
    pi,
    sdataEntity,
    externalDataEntity,
    subdocEntity,
    nonSgmlChar,
    appinfo,
    startDtd,
    endDtd,
    startLpd,
    endLpd,
    endProlog,
    sgmlDecl,
    uselink,
    usemap,
    commentDecl,
    sSep,
    ignoredRs,
    ignoredRe,
    reOrigin,
    ignoredChars,
    markedSectionStart,
    markedSectionEnd,
    entityStart,
    entityEnd,
    notationDecl,
    entityDecl,
    elementDecl,
    attlistDecl,		// not #NOTATION and not in LPD
    attlistNotationDecl,
    linkAttlistDecl,
    linkDecl,
    idLinkDecl,
    shortrefDecl,
    ignoredMarkup,
    entityDefaulted,
    sgmlDeclEntity
    };
  Event(Type);
  virtual ~Event();
  virtual void handle(EventHandler &) = 0;
  virtual void copyData();
  void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); }
  void *operator new(size_t sz) { return Allocator::allocSimple(sz); }
  void operator delete(void *p) { Allocator::free(p); }
#ifdef SP_HAVE_PLACEMENT_OPERATOR_DELETE
  void operator delete(void *p, Allocator &) { Allocator::free(p); }
#endif
  Type type() const;
private:
  Event(const Event &);		// undefined
  void operator=(const Event &); // undefined
  Type type_;
};

class LocatedEvent : public Event {
public:
  LocatedEvent(Type type, const Location &);
  const Location &location() const;
private:
  LocatedEvent(const LocatedEvent &); // undefined
  void operator=(const LocatedEvent &);	// undefined
  Location location_;
};

class MarkupEvent : public LocatedEvent {
public:
  MarkupEvent(Type type);
  MarkupEvent(Type type, const Location &, Markup *);
  const Markup &markup() const;
private:
  MarkupEvent(const MarkupEvent &); // undefined
  void operator=(const MarkupEvent &);	// undefined
  Markup markup_;
};

class SP_API MessageEvent : public Event {
public:
  MessageEvent(Message &);
  MessageEvent(const Message &);
  ~MessageEvent();
  const Message &message() const;
  void handle(EventHandler &);
private:
  MessageEvent(const MessageEvent &); // undefined
  void operator=(const MessageEvent &);	// undefined
  Message message_;
};

class AttributeList;

class StartElementEvent : public LocatedEvent {
public:
  StartElementEvent(const ElementType *,
		    const ConstPtr<Dtd> &,
		    AttributeList *,
		    const Location &,
		    Markup *);
  ~StartElementEvent();
  void handle(EventHandler &);
  Boolean mustOmitEnd() const;
  void setIncluded();
  Boolean included() const;
  const StringC &name() const;
  const ElementType *elementType() const;
  const Markup *markupPtr() const;
  const AttributeList &attributes() const;
  void copyData();
private:
  StartElementEvent(const StartElementEvent &);	// undefined
  void operator=(const StartElementEvent &);	// undefined
  const ElementType *elementType_;
  ConstPtr<Dtd> dtd_;
  PackedBoolean included_;
  PackedBoolean copied_;	// has copyData() been called
  Markup *markup_;
  AttributeList *attributes_;
};

class EndElementEvent : public LocatedEvent {
public:
  EndElementEvent(const ElementType *,
		  const ConstPtr<Dtd> &,
		  const Location &,
		  Markup *);
  ~EndElementEvent();
  void handle(EventHandler &);
  void setIncluded();
  Boolean included() const;
  const StringC &name() const;
  const ElementType *elementType() const;
  const Markup *markupPtr() const;
  void copyData();
private:
  EndElementEvent(const EndElementEvent &); // undefined
  void operator=(const EndElementEvent &);  // undefined
  const ElementType *elementType_;
  ConstPtr<Dtd> dtd_;
  PackedBoolean included_;
  PackedBoolean copied_;	// has copyData() been called
  Markup *markup_;
};

class DataEvent : public LocatedEvent {
public:
  DataEvent(Type, const Char *, size_t, const Location &);
  void handle(EventHandler &);
  const Char *data() const;
  size_t dataLength() const;
  virtual Boolean isRe(unsigned long &serial) const;
  virtual const Entity *entity() const;
protected:
  const Char *p_;
  size_t length_;
private:
  DataEvent(const DataEvent &);	// undefined
  void operator=(const DataEvent &); // undefined
};

class ImmediateDataEvent : public DataEvent {
public:
  ImmediateDataEvent(Type type, const Char *, size_t, const Location &,
		     Boolean copy);
  ~ImmediateDataEvent();
  void copyData();
private:
  ImmediateDataEvent(const ImmediateDataEvent &); // undefined
  void operator=(const ImmediateDataEvent &);	  // undefined
  Char *alloc_;
};

class InternalDataEntity;

class DataEntityEvent : public DataEvent {
public:
  DataEntityEvent(Type type, const InternalEntity *,
		  const ConstPtr<Origin> &);
  const Entity *entity() const;
private:
  DataEntityEvent(const DataEntityEvent &); // undefined
  void operator=(const DataEntityEvent &);  // undefined
};

class InternalCdataEntity;

class CdataEntityEvent : public DataEntityEvent {
public:
  CdataEntityEvent(const InternalEntity *,
		   const ConstPtr<Origin> &);
private:
  CdataEntityEvent(const CdataEntityEvent &); // undefined
  void operator=(const CdataEntityEvent &);   // undefined
};

class InternalSdataEntity;

class SdataEntityEvent : public DataEntityEvent {
public:
  SdataEntityEvent(const InternalEntity *,
		   const ConstPtr<Origin> &);
  void handle(EventHandler &);
private:
  SdataEntityEvent(const SdataEntityEvent &); // undefined
  void operator=(const SdataEntityEvent &);   // undefined
};

class PiEntity;

class PiEvent : public LocatedEvent {
public:
  PiEvent(const Char *, size_t, const Location &);
  const Char *data() const;
  size_t dataLength() const;
  virtual const Entity *entity() const;
  void handle(EventHandler &);
private:
  PiEvent(const PiEvent &);	// undefined
  void operator=(const PiEvent &); // undefined
  const Char *data_;
  size_t dataLength_;
};

class ImmediatePiEvent : public PiEvent {
public:
  ImmediatePiEvent(StringC &, const Location &);
private:
  ImmediatePiEvent(const ImmediatePiEvent &); // undefined
  void operator=(const ImmediatePiEvent &);   // undefined
  StringC string_;
};

class PiEntityEvent : public PiEvent {
public:
  PiEntityEvent(const PiEntity *entity,
		const ConstPtr<Origin> &origin);
  const Entity *entity() const;
private:
  PiEntityEvent(const PiEntityEvent &);	// undefined
  void operator=(const PiEntityEvent &); // undefined
};

class ExternalNonTextEntity;
class ExternalDataEntity;
class SubdocEntity;

class ExternalEntityEvent : public Event {
public:
  ExternalEntityEvent(Type type,
		      const ConstPtr<EntityOrigin> &);
  const ConstPtr<EntityOrigin> &entityOrigin() const;
  const Location &location() const;
private:
  ExternalEntityEvent(const ExternalEntityEvent &); // undefined
  void operator=(const ExternalEntityEvent &);	    // undefined
  ConstPtr<EntityOrigin> origin_;
};

class ExternalDataEntityEvent : public ExternalEntityEvent {
public:
  ExternalDataEntityEvent(const ExternalDataEntity *,
			  const ConstPtr<EntityOrigin> &);
  void handle(EventHandler &);
  const ExternalDataEntity *entity() const;
private:
  ExternalDataEntityEvent(const ExternalDataEntityEvent &); // undefined
  void operator=(const ExternalDataEntityEvent &);	    // undefined
  const ExternalDataEntity *dataEntity_;
};

class SubdocEntityEvent : public ExternalEntityEvent {
public:
  SubdocEntityEvent(const SubdocEntity *,
		    const ConstPtr<EntityOrigin> &);
  void handle(EventHandler &);
  const SubdocEntity *entity() const;
private:
  SubdocEntityEvent(const SubdocEntityEvent &);	// undefined
  void operator=(const SubdocEntityEvent &);	// undefined
  const SubdocEntity *subdocEntity_;
};

class NonSgmlCharEvent : public LocatedEvent {
public:
  NonSgmlCharEvent(Char c, const Location &);
  Char character() const;
  void handle(EventHandler &);
private:
  NonSgmlCharEvent(const NonSgmlCharEvent &); // undefined
  void operator=(const NonSgmlCharEvent &);   // undefined
  Char c_;
};

class AppinfoEvent : public LocatedEvent {
public:
  AppinfoEvent(const Location &);
  AppinfoEvent(const Text &, const Location &);
  void handle(EventHandler &);
  Boolean literal(const StringC *&) const;
private:
  AppinfoEvent(const AppinfoEvent &); // undefined
  void operator=(const AppinfoEvent &);	// undefined
  Boolean appinfoNone_;
  Text appinfo_;
};

class UselinkEvent : public MarkupEvent {
public:
  UselinkEvent(const ConstPtr<Lpd> &,
	       const LinkSet *,
	       Boolean restore,
	       const Location &,
	       Markup *);
  void handle(EventHandler &);
  const ConstPtr<Lpd> &lpd() const;
  const LinkSet *linkSet() const;
  Boolean restore() const;
private:
  UselinkEvent(const UselinkEvent &); // undefined
  void operator=(const UselinkEvent &);	// undefined
  ConstPtr<Lpd> lpd_;
  const LinkSet *linkSet_;
  Boolean restore_;
};

class UsemapEvent : public MarkupEvent {
public:
  UsemapEvent(const ShortReferenceMap *,
	      Vector<const ElementType *> &,
	      const ConstPtr<Dtd> &,
	      const Location &,
	      Markup *);
  void handle(EventHandler &);
  const ShortReferenceMap *map() const;
  const Vector<const ElementType *> &elements() const;
private:
  UsemapEvent(const UsemapEvent &); // undefined
  void operator=(const UsemapEvent &); // undefined
  ConstPtr<Dtd> dtd_;
  Vector<const ElementType *> elements_;
  const ShortReferenceMap *map_;
};

class StartSubsetEvent : public MarkupEvent {
public:
  StartSubsetEvent(Type,
		   const StringC &,
		   const ConstPtr<Entity> &entity,
		   Boolean hasInternalSubset,
		   const Location &,
		   Markup *);
  const StringC &name() const;
  const ConstPtr<Entity> &entity() const;
  Boolean hasInternalSubset() const;
private:
  StartSubsetEvent(const StartSubsetEvent &);	// undefined
  void operator=(const StartSubsetEvent &); // undefined
  StringC name_;
  ConstPtr<Entity> entity_;
  Boolean hasInternalSubset_;
};

class StartDtdEvent : public StartSubsetEvent {
public:
  StartDtdEvent(const StringC &,
		const ConstPtr<Entity> &entity,
		Boolean hasInternalSubset,
		const Location &,
		Markup *);
  void handle(EventHandler &);
private:
  StartDtdEvent(const StartDtdEvent &);	// undefined
  void operator=(const StartDtdEvent &); // undefined
};

class StartLpdEvent : public StartSubsetEvent {
public:
  StartLpdEvent(Boolean active,
		const StringC &,
		const ConstPtr<Entity> &entity,
		Boolean hasInternalSubset,
		const Location &,
		Markup *);
  void handle(EventHandler &);
  Boolean active() const;
private:
  StartLpdEvent(const StartLpdEvent &);	// undefined
  void operator=(const StartLpdEvent &); // undefined
  Boolean active_;
};

class EndDtdEvent : public MarkupEvent {
public:
  EndDtdEvent(const ConstPtr<Dtd> &, const Location &,
	      Markup *);
  void handle(EventHandler &);
  const Dtd &dtd() const;
  const ConstPtr<Dtd> &dtdPointer() const;
private:
  EndDtdEvent(const EndDtdEvent &); // undefined
  void operator=(const EndDtdEvent &); // undefined
  ConstPtr<Dtd> dtd_;
};

class EndLpdEvent : public MarkupEvent {
public:
  EndLpdEvent(const ConstPtr<Lpd> &, const Location &,
	      Markup *);
  void handle(EventHandler &);
  const Lpd &lpd() const;
  const ConstPtr<Lpd> &lpdPointer() const;
private:
  EndLpdEvent(const EndLpdEvent &); // undefined
  void operator=(const EndLpdEvent &); // undefined
  ConstPtr<Lpd> lpd_;
};

class EndPrologEvent : public LocatedEvent {
public:
  EndPrologEvent(const ConstPtr<Dtd> &dtd,
		 const ConstPtr<ComplexLpd> &lpd,
		 Vector<StringC> &simpleLinkNames,
		 Vector<AttributeList> &simpleLinkAttributes,
		 const Location &);
  EndPrologEvent(const ConstPtr<Dtd> &dtd,
		 const Location &);
  void handle(EventHandler &);
  const Dtd &dtd() const;
  const ConstPtr<Dtd> &dtdPointer() const;
  const ConstPtr<ComplexLpd> &lpdPointer() const;
  const Vector<StringC> &simpleLinkNames() const;
  const Vector<AttributeList> &simpleLinkAttributes() const;
private:
  EndPrologEvent(const EndPrologEvent &); // undefined
  void operator=(const EndPrologEvent &); // undefined
  ConstPtr<Dtd> dtd_;
  ConstPtr<ComplexLpd> lpd_;
  Vector<StringC> simpleLinkNames_;
  Vector<AttributeList> simpleLinkAttributes_;
};

class SgmlDeclEvent : public MarkupEvent {
public:
  // for an implied SGML declaration
  SgmlDeclEvent(const ConstPtr<Sd> &,
		const ConstPtr<Syntax> &syntax);
  // for an explicit SGML declaration
  SgmlDeclEvent(const ConstPtr<Sd> &,
		const ConstPtr<Syntax> &syntax,
		const ConstPtr<Syntax> &instanceSyntax,
		const ConstPtr<Sd> &refSd,
		const ConstPtr<Syntax> &refSyntax,
		Index nextIndex,
		const StringC &implySystemId,
		const Location &,
		Markup *);
  void handle(EventHandler &);
  const Sd &sd() const;
  const ConstPtr<Sd> &sdPointer() const;
  const Syntax &prologSyntax() const;
  const ConstPtr<Syntax> &prologSyntaxPointer() const;
  const Syntax &instanceSyntax() const;
  const ConstPtr<Syntax> &instanceSyntaxPointer() const;
  const ConstPtr<Sd> &refSdPointer() const;
  const ConstPtr<Syntax> &refSyntaxPointer() const;
  const StringC &implySystemId() const;
private:
  SgmlDeclEvent(const SgmlDeclEvent &);	// undefined
  void operator=(const SgmlDeclEvent &); // undefined
  ConstPtr<Sd> sd_;
  ConstPtr<Syntax> prologSyntax_;
  ConstPtr<Syntax> instanceSyntax_;
  ConstPtr<Sd> refSd_;
  ConstPtr<Syntax> refSyntax_;
  Index nextIndex_;
  StringC implySystemId_;
};

class CommentDeclEvent : public MarkupEvent {
public:
  CommentDeclEvent(const Location &, Markup *);
  void handle(EventHandler &);
private:
  CommentDeclEvent(const CommentDeclEvent &); // undefined
  void operator=(const CommentDeclEvent &);   // undefined
};

class SSepEvent : public ImmediateDataEvent {
public:
  SSepEvent(const Char *, size_t, const Location &, Boolean copy);
  void handle(EventHandler &);
private:
  SSepEvent(const SSepEvent &);	// undefined
  void operator=(const SSepEvent &); // undefined
};

class IgnoredRsEvent : public LocatedEvent {
public:
  IgnoredRsEvent(Char c, const Location &);
  void handle(EventHandler &);
  Char rs() const;
private:
  IgnoredRsEvent(const IgnoredRsEvent &); // undefined
  void operator=(const IgnoredRsEvent &); // undefined
  Char c_;
};

class IgnoredReEvent : public LocatedEvent {
public:
  IgnoredReEvent(Char c, const Location &, unsigned long serial);
  void handle(EventHandler &);
  Char re() const;
  unsigned long serial() const;
private:
  IgnoredReEvent(const IgnoredReEvent &); // undefined
  void operator=(const IgnoredReEvent &); // undefined
  unsigned long serial_;
  Char c_;
};

class ReEvent : public ImmediateDataEvent {
public:
  ReEvent(const Char *, const Location &, unsigned long serial);
  Boolean isRe(unsigned long &serial) const;
private:
  ReEvent(const ReEvent &);	// undefined
  void operator=(const ReEvent &); // undefined
  unsigned long serial_;
};

class ReOriginEvent : public LocatedEvent {
public:
  ReOriginEvent(Char c, const Location &, unsigned long serial);
  void handle(EventHandler &);
  Char re() const;
  unsigned long serial() const;
private:
  ReOriginEvent(const ReOriginEvent &);	// undefined
  void operator=(const ReOriginEvent &); // undefined
  unsigned long serial_;
  Char c_;
};

class IgnoredCharsEvent : public ImmediateDataEvent {
public:
  IgnoredCharsEvent(const Char *, size_t, const Location &, Boolean copy);
  void handle(EventHandler &);
private:
  IgnoredCharsEvent(const IgnoredCharsEvent &);	// undefined
  void operator=(const IgnoredCharsEvent &);	// undefined
};

class MarkedSectionEvent : public MarkupEvent {
public:
  enum Status { include, rcdata, cdata, ignore }; // in priority order
  MarkedSectionEvent(Type, Status, const Location &, Markup *);
  Status status() const;
private:
  MarkedSectionEvent(const MarkedSectionEvent &); // undefined
  void operator=(const MarkedSectionEvent &);	  // undefined
  Status status_;
};

class MarkedSectionStartEvent : public MarkedSectionEvent {
public:
  MarkedSectionStartEvent(Status, const Location &, Markup *);
  void handle(EventHandler &);
private:
  MarkedSectionStartEvent(const MarkedSectionStartEvent &); // undefined
  void operator=(const MarkedSectionStartEvent &);	    // undefined
};

class MarkedSectionEndEvent : public MarkedSectionEvent {
public:
  MarkedSectionEndEvent(Status, const Location &, Markup *);
  void handle(EventHandler &);
private:
  MarkedSectionEndEvent(const MarkedSectionEndEvent &); // undefined
  void operator=(const MarkedSectionEndEvent &);	    // undefined
};

class EntityStartEvent : public Event {
public:
  EntityStartEvent(const ConstPtr<EntityOrigin> &origin);
  void handle(EventHandler &);
  const Entity *entity() const;
  const ConstPtr<EntityOrigin> &entityOrigin() const;
private:
  EntityStartEvent(const EntityStartEvent &); // undefined
  void operator=(const EntityStartEvent &); // undefined

  ConstPtr<EntityOrigin> origin_;
};

class EntityEndEvent : public LocatedEvent {
public:
  EntityEndEvent(const Location &);
  void handle(EventHandler &);
private:
  EntityEndEvent(const EntityEndEvent &); // undefined
  void operator=(const EntityEndEvent &); // undefined
};

class EntityDeclEvent : public MarkupEvent {
public:
  EntityDeclEvent(const ConstPtr<Entity> &,
		  Boolean ignored,
		  const Location &,
		  Markup *);
  void handle(EventHandler &);
  const Entity &entity() const;
  const ConstPtr<Entity> &entityPointer() const;
  Boolean ignored() const;
  // The name of the entity will be empty if this is the default entity.
private:
  Boolean ignored_;
  // This will actually point to an external entity.
  ConstPtr<Entity> entity_;
};

class NotationDeclEvent : public MarkupEvent {
public:
  NotationDeclEvent(const ConstPtr<Notation> &,
		    const Location &,
		    Markup *);
  void handle(EventHandler &);
  const Notation &notation() const;
  const ConstPtr<Notation> &notationPointer() const;
private:
  NotationDeclEvent(const NotationDeclEvent &);	// undefined
  void operator=(const NotationDeclEvent &);	// undefined
  ConstPtr<Notation> notation_;
};

class ElementDeclEvent : public MarkupEvent {
public:
  ElementDeclEvent(Vector<const ElementType *> &elements,
		   const ConstPtr<Dtd> &,
		   const Location &,
		   Markup *);
  void handle(EventHandler &);
  const Vector<const ElementType *> &elements() const;
private:
  ElementDeclEvent(const ElementDeclEvent &); // undefined
  void operator=(const ElementDeclEvent &);   // undefined
  Vector<const ElementType *> elements_;
  ConstPtr<Dtd> dtd_;
};

class AttlistDeclEvent : public MarkupEvent {
public:
  AttlistDeclEvent(Vector<const ElementType *> &elements,
		   const ConstPtr<Dtd> &,
		   const Location &,
		   Markup *);
  void handle(EventHandler &);
  const Vector<const ElementType *> &elements() const;
private:
  AttlistDeclEvent(const AttlistDeclEvent &); // undefined
  void operator=(const AttlistDeclEvent &);   // undefined
  Vector<const ElementType *> elements_;
  ConstPtr<Dtd> dtd_;
};

class AttlistNotationDeclEvent : public MarkupEvent {
public:
  AttlistNotationDeclEvent(Vector<ConstPtr<Notation> > &notations,
			   const Location &,
			   Markup *);
  void handle(EventHandler &);
  const Vector<ConstPtr<Notation> > &notations() const;
private:
  AttlistNotationDeclEvent(const AttlistNotationDeclEvent &); // undefined
  void operator=(const AttlistDeclEvent &);		      // undefined
  Vector<ConstPtr<Notation> > notations_;
};

class LinkAttlistDeclEvent : public MarkupEvent {
public:
  LinkAttlistDeclEvent(Vector<const ElementType *> &elements,
		       const ConstPtr<Lpd> &,
		       const Location &,
		       Markup *);
  void handle(EventHandler &);
  const Vector<const ElementType *> &elements() const;
  const Lpd &lpd() const;
private:
  LinkAttlistDeclEvent(const LinkAttlistDeclEvent &); // undefined
  void operator=(const LinkAttlistDeclEvent &);   // undefined
  Vector<const ElementType *> elements_;
  ConstPtr<Lpd> lpd_;
};

class LinkDeclEvent : public MarkupEvent {
public:
  LinkDeclEvent(const LinkSet *linkSet,
		const ConstPtr<ComplexLpd> &,
		const Location &,
		Markup *);
  void handle(EventHandler &);
  const LinkSet *linkSet() const;
  const ComplexLpd &lpd() const;
private:
  LinkDeclEvent(const LinkDeclEvent &); // undefined
  void operator=(const LinkDeclEvent &); // undefined
  const LinkSet *linkSet_;
  ConstPtr<ComplexLpd> lpd_;
};

class IdLinkDeclEvent : public MarkupEvent {
public:
  IdLinkDeclEvent(const ConstPtr<ComplexLpd> &,
		  const Location &,
		  Markup *);
  void handle(EventHandler &);
  const ComplexLpd &lpd() const;
private:
  IdLinkDeclEvent(const IdLinkDeclEvent &); // undefined
  void operator=(const IdLinkDeclEvent &); // undefined
  ConstPtr<ComplexLpd> lpd_;
};

class ShortrefDeclEvent : public MarkupEvent {
public:
  ShortrefDeclEvent(const ShortReferenceMap *,
		    const ConstPtr<Dtd> &,
		    const Location &,
		    Markup *);
  void handle(EventHandler &);
  const ShortReferenceMap *map() const;
private:
  ShortrefDeclEvent(const ShortrefDeclEvent &);	// undefined
  void operator=(const ShortrefDeclEvent &);	// undefined
  const ShortReferenceMap *map_;
  ConstPtr<Dtd> dtd_;
};

class IgnoredMarkupEvent : public MarkupEvent {
public:
  IgnoredMarkupEvent(const Location &, Markup *);
  void handle(EventHandler &);
private:
  IgnoredMarkupEvent(const IgnoredMarkupEvent &); // undefined
  void operator=(const IgnoredMarkupEvent &);	  // undefined
};

// This is for an undeclared entity whose first occurrence
// is in the instance, when there is a default entity:
// ie it extends the namespace of general entities after
// the end of the prolog.

class EntityDefaultedEvent : public LocatedEvent {
public:
  EntityDefaultedEvent(const ConstPtr<Entity> &,
		       const Location &);
  void handle(EventHandler &);
  const Entity &entity() const;
  const ConstPtr<Entity> &entityPointer() const;
private:
  EntityDefaultedEvent(const EntityDefaultedEvent &); // undefined
  void operator=(const EntityDefaultedEvent &);	      // undefined
  ConstPtr<Entity> entity_;
};

class SgmlDeclEntityEvent : public LocatedEvent {
public:
  SgmlDeclEntityEvent(const PublicId &publicId,
		      PublicId::TextClass entityType,
		      const StringC &effectiveSystemId,
		      const Location &);
  void handle(EventHandler &);
  const PublicId &publicId() const;
  PublicId::TextClass entityType() const;
  const StringC &effectiveSystemId() const;
private:
  SgmlDeclEntityEvent(const SgmlDeclEntityEvent &); // undefined
  void operator=(const SgmlDeclEntityEvent &);	    // undefined
  PublicId publicId_;
  PublicId::TextClass entityType_;
  StringC effectiveSystemId_;
};

class SP_API EventHandler {
public:
  virtual ~EventHandler();
  virtual void message(MessageEvent *) = 0;
  virtual void data(DataEvent *);
  virtual void startElement(StartElementEvent *);
  virtual void endElement(EndElementEvent *);
  virtual void pi(PiEvent *);
  virtual void sdataEntity(SdataEntityEvent *);
  virtual void externalDataEntity(ExternalDataEntityEvent *);
  virtual void subdocEntity(SubdocEntityEvent *);
  virtual void nonSgmlChar(NonSgmlCharEvent *);
  virtual void appinfo(AppinfoEvent *);
  virtual void uselink(UselinkEvent *);
  virtual void usemap(UsemapEvent *);
  virtual void startDtd(StartDtdEvent *);
  virtual void endDtd(EndDtdEvent *);
  virtual void startLpd(StartLpdEvent *);
  virtual void endLpd(EndLpdEvent *);
  virtual void endProlog(EndPrologEvent *);
  virtual void sgmlDecl(SgmlDeclEvent *);
  virtual void commentDecl(CommentDeclEvent *);
  virtual void sSep(SSepEvent *);
  virtual void ignoredRs(IgnoredRsEvent *);
  virtual void ignoredRe(IgnoredReEvent *);
  virtual void reOrigin(ReOriginEvent *);
  virtual void ignoredChars(IgnoredCharsEvent *);
  virtual void markedSectionStart(MarkedSectionStartEvent *);
  virtual void markedSectionEnd(MarkedSectionEndEvent *);
  virtual void entityStart(EntityStartEvent *);
  virtual void entityEnd(EntityEndEvent *);
  virtual void notationDecl(NotationDeclEvent *);
  virtual void entityDecl(EntityDeclEvent *);
  virtual void elementDecl(ElementDeclEvent *);
  virtual void attlistDecl(AttlistDeclEvent *);
  virtual void linkAttlistDecl(LinkAttlistDeclEvent *);
  virtual void attlistNotationDecl(AttlistNotationDeclEvent *);
  virtual void linkDecl(LinkDeclEvent *);
  virtual void idLinkDecl(IdLinkDeclEvent *);
  virtual void shortrefDecl(ShortrefDeclEvent *);
  virtual void ignoredMarkup(IgnoredMarkupEvent *);
  virtual void entityDefaulted(EntityDefaultedEvent *);
  virtual void inputClosed(InputSource *in);
  virtual void inputOpened(InputSource *in);
  virtual void sgmlDeclEntity(SgmlDeclEntityEvent *);
};

inline
Event::Event(Type type)
: type_(type)
{
}

inline
Event::~Event()
{
}

inline
Event::Type Event::type() const
{
  return type_;
}

inline
const Location &LocatedEvent::location() const
{
  return location_;
}

inline
const Markup &MarkupEvent::markup() const
{
  return markup_;
}

inline
const Message &MessageEvent::message() const
{
  return message_;
}

inline
const ElementType *StartElementEvent::elementType() const
{
  return elementType_;
}

inline
const StringC &StartElementEvent::name() const
{
  return elementType_->name();
}

inline
void StartElementEvent::setIncluded()
{
  included_ = 1;
}

inline
Boolean StartElementEvent::included() const
{
  return included_;
}

inline
const Markup *StartElementEvent::markupPtr() const
{
  return markup_;
}

inline
const AttributeList &StartElementEvent::attributes() const
{
  return *attributes_;
}

inline
Boolean StartElementEvent::mustOmitEnd() const
{
  return ((elementType()->definition()->declaredContent()
	   == ElementDefinition::empty)
	  ||  attributes_->conref());
}

inline
const ElementType *EndElementEvent::elementType() const
{
  return elementType_;
}

inline
const StringC &EndElementEvent::name() const
{
  return elementType_->name();
}

inline
void EndElementEvent::setIncluded()
{
  included_ = 1;
}

inline
Boolean EndElementEvent::included() const
{
  return included_;
}

inline
const Markup *EndElementEvent::markupPtr() const
{
  return markup_;
}

inline
const Char *DataEvent::data() const
{
  return p_;
}

inline
size_t DataEvent::dataLength() const
{
  return length_;
}

inline
const Char *PiEvent::data() const
{
  return data_;
}

inline
size_t PiEvent::dataLength() const
{
  return dataLength_;
}

inline
const ConstPtr<EntityOrigin> &
ExternalEntityEvent::entityOrigin() const
{
  return origin_;
}

inline
const Location &ExternalEntityEvent::location() const
{
  return origin_->parent();
}

inline
const ExternalDataEntity *ExternalDataEntityEvent::entity() const
{
  return dataEntity_;
}

inline
const SubdocEntity *SubdocEntityEvent::entity() const
{
  return subdocEntity_;
}

inline
Char NonSgmlCharEvent::character() const
{
  return c_;
}

inline
Boolean AppinfoEvent::literal(const StringC *&p) const
{
  if (appinfoNone_)
    return 0;
  p = &appinfo_.string();
  return 1;
}

inline
const ConstPtr<Lpd> &UselinkEvent::lpd() const
{
  return lpd_;
}

inline
const LinkSet *UselinkEvent::linkSet() const
{
  return linkSet_;
}

inline
Boolean UselinkEvent::restore() const
{
  return restore_;
}

inline
const ShortReferenceMap *UsemapEvent::map() const
{
  return map_;
}

inline
const StringC &StartSubsetEvent::name() const
{
  return name_;
}

inline
const ConstPtr<Entity> &StartSubsetEvent::entity() const
{
  return entity_;
}

inline
Boolean StartSubsetEvent::hasInternalSubset() const
{
  return hasInternalSubset_;
}

inline
Boolean StartLpdEvent::active() const
{
  return active_;
}

inline
const Dtd &EndDtdEvent::dtd() const
{
  return *dtd_;
}

inline
const ConstPtr<Dtd> &EndDtdEvent::dtdPointer() const
{
  return dtd_;
}

inline
const Lpd &EndLpdEvent::lpd() const
{
  return *lpd_;
}

inline
const ConstPtr<Lpd> &EndLpdEvent::lpdPointer() const
{
  return lpd_;
}

inline
const Dtd &EndPrologEvent::dtd() const
{
  return *dtd_;
}

inline
const ConstPtr<Dtd> &EndPrologEvent::dtdPointer() const
{
  return dtd_;
}

inline
const ConstPtr<ComplexLpd> &EndPrologEvent::lpdPointer() const
{
  return lpd_;
}

inline
const Vector<StringC> &EndPrologEvent::simpleLinkNames() const
{
  return simpleLinkNames_;
}

inline
const Vector<AttributeList> &EndPrologEvent::simpleLinkAttributes() const
{
  return simpleLinkAttributes_;
}

inline
const Sd &SgmlDeclEvent::sd() const
{
  return *sd_;
}

inline
const ConstPtr<Sd> &SgmlDeclEvent::sdPointer() const
{
  return sd_;
}

inline
const ConstPtr<Sd> &SgmlDeclEvent::refSdPointer() const
{
  return refSd_;
}

inline
const Syntax &SgmlDeclEvent::prologSyntax() const
{
  return *prologSyntax_;
}

inline
const ConstPtr<Syntax> &SgmlDeclEvent::prologSyntaxPointer() const
{
  return prologSyntax_;
}

inline
const Syntax &SgmlDeclEvent::instanceSyntax() const
{
  return *instanceSyntax_;
}

inline
const ConstPtr<Syntax> &SgmlDeclEvent::instanceSyntaxPointer() const
{
  return instanceSyntax_;
}

inline
const ConstPtr<Syntax> &SgmlDeclEvent::refSyntaxPointer() const
{
  return refSyntax_;
}

inline
const StringC &SgmlDeclEvent::implySystemId() const
{
  return implySystemId_;
}

inline
Char IgnoredRsEvent::rs() const
{
  return c_;
}

inline
Char IgnoredReEvent::re() const
{
  return c_;
}

inline
unsigned long IgnoredReEvent::serial() const
{
  return serial_;
}

inline
Char ReOriginEvent::re() const
{
  return c_;
}

inline
unsigned long ReOriginEvent::serial() const
{
  return serial_;
}

inline
MarkedSectionEvent::Status MarkedSectionEvent::status() const
{
  return status_;
}

inline
const Entity *EntityStartEvent::entity() const
{
  return origin_->entity();
}

inline
const ConstPtr<EntityOrigin> &
EntityStartEvent::entityOrigin() const
{
  return origin_;
}

inline
const ConstPtr<Entity> &EntityDeclEvent::entityPointer() const
{
  return entity_;
}

inline
const Entity &EntityDeclEvent::entity() const
{
  return *entity_;
}

inline
Boolean EntityDeclEvent::ignored() const
{
  return ignored_;
}

inline
const Notation &NotationDeclEvent::notation() const
{
  return *notation_;
}

inline
const ConstPtr<Notation> &NotationDeclEvent::notationPointer() const
{
  return notation_;
}

inline
const Vector<const ElementType *> &ElementDeclEvent::elements() const
{
  return elements_;
}

inline
const Vector<const ElementType *> &AttlistDeclEvent::elements() const
{
  return elements_;
}

inline
const Vector<const ElementType *> &LinkAttlistDeclEvent::elements() const
{
  return elements_;
}

inline
const Lpd &LinkAttlistDeclEvent::lpd() const
{
  return *lpd_;
}

inline
const LinkSet *LinkDeclEvent::linkSet() const
{
  return linkSet_;
}

inline
const ComplexLpd &LinkDeclEvent::lpd() const
{
  return *lpd_;
}

inline
const ComplexLpd &IdLinkDeclEvent::lpd() const
{
  return *lpd_;
}

inline
const Vector<ConstPtr<Notation> > &
AttlistNotationDeclEvent::notations() const
{
  return notations_;
}

inline
const ShortReferenceMap *ShortrefDeclEvent::map() const
{
  return map_;
}

inline
const Entity &EntityDefaultedEvent::entity() const
{
  return *entity_;
}

inline
const ConstPtr<Entity> &EntityDefaultedEvent::entityPointer()
     const
{
  return entity_;
}

inline
const PublicId &SgmlDeclEntityEvent::publicId() const
{
  return publicId_;
}

inline
PublicId::TextClass SgmlDeclEntityEvent::entityType() const
{
  return entityType_;
}

inline
const StringC &SgmlDeclEntityEvent::effectiveSystemId() const
{
  return effectiveSystemId_;
}

#ifdef SP_NAMESPACE
}
#endif

#endif /* not Event_INCLUDED */