00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
#ifndef VTK_EXPAT_BASE_H_
00017
# define VTK_EXPAT_BASE_H_
00018
# include "vtkExtensionsObject.h"
00019
# include "vtkExtensionsTypes.h"
00020
# include "vtkExpatw.h"
00021
# include <assert.h>
00022
00023
VTK_EXTENSIONS_NAMESPACE_BEGIN
00024
00025
class vtkExpatBaseInternal;
00026
00058 class VTK_EXTENSIONS_COMMON_EXPORT vtkExpatBase :
public vtkExtensionsObject
00059 {
00060
public:
00061 vtkTypeRevisionMacro (vtkExpatBase,
vtkExtensionsObject);
00062
void PrintSelf (ostream&,
vtkIndent);
00063
00065
static void PrintExpatFeatures (ostream&,
vtkIndent);
00066
00068
int Parse (
void);
00069
00072
void SetStream (istream*);
00073 istream* GetStream (
void)
const;
00078
void SetFileName (
const char* name);
00079
const char* GetFileName (
void)
const;
00084
virtual int CanReadFile (
const char* name);
00085
int CanReadFile (
void);
00090
void SetInputString (
const char*);
00091
const char* GetInputString (
void)
const;
00095
int GetInputStringLength (
void)
const;
00096
00101
00164 virtual void ElementDecl (
const XML_Char* name, XML_Content* model) {}
00165
00185 virtual void AttlistDecl (
const XML_Char* elname,
00186
const XML_Char* attname,
00187
const XML_Char* attType,
00188
const XML_Char* defaultValue,
00189
int isRequired) {}
00190
00200 virtual void XmlDecl (
const XML_Char* version,
00201
const XML_Char* encoding,
00202
int standalone) {}
00203
00224 virtual void EntityDecl (
const XML_Char* entityName,
00225
int isParameterEntity,
00226
const XML_Char* value,
00227
int valueLength,
00228
const XML_Char* base,
00229
const XML_Char* systemId,
00230
const XML_Char* publicId,
00231
const XML_Char* notationName) {}
00232
00241 virtual void StartElement (
const XML_Char* name,
const XML_Char** attrs) {}
00242
00248 virtual void EndElement (
const XML_Char* name) {}
00249
00259 virtual void CharacterData (
const XML_Char* data,
int len) {}
00260
00267 virtual void ProcessingInstruction (
const XML_Char* target,
00268
const XML_Char* data) {}
00269
00274 virtual void Comment (
const XML_Char* data) {}
00275
00278 virtual void StartCdataSection (
void) {}
00279
00282 virtual void EndCdataSection (
void) {}
00283
00297 virtual void Default (
const XML_Char* data,
int len) {}
00298
00306 virtual void StartDoctypeDecl (
const XML_Char* doctypeName,
00307
const XML_Char* systemId,
00308
const XML_Char* publicId,
00309
int hasInternalSubset) {}
00310
00315 virtual void EndDoctypeDecl (
void) {}
00316
00328 void UnparsedEntityDecl (
const XML_Char* aEntityName,
00329
const XML_Char* aBase,
00330
const XML_Char* aSystemId,
00331
const XML_Char* aPublicId,
00332
const XML_Char* aNotationName)
00333 {EntityDecl(aEntityName,0,NULL,0,aBase,aSystemId,aPublicId,aNotationName);}
00334
00340 virtual void NotationDecl (
const XML_Char* notationName,
00341
const XML_Char* base,
00342
const XML_Char* systemId,
00343
const XML_Char* publicId) {}
00344
00357 virtual void StartNamespaceDecl (
const XML_Char* prefix,
00358
const XML_Char* uri) {}
00359
00372 virtual void EndNamespaceDecl (
const XML_Char* prefix) {}
00373
00385 virtual int NotStandalone (
void) {
return XML_STATUS_OK; }
00386
00420 virtual int ExternalEntityRef (
const XML_Char* context,
00421
const XML_Char* base,
00422
const XML_Char* systemId,
00423
const XML_Char* publicId)
00424 {
return XML_STATUS_OK; }
00425
00447 virtual void SkippedEntity (
const XML_Char* entityName,
00448
int isParameterEntity) {}
00449
00481 virtual int UnknownEncoding (
const XML_Char* vtkNotUsed(name),
00482 XML_Encoding* vtkNotUsed(info))
00483 {
return 0; }
00484
00487
protected:
00494
00519 inline XML_Parser ExternalEntityParserCreate (
const XML_Char* aContext,
00520
const XML_Char* aEncoding)
00521 {return ::XML_ExternalEntityParserCreate(this->Parser,aContext,aEncoding);}
00533 inline XML_Status XML_Parse (
const char* aBuf,
00534
int aLen,
00535
int aIsFinal)
00536 {
00537 this->NeverParsed =
false;
00538 XML_Status result = ::XML_Parse(this->Parser, aBuf, aLen, aIsFinal);
00539
if (aIsFinal) this->CheckFinalStatus(result);
00540
return result;
00541 }
00566 inline XML_Error GetParserErrorCode (
void)
00567 { return ::XML_GetErrorCode(this->Parser); }
00568
00574 static inline const XML_LChar* GetParserErrorString (XML_Error aCode)
00575 { return ::XML_ErrorString(aCode); }
00576
00581 inline int GetCurrentLineNumber (
void)
00582 { return ::XML_GetCurrentLineNumber(this->Parser); }
00583
00588 inline int GetCurrentColumnNumber (
void)
00589 { return ::XML_GetCurrentColumnNumber(this->Parser); }
00590
00596 inline long GetCurrentByteIndex (
void)
00597 { return ::XML_GetCurrentByteIndex(this->Parser); }
00598
00606 inline int GetCurrentByteCount (
void)
00607 { return ::XML_GetCurrentByteCount(this->Parser); }
00608
00621 inline const char* GetInputContext (
int* aOffsetPtr,
00622
int* aSizePtr)
00623 { return ::XML_GetInputContext(this->Parser, aOffsetPtr, aSizePtr); }
00629 inline void GrabInternalParser (
void)
00630 { assert(this->Parser != NULL); ::XML_SetUserData(this->Parser,
this); }
00631
00643 inline XML_Status SetBase (
const XML_Char* aBase)
00644 { return ::XML_SetBase(this->Parser, aBase); }
00645
00647 inline const XML_Char* GetBase (
void)
00648 { return ::XML_GetBase(this->Parser); }
00649
00658 inline int GetSpecifiedAttributeCount (
void)
00659 { return ::XML_GetSpecifiedAttributeCount(this->Parser); }
00660
00671 inline int GetIdAttributeIndex (
void)
00672 { return ::XML_GetIdAttributeIndex(this->Parser); }
00673
00681 inline XML_Status SetEncoding (
const XML_Char* aEncoding)
00682 { return ::XML_SetEncoding(this->Parser, aEncoding); }
00683
00708 inline int SetParamEntityParsing (XML_ParamEntityParsing a)
00709 { return ::XML_SetParamEntityParsing(this->Parser, a); }
00710
00732 inline XML_Error UseForeignDTD (XML_Bool aToggle)
00733 { return ::XML_UseForeignDTD(this->Parser, aToggle); }
00734
00751 inline void SetReturnNSTriplet (
int aToggle)
00752 { ::XML_SetReturnNSTriplet(this->Parser, aToggle); }
00753
00761 inline void DefaultCurrent (
void)
00762 { ::XML_DefaultCurrent(this->Parser); }
00763
00765 inline void FreeContentModel (XML_Content* aModel)
00766 { ::XML_FreeContentModel(this->Parser, aModel); }
00767
00769
00770
00771
public:
00772
00776 static inline const XML_LChar* GetExpatVersion (
void)
00777 { return ::XML_ExpatVersion(); }
00778
00783 static inline XML_Expat_Version GetExpatVersionInfo (
void)
00784 { return ::XML_ExpatVersionInfo(); }
00785
00837 static inline const XML_Feature* GetExpatFeatureList (
void)
00838 { return ::XML_GetFeatureList(); }
00840
00841
00842
protected:
00849
virtual void ReleaseParser (
void);
00850
00860
virtual void ResetParser (
void);
00861
00866
virtual void SetupHandlers (
void);
00874 virtual void CheckFinalStatus (XML_Status) {}
00875
00876
protected:
00877
00880
00893
static int GetAttributeVector (
const XML_Char*
const& target,
00894
const XML_Char**
const& attrs,
00895
unsigned int const& len,
00896
int* & data);
00897
00910
static int GetAttributeVector (
const XML_Char*
const& target,
00911
const XML_Char**
const& attrs,
00912
unsigned int const& len,
00913
float* & data);
00914
00927
static int GetAttributeVector (
const XML_Char*
const& target,
00928
const XML_Char**
const& attrs,
00929
unsigned int const& len,
00930
double* & data);
00931
00944
static int GetAttributeVector (
const XML_Char*
const& target,
00945
const XML_Char**
const& attrs,
00946
unsigned int const& len,
00947
unsigned int* & data);
00948
00965
static int GetAttributeValue (
const XML_Char*
const& target,
00966
const XML_Char**
const& attrs,
00967
const XML_Char* & result);
00968
00983
static int GetAttributeValue (
const XML_Char*
const& target,
00984
const XML_Char**
const& attrs,
00985
const char* & result);
00986
00998
static int GetAttributeValue (
const XML_Char*
const& target,
00999
const XML_Char**
const& attrs,
01000
int & result);
01001
01013
static int GetAttributeValue (
const XML_Char*
const& target,
01014
const XML_Char**
const& attrs,
01015
float & result);
01016
01028
static int GetAttributeValue (
const XML_Char*
const& target,
01029
const XML_Char**
const& attrs,
01030
double & result);
01031
01043
static int GetAttributeValue (
const XML_Char*
const& target,
01044
const XML_Char**
const& attrs,
01045
unsigned int & result);
01046
01058
static int GetAttributeValue (
const XML_Char*
const& target,
01059
const XML_Char**
const& attrs,
01060
bool & result);
01061
01063
static int EmptyCharacterData (
const XML_Char* data,
01064
int len);
01065
01067
static int SkipWhiteSpace (
const char* data);
01068
01070
static int SkipWhiteSpace (
const XML_Char* data);
01071
01073
01074
01075
public:
01076
01079
01080
static inline void ElementDeclCb (
void* userData,
01081
const XML_Char* name,
01082 XML_Content* model);
01083
01084
static inline void AttlistDeclCb (
void* userData,
01085
const XML_Char* elname,
01086
const XML_Char* attname,
01087
const XML_Char* attType,
01088
const XML_Char* defaultValue,
01089
int isRequired);
01090
01091
static inline void XmlDeclCb (
void* userData,
01092
const XML_Char* version,
01093
const XML_Char* encoding,
01094
int standalone);
01095
01096
static inline void EntityDeclCb (
void* userData,
01097
const XML_Char* entityName,
01098
int isParameterEntity,
01099
const XML_Char* value,
01100
int valueLength,
01101
const XML_Char* base,
01102
const XML_Char* systemId,
01103
const XML_Char* publicId,
01104
const XML_Char* notationName);
01105
01106
static inline void StartElementCb (
void* userData,
01107
const XML_Char* name,
01108
const XML_Char** attrs);
01109
01110
static inline void EndElementCb (
void* userData,
01111
const XML_Char* name);
01112
01113
static inline void CharacterDataCb (
void* userData,
01114
const XML_Char* data,
01115
int len);
01116
01117
static inline void ProcessingInstructionCb (
void* userData,
01118
const XML_Char* target,
01119
const XML_Char* data);
01120
01121
static inline void CommentCb (
void* userData,
01122
const XML_Char* data);
01123
01124
static inline void StartCdataSectionCb (
void* userData);
01125
01126
static inline void EndCdataSectionCb (
void* userData);
01127
01128
static inline void DefaultCb (
void* userData,
01129
const XML_Char* data,
01130
int len);
01131
01132
static inline void StartDoctypeDeclCb (
void* userData,
01133
const XML_Char* doctypeName,
01134
const XML_Char* aSysid,
01135
const XML_Char* aPubid,
01136
int hasInternalSubset);
01137
01138
static inline void EndDoctypeDeclCb (
void* userData);
01139
01140
static inline void UnparsedEntityDeclCb (
void* userData,
01141
const XML_Char* entityName,
01142
const XML_Char* base,
01143
const XML_Char* systemId,
01144
const XML_Char* publicId,
01145
const XML_Char* notationName);
01146
01147
static inline void NotationDeclCb (
void* userData,
01148
const XML_Char* notationName,
01149
const XML_Char* base,
01150
const XML_Char* systemId,
01151
const XML_Char* publicId);
01152
01153
static inline void StartNamespaceDeclCb (
void* userData,
01154
const XML_Char* prefix,
01155
const XML_Char* uri);
01156
01157
static inline void EndNamespaceDeclCb (
void* userData,
01158
const XML_Char* prefix);
01159
01160
static inline int NotStandaloneCb (
void* userData);
01161
01162
static inline int ExternalEntityRefCb (XML_Parser parser,
01163
const XML_Char* context,
01164
const XML_Char* base,
01165
const XML_Char* systemId,
01166
const XML_Char* publicId);
01167
01168
static inline void SkippedEntityCb (
void* userData,
01169
const XML_Char* entityName,
01170
int isParameterEntity);
01171
01172
static inline int UnknownEncodingCb (
void* encodingHandlerData,
01173
const XML_Char* name,
01174 XML_Encoding* info);
01175
01177
01178
01179
protected:
01180
01183
01184
inline void
01185 SetElementDeclHandler (XML_ElementDeclHandler a = ElementDeclCb)
01186 { ::XML_SetElementDeclHandler(this->Parser, a); }
01187
01188
inline void
01189 SetAttlistDeclHandler (XML_AttlistDeclHandler a = AttlistDeclCb)
01190 { ::XML_SetAttlistDeclHandler(this->Parser, a); }
01191
01192
inline void
01193 SetXmlDeclHandler (XML_XmlDeclHandler a = XmlDeclCb)
01194 { ::XML_SetXmlDeclHandler(this->Parser, a); }
01195
01196
inline void
01197 SetEntityDeclHandler (XML_EntityDeclHandler a = EntityDeclCb)
01198 { ::XML_SetEntityDeclHandler(this->Parser, a); }
01199
01200
inline void
01201 SetElementHandler (XML_StartElementHandler a1 = StartElementCb,
01202 XML_EndElementHandler a2 = EndElementCb)
01203 { ::XML_SetElementHandler(this->Parser, a1, a2); }
01204
01205
inline void
01206 SetStartElementHandler (XML_StartElementHandler a = StartElementCb)
01207 { ::XML_SetStartElementHandler(this->Parser, a); }
01208
01209
inline void
01210 SetEndElementHandler (XML_EndElementHandler a = EndElementCb)
01211 { ::XML_SetEndElementHandler(this->Parser, a); }
01212
01213
inline void
01214 SetCharacterDataHandler (XML_CharacterDataHandler a = CharacterDataCb)
01215 { ::XML_SetCharacterDataHandler(this->Parser, a); }
01216
01217
inline void
01218 SetProcessingInstructionHandler (XML_ProcessingInstructionHandler a =
01219 ProcessingInstructionCb)
01220 { ::XML_SetProcessingInstructionHandler(this->Parser, a); }
01221
01222
inline void
01223 SetCommentHandler (XML_CommentHandler a = CommentCb)
01224 { ::XML_SetCommentHandler(this->Parser, a); }
01225
01226
inline void
01227 SetCdataSectionHandler (XML_StartCdataSectionHandler a1 =
01228 StartCdataSectionCb,
01229 XML_EndCdataSectionHandler a2 =
01230 EndCdataSectionCb)
01231 { ::XML_SetCdataSectionHandler(this->Parser, a1, a2); }
01232
01233
inline void
01234 SetStartCdataSectionHandler (XML_StartCdataSectionHandler a =
01235 StartCdataSectionCb)
01236 { ::XML_SetStartCdataSectionHandler(this->Parser, a); }
01237
01238
inline void
01239 SetEndCdataSectionHandler (XML_EndCdataSectionHandler a =
01240 EndCdataSectionCb)
01241 { ::XML_SetEndCdataSectionHandler(this->Parser, a); }
01242
01243
inline void
01244 SetDefaultHandler (XML_DefaultHandler a = DefaultCb)
01245 { ::XML_SetDefaultHandler(this->Parser, a); }
01246
01247
inline void
01248 SetDefaultHandlerExpand (XML_DefaultHandler a = DefaultCb)
01249 { ::XML_SetDefaultHandlerExpand(this->Parser, a); }
01250
01251
inline void
01252 SetDoctypeDeclHandler (XML_StartDoctypeDeclHandler a1 =
01253 StartDoctypeDeclCb,
01254 XML_EndDoctypeDeclHandler a2 =
01255 EndDoctypeDeclCb)
01256 { ::XML_SetDoctypeDeclHandler(this->Parser, a1, a2); }
01257
01258
inline void
01259 SetStartDoctypeDeclHandler (XML_StartDoctypeDeclHandler a =
01260 StartDoctypeDeclCb)
01261 { ::XML_SetStartDoctypeDeclHandler(this->Parser, a); }
01262
01263
inline void
01264 SetEndDoctypeDeclHandler (XML_EndDoctypeDeclHandler a =
01265 EndDoctypeDeclCb)
01266 { ::XML_SetEndDoctypeDeclHandler(this->Parser, a); }
01267
01268
inline void
01269 SetUnparsedEntityDeclHandler (XML_UnparsedEntityDeclHandler a =
01270 UnparsedEntityDeclCb)
01271 { ::XML_SetUnparsedEntityDeclHandler(this->Parser, a); }
01272
01273
inline void
01274 SetNotationDeclHandler (XML_NotationDeclHandler a = NotationDeclCb)
01275 { ::XML_SetNotationDeclHandler(this->Parser, a); }
01276
01277
inline void
01278 SetNamespaceDeclHandler (XML_StartNamespaceDeclHandler a1 =
01279 StartNamespaceDeclCb,
01280 XML_EndNamespaceDeclHandler a2 =
01281 EndNamespaceDeclCb)
01282 { ::XML_SetNamespaceDeclHandler(this->Parser, a1, a2); }
01283
01284
inline void
01285 SetStartNamespaceDeclHandler (XML_StartNamespaceDeclHandler a =
01286 StartNamespaceDeclCb)
01287 { ::XML_SetStartNamespaceDeclHandler(this->Parser, a); }
01288
01289
inline void
01290 SetEndNamespaceDeclHandler (XML_EndNamespaceDeclHandler a =
01291 EndNamespaceDeclCb)
01292 { ::XML_SetEndNamespaceDeclHandler(this->Parser, a); }
01293
01294
inline void
01295 SetNotStandaloneHandler (XML_NotStandaloneHandler a = NotStandaloneCb)
01296 { ::XML_SetNotStandaloneHandler(this->Parser, a); }
01297
01298
inline void
01299 SetExternalEntityRefHandler (XML_ExternalEntityRefHandler a =
01300 ExternalEntityRefCb)
01301 { ::XML_SetExternalEntityRefHandler(this->Parser, a); }
01302
01303
inline void
01304 SetExternalEntityRefHandlerArg (
void* a)
01305 { ::XML_SetExternalEntityRefHandlerArg(this->Parser, a); }
01306
01307
inline void
01308 SetExternalEntityRefHandlerArg (
void)
01309 { this->SetExternalEntityRefHandlerArg((
void *)
this); }
01310
01311
inline void
01312 SetSkippedEntityHandler (XML_SkippedEntityHandler a = SkippedEntityCb)
01313 { ::XML_SetSkippedEntityHandler(this->Parser, a); }
01314
01315
inline void
01316 SetUnknownEncodingHandler (XML_UnknownEncodingHandler a =
01317 UnknownEncodingCb)
01318 { ::XML_SetUnknownEncodingHandler(this->Parser, a, this->EncodingData); }
01319
01321
01322
01323
protected:
01338 vtkExpatBase (
int createParser = VTK_TRUE);
01339
01341
virtual ~vtkExpatBase();
01345 inline operator XML_Parser()
const {
return this->Parser; }
01346
01348 XML_Parser Parser;
01349
01351 void* EncodingData;
01352
01354 int NeverParsed;
01355
01356
private:
01357 vtkExpatBaseInternal* Internal;
01358
01359
protected:
01363
virtual int InputInitialize (
void);
01364
01366
virtual void InputFinalize (
void);
01367
01372
virtual int ParseXML (
void);
01373
01380
virtual int ParsingComplete (
void);
01381
01382
virtual int ReadData (
void);
01385
private:
01391 vtkExpatBase (
const vtkExpatBase&);
01392
void operator= (
const vtkExpatBase&);
01394 };
01395
01396
01397
01398
01399
01400
inline void
01401 vtkExpatBase::StartElementCb (
void* aUserData,
01402
const XML_Char* aName,
01403
const XML_Char** aAttrs)
01404 {
01405 (reinterpret_cast<vtkExpatBase*>(aUserData))->StartElement(aName, aAttrs);
01406 }
01407
01408
inline void
01409 vtkExpatBase::EndElementCb (
void* aUserData,
01410
const XML_Char* aName)
01411 {
01412 (reinterpret_cast<vtkExpatBase*>(aUserData))->EndElement(aName);
01413 }
01414
01415
inline void
01416 vtkExpatBase::CharacterDataCb (
void* aUserData,
01417
const XML_Char* aData,
01418
int aLen)
01419 {
01420 (reinterpret_cast<vtkExpatBase*>(aUserData))->CharacterData(aData, aLen);
01421 }
01422
01423
inline void
01424 vtkExpatBase::ProcessingInstructionCb (
void* aUserData,
01425
const XML_Char* aTarget,
01426
const XML_Char* aData)
01427 {
01428 (reinterpret_cast<vtkExpatBase*>(aUserData))->
01429 ProcessingInstruction(aTarget, aData);
01430 }
01431
01432
inline void
01433 vtkExpatBase::CommentCb (
void* aUserData,
01434
const XML_Char* aData)
01435 {
01436 (reinterpret_cast<vtkExpatBase*>(aUserData))->Comment(aData);
01437 }
01438
01439
inline void
01440 vtkExpatBase::StartCdataSectionCb (
void* aUserData)
01441 {
01442 (reinterpret_cast<vtkExpatBase*>(aUserData))->StartCdataSection();
01443 }
01444
01445
inline void
01446 vtkExpatBase::EndCdataSectionCb (
void* aUserData)
01447 {
01448 (reinterpret_cast<vtkExpatBase*>(aUserData))->EndCdataSection();
01449 }
01450
01451
inline int
01452 vtkExpatBase::ExternalEntityRefCb (XML_Parser aParser,
01453
const XML_Char* aContext,
01454
const XML_Char* aBase,
01455
const XML_Char* aSystemId,
01456
const XML_Char* aPublicId)
01457 {
01458
01459
01460
01461
01462
01463
01464
01465
return (reinterpret_cast<vtkExpatBase*>(XML_GetUserData(aParser)))->
01466 ExternalEntityRef(aContext, aBase, aSystemId, aPublicId);
01467 }
01468
01469
inline void
01470 vtkExpatBase::DefaultCb (
void* aUserData,
01471
const XML_Char* aData,
01472
int aLen)
01473 {
01474 (reinterpret_cast<vtkExpatBase*>(aUserData))->Default(aData, aLen);
01475 }
01476
01477
inline void
01478 vtkExpatBase::SkippedEntityCb (
void* aUserData,
01479
const XML_Char* aEntityName,
01480
int aIsParameterEntity)
01481 {
01482 (reinterpret_cast<vtkExpatBase*>(aUserData))->
01483 SkippedEntity(aEntityName, aIsParameterEntity);
01484 }
01485
01486
inline int
01487 vtkExpatBase::UnknownEncodingCb (
void* aEncodingHandlerData,
01488
const XML_Char* aName,
01489 XML_Encoding* aInfo)
01490 {
01491
return (reinterpret_cast<vtkExpatBase*>(aEncodingHandlerData))->
01492 UnknownEncoding(aName, aInfo);
01493 }
01494
01495
inline void
01496 vtkExpatBase::StartNamespaceDeclCb (
void* aUserData,
01497
const XML_Char* aPrefix,
01498
const XML_Char* aURI)
01499 {
01500 (reinterpret_cast<vtkExpatBase*>(aUserData))->
01501 StartNamespaceDecl(aPrefix, aURI);
01502 }
01503
01504
inline void
01505 vtkExpatBase::EndNamespaceDeclCb (
void* aUserData,
01506
const XML_Char* aPrefix)
01507 {
01508 (reinterpret_cast<vtkExpatBase*>(aUserData))->EndNamespaceDecl(aPrefix);
01509 }
01510
01511
inline void
01512 vtkExpatBase::XmlDeclCb (
void* aUserData,
01513
const XML_Char* aVersion,
01514
const XML_Char* aEncoding,
01515
int aStandalone)
01516 {
01517 (reinterpret_cast<vtkExpatBase*>(aUserData))->
01518 XmlDecl(aVersion, aEncoding, aStandalone);
01519 }
01520
01521
inline void
01522 vtkExpatBase::StartDoctypeDeclCb (
void* aUserData,
01523
const XML_Char* aDoctypeName,
01524
const XML_Char* aSystemId,
01525
const XML_Char* aPublicId,
01526
int aHasInternalSubset)
01527 {
01528 (reinterpret_cast<vtkExpatBase*>(aUserData))->
01529 StartDoctypeDecl(aDoctypeName, aSystemId, aPublicId, aHasInternalSubset);
01530 }
01531
01532
inline void
01533 vtkExpatBase::EndDoctypeDeclCb (
void* aUserData)
01534 {
01535 (reinterpret_cast<vtkExpatBase*>(aUserData))->EndDoctypeDecl();
01536 }
01537
01538
inline void
01539 vtkExpatBase::ElementDeclCb (
void* aUserData,
01540
const XML_Char* aName,
01541 XML_Content* aModel)
01542 {
01543 (reinterpret_cast<vtkExpatBase*>(aUserData))->ElementDecl(aName, aModel);
01544 }
01545
01546
inline void
01547 vtkExpatBase::AttlistDeclCb (
void* aUserData,
01548
const XML_Char* aElname,
01549
const XML_Char* aAttname,
01550
const XML_Char* aAttType,
01551
const XML_Char* aDefault,
01552
int aIsRequired)
01553 {
01554 (reinterpret_cast<vtkExpatBase*>(aUserData))->
01555 AttlistDecl(aElname, aAttname, aAttType, aDefault, aIsRequired);
01556 }
01557
01558
inline void
01559 vtkExpatBase::EntityDeclCb (
void* aUserData,
01560
const XML_Char* aEntityName,
01561
int aIsParameterEntity,
01562
const XML_Char* aValue,
01563
int aValueLength,
01564
const XML_Char* aBase,
01565
const XML_Char* aSystemId,
01566
const XML_Char* aPublicId,
01567
const XML_Char* aNotationName)
01568 {
01569 (reinterpret_cast<vtkExpatBase*>(aUserData))->
01570 EntityDecl( aEntityName, aIsParameterEntity,
01571 aValue, aValueLength,
01572 aBase, aSystemId, aPublicId, aNotationName );
01573 }
01574
01575
inline void
01576 vtkExpatBase::UnparsedEntityDeclCb (
void* aUserData,
01577
const XML_Char* aEntityName,
01578
const XML_Char* aBase,
01579
const XML_Char* aSystemId,
01580
const XML_Char* aPublicId,
01581
const XML_Char* aNotationName)
01582 {
01583 (reinterpret_cast<vtkExpatBase*>(aUserData))->
01584 UnparsedEntityDecl(aEntityName, aBase, aSystemId, aPublicId, aNotationName);
01585 }
01586
01587
inline void
01588 vtkExpatBase::NotationDeclCb (
void* aUserData,
01589
const XML_Char* aNotationName,
01590
const XML_Char* aBase,
01591
const XML_Char* aSystemId,
01592
const XML_Char* aPublicId)
01593 {
01594 (reinterpret_cast<vtkExpatBase*>(aUserData))->
01595 NotationDecl(aNotationName, aBase, aSystemId, aPublicId);
01596 }
01597
01598
inline int
01599 vtkExpatBase::NotStandaloneCb (
void* aUserData)
01600 {
01601
return (reinterpret_cast<vtkExpatBase*>(aUserData))->NotStandalone();
01602 }
01603
01604
VTK_EXTENSIONS_NAMESPACE_END
01605
01606
01607
# if defined(VTK_EXTENSIONS_BUILD_DEBUG)
01608
# include "vtkStringOps.h"
01609
01610
# define VTK_EXPAT_DEBUG_BEGIN_MACRO(_method) \
01611
VTK_EXTENSIONS_BEGIN_MACRO \
01612
if (this->Debug && vtkObject::GetGlobalWarningDisplay()) \
01613
{ \
01614
vtkOStreamWrapper::EndlType endl; \
01615
vtkOStreamWrapper::UseEndl(endl); \
01616
vtkOStrStreamWrapper oss; \
01617
\
01618
oss << "Debug: In " __FILE__ ", line " << __LINE__ << "\n"; \
01619
oss << this->GetClassName() << "(" << this << ")::"; \
01620
oss << _method << "("
01621
01622
# define VTK_EXPAT_DEBUG_END_MACRO \
01623
oss << ")\n\n"; \
01624
vtkOutputWindowDisplayDebugText(oss.str()); \
01625
oss.rdbuf()->freeze(0); \
01626
} \
01627
VTK_EXTENSIONS_END_MACRO
01628
01629
# define VTK_EXPAT_DEBUG_START_ELEMENT(_elem, _attrs) \
01630
VTK_EXPAT_DEBUG_BEGIN_MACRO("StartElement"); \
01631
oss << "'" << vtkStringOps::ToLatin1(_elem) << "',"; \
01632
\
01633
if ((_attrs) == NULL) { oss << " (null)"; } \
01634
else \
01635
{ \
01636
const XML_Char** pp = (_attrs); \
01637
\
01638
oss << "'"; \
01639
while (*pp != NULL) \
01640
{ \
01641
oss << " " << vtkStringOps::ToLatin1(pp[0]) << "=\""; \
01642
oss << vtkStringOps::ToLatin1(pp[1]) << "\""; \
01643
pp += 2; \
01644
} \
01645
oss << "'"; \
01646
} \
01647
VTK_EXPAT_DEBUG_END_MACRO
01648
01649
# define VTK_EXPAT_DEBUG_END_ELEMENT(_elem) \
01650
VTK_EXPAT_DEBUG_BEGIN_MACRO("EndElement"); \
01651
oss << "'" << vtkStringOps::ToLatin1(_elem) << "'"; \
01652
VTK_EXPAT_DEBUG_END_MACRO
01653
01654
# define VTK_EXPAT_DEBUG_CHARACTER_DATA(_data, _len) \
01655
VTK_EXPAT_DEBUG_BEGIN_MACRO("CharacterData"); \
01656
XML_Char* tmp = new XML_Char[(_len) + 1]; \
01657
vtkStringOps::Janitor<XML_Char> janitor(tmp); \
01658
vtkStringOps::SubString(tmp, (_data), 0, (_len)); \
01659
oss << "'" << vtkStringOps::ToLatin1(tmp) << "', "; \
01660
oss << (_len); \
01661
VTK_EXPAT_DEBUG_END_MACRO
01662
01663
# define VTK_EXPAT_DEBUG_PROCESSING_INSTRUCTION(_target, _data) \
01664
VTK_EXPAT_DEBUG_BEGIN_MACRO("ProcessingInstruction"); \
01665
oss << "'" << vtkStringOps::ToLatin1(_target) << "', "; \
01666
oss << "'" << vtkStringOps::ToLatin1(_data) << "'"; \
01667
VTK_EXPAT_DEBUG_END_MACRO
01668
01669
# define VTK_EXPAT_DEBUG_COMMENT(_data) \
01670
VTK_EXPAT_DEBUG_BEGIN_MACRO("Comment"); \
01671
oss << "'" << vtkStringOps::ToLatin1(_data) << "'"; \
01672
VTK_EXPAT_DEBUG_END_MACRO
01673
01674
# define VTK_EXPAT_DEBUG_START_CDATA_SECTION() \
01675
VTK_EXPAT_DEBUG_BEGIN_MACRO("StartCdataSection"); \
01676
VTK_EXPAT_DEBUG_END_MACRO
01677
01678
# define VTK_EXPAT_DEBUG_END_CDATA_SECTION() \
01679
VTK_EXPAT_DEBUG_BEGIN_MACRO("EndCdataSection"); \
01680
VTK_EXPAT_DEBUG_END_MACRO
01681
01682
# define VTK_EXPAT_DEBUG_DEFAULT(_data, _len) \
01683
VTK_EXPAT_DEBUG_BEGIN_MACRO("Default"); \
01684
XML_Char* tmp = new XML_Char[(_len) + 1]; \
01685
vtkStringOps::Janitor<XML_Char> janitor(tmp); \
01686
vtkStringOps::SubString(tmp, (_data), 0, (_len)); \
01687
oss << "'" << vtkStringOps::ToLatin1(tmp) << "', "; \
01688
oss << (_len); \
01689
VTK_EXPAT_DEBUG_END_MACRO
01690
01691
# define VTK_EXPAT_DEBUG_EXTERNAL_ENTITY_REF(_ctx, _base, _sys, _pub) \
01692
VTK_EXPAT_DEBUG_BEGIN_MACRO("ExternalEntityRef"); \
01693
oss << "'" << vtkStringOps::ToLatin1(_ctx) << "', "; \
01694
oss << "'" << vtkStringOps::ToLatin1(_base) << "', "; \
01695
oss << "'" << vtkStringOps::ToLatin1(_sys) << "', "; \
01696
oss << "'" << vtkStringOps::ToLatin1(_pub) << "'"; \
01697
VTK_EXPAT_DEBUG_END_MACRO
01698
01699
# define VTK_EXPAT_DEBUG_SKIPPED_ENTITY(_name, _isparam) \
01700
VTK_EXPAT_DEBUG_BEGIN_MACRO("SkippedEntity"); \
01701
oss << "'" << vtkStringOps::ToLatin1(_name) << "', "; \
01702
oss << ((_isparam) ? "YES" : "NO"); \
01703
VTK_EXPAT_DEBUG_END_MACRO
01704
01705
# define VTK_EXPAT_DEBUG_UNKNOWN_ENCODING(_name, _info) \
01706
VTK_EXPAT_DEBUG_BEGIN_MACRO("UnknownEncoding"); \
01707
oss << "'" << vtkStringOps::ToLatin1(_name) << "', "; \
01708
oss << (void *) (_info); \
01709
VTK_EXPAT_DEBUG_END_MACRO
01710
01711
# define VTK_EXPAT_DEBUG_START_NAMESPACE_DECL(_pfx, _uri) \
01712
VTK_EXPAT_DEBUG_BEGIN_MACRO("StartNamespaceDecl"); \
01713
oss << "'" << vtkStringOps::ToLatin1(_pfx) << "', "; \
01714
oss << "'" << vtkStringOps::ToLatin1(_uri) << "'"; \
01715
VTK_EXPAT_DEBUG_END_MACRO
01716
01717
# define VTK_EXPAT_DEBUG_END_NAMESPACE_DECL(_pfx) \
01718
VTK_EXPAT_DEBUG_BEGIN_MACRO("EndNamespaceDecl"); \
01719
oss << "'" << vtkStringOps::ToLatin1(_pfx) << "'"; \
01720
VTK_EXPAT_DEBUG_END_MACRO
01721
01722
# define VTK_EXPAT_DEBUG_XML_DECL(_ver, _enc, _standalone) \
01723
VTK_EXPAT_DEBUG_BEGIN_MACRO("XmlDecl"); \
01724
oss << "'" << vtkStringOps::ToLatin1(_ver) << "', "; \
01725
oss << "'" << vtkStringOps::ToLatin1(_enc) << "', "; \
01726
oss << ((_standalone) ? "YES" : "NO"); \
01727
VTK_EXPAT_DEBUG_END_MACRO
01728
01729
# define VTK_EXPAT_DEBUG_START_DOCTYPE_DECL(_name, _sys, _pub, _intern) \
01730
VTK_EXPAT_DEBUG_BEGIN_MACRO("StartDoctypeDecl"); \
01731
oss << "'" << vtkStringOps::ToLatin1(_name) << "', "; \
01732
oss << "'" << vtkStringOps::ToLatin1(_sys) << "', "; \
01733
oss << "'" << vtkStringOps::ToLatin1(_pub) << "', "; \
01734
oss << ((_intern) ? "YES" : "NO"); \
01735
VTK_EXPAT_DEBUG_END_MACRO
01736
01737
# define VTK_EXPAT_DEBUG_END_DOCTYPE_DECL() \
01738
VTK_EXPAT_DEBUG_BEGIN_MACRO("EndDoctypeDecl"); \
01739
VTK_EXPAT_DEBUG_END_MACRO
01740
01741
# define VTK_EXPAT_DEBUG_ELEMENT_DECL(_name, _model) \
01742
VTK_EXPAT_DEBUG_BEGIN_MACRO("ElementDecl"); \
01743
oss << "'" << vtkStringOps::ToLatin1(_name) << "', "; \
01744
oss << (void *) (_model); \
01745
VTK_EXPAT_DEBUG_END_MACRO
01746
01747
# define VTK_EXPAT_DEBUG_ATTLIST_DECL(_elem, _attr, _type, _def, _req) \
01748
VTK_EXPAT_DEBUG_BEGIN_MACRO("AttlistDecl"); \
01749
oss << "'" << vtkStringOps::ToLatin1(_elem) << "', "; \
01750
oss << "'" << vtkStringOps::ToLatin1(_attr) << "', "; \
01751
oss << "'" << vtkStringOps::ToLatin1(_type) << "', "; \
01752
oss << "'" << vtkStringOps::ToLatin1(_def) << "', "; \
01753
oss << ((_req) ? "YES" : "NO"); \
01754
VTK_EXPAT_DEBUG_END_MACRO
01755
01756
# define VTK_EXPAT_DEBUG_ENTITY_DECL(_ent, _pe, _val, _vl, _b, _s, _p, _n) \
01757
VTK_EXPAT_DEBUG_BEGIN_MACRO("EntityDecl"); \
01758
oss << "'" << vtkStringOps::ToLatin1(_ent) << "', "; \
01759
oss << ((_pe) ? "YES" : "NO") << ", "; \
01760
XML_Char* tmp = new XML_Char[(_vl) + 1]; \
01761
vtkStringOps::Janitor<XML_Char> janitor(tmp); \
01762
vtkStringOps::SubString(tmp, (_val), 0, (_vl)); \
01763
oss << "'" << vtkStringOps::ToLatin1(tmp) << "', "; \
01764
oss << (_vl) << ", "; \
01765
oss << "'" << vtkStringOps::ToLatin1(_b) << "', "; \
01766
oss << "'" << vtkStringOps::ToLatin1(_s) << "', "; \
01767
oss << "'" << vtkStringOps::ToLatin1(_p) << "', "; \
01768
oss << "'" << vtkStringOps::ToLatin1(_n) << "'"; \
01769
VTK_EXPAT_DEBUG_END_MACRO
01770
01771
# define VTK_EXPAT_DEBUG_NOTATION_DECL(_note, _base, _sys, _pub) \
01772
VTK_EXPAT_DEBUG_BEGIN_MACRO("NotationDecl"); \
01773
oss << "'" << vtkStringOps::ToLatin1(_note) << "', "; \
01774
oss << "'" << vtkStringOps::ToLatin1(_base) << "', "; \
01775
oss << "'" << vtkStringOps::ToLatin1(_sys) << "', "; \
01776
oss << "'" << vtkStringOps::ToLatin1(_pub) << "'"; \
01777
VTK_EXPAT_DEBUG_END_MACRO
01778
01779
# define VTK_EXPAT_DEBUG_END_NOT_STANDALONE() \
01780
VTK_EXPAT_DEBUG_BEGIN_MACRO("NotStandalone"); \
01781
VTK_EXPAT_DEBUG_END_MACRO
01782
01783
# else
01784 # define VTK_EXPAT_DEBUG_START_ELEMENT(_elem, _attrs) ((void) 0)
01785 # define VTK_EXPAT_DEBUG_END_ELEMENT(_elem) ((void) 0)
01786 # define VTK_EXPAT_DEBUG_CHARACTER_DATA(_data, _len) ((void) 0)
01787 # define VTK_EXPAT_DEBUG_PROCESSING_INSTRUCTION(_target, _data) ((void) 0)
01788 # define VTK_EXPAT_DEBUG_COMMENT(_data) ((void) 0)
01789 # define VTK_EXPAT_DEBUG_START_CDATA_SECTION() ((void) 0)
01790 # define VTK_EXPAT_DEBUG_END_CDATA_SECTION() ((void) 0)
01791 # define VTK_EXPAT_DEBUG_DEFAULT(_data, _len) ((void) 0)
01792 # define VTK_EXPAT_DEBUG_EXTERNAL_ENTITY_REF(_ctx, _base, _sys, _pub) \
01793
((void) 0)
01794 # define VTK_EXPAT_DEBUG_SKIPPED_ENTITY(_name, _isparam) ((void) 0)
01795 # define VTK_EXPAT_DEBUG_UNKNOWN_ENCODING(_name, _info) ((void) 0)
01796 # define VTK_EXPAT_DEBUG_START_NAMESPACE_DECL(_pfx, _uri) ((void) 0)
01797 # define VTK_EXPAT_DEBUG_END_NAMESPACE_DECL(_pfx) ((void) 0)
01798 # define VTK_EXPAT_DEBUG_XML_DECL(_ver, _enc, _standalone) ((void) 0)
01799 # define VTK_EXPAT_DEBUG_START_DOCTYPE_DECL(_name, _sys, _pub, _intern) \
01800
((void) 0)
01801 # define VTK_EXPAT_DEBUG_END_DOCTYPE_DECL() ((void) 0)
01802 # define VTK_EXPAT_DEBUG_ELEMENT_DECL(_name, _model) ((void) 0)
01803 # define VTK_EXPAT_DEBUG_ATTLIST_DECL(_elem, _attr, _type, _def, _req) \
01804
((void) 0)
01805 # define VTK_EXPAT_DEBUG_ENTITY_DECL(_ent, _pe, _val, _vl, _b, _s, _p, _n) \
01806
((void) 0)
01807 # define VTK_EXPAT_DEBUG_NOTATION_DECL(_note, _base, _sys, _pub) ((void) 0)
01808 # define VTK_EXPAT_DEBUG_END_NOT_STANDALONE() ((void) 0)
01809
# endif
01810
01811
01812
#endif
01813
01814
01815
01816