SNAP Library 6.0, Developer Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
TXmlChDef Class Reference

#include <xml.h>

Collaboration diagram for TXmlChDef:

Public Member Functions

 TXmlChDef ()
 
 TXmlChDef (TSIn &SIn)
 
void Save (TSOut &SOut)
 
TXmlChDefoperator= (const TXmlChDef &)
 
bool IsChar (const uchar &Ch) const
 
bool IsComb (const uchar &Ch) const
 
bool IsExt (const uchar &Ch) const
 
bool IsLetter (const uchar &Ch) const
 
bool IsDigit (const uchar &Ch) const
 
bool IsName (const uchar &Ch) const
 
bool IsPubid (const uchar &Ch) const
 
bool IsWs (const uchar &Ch) const
 
bool IsFirstNameCh (const uchar &Ch) const
 
bool IsEoln (const uchar &Ch) const
 
bool IsEntityNm (const TStr &EntityNm, TStr &EntityVal) const
 

Static Public Member Functions

static PXmlChDef Load (TSIn &SIn)
 

Private Member Functions

void SetChTy (TBSet &ChSet, const int &MnCh, const int &MxCh=-1)
 
void SetChTy (TBSet &ChSet, const TStr &Str)
 
void SetEntityVal (const TStr &Nm, const TStr &Val)
 

Private Attributes

TCRef CRef
 
TInt Chs
 
TBSet CharChSet
 
TBSet CombChSet
 
TBSet ExtChSet
 
TBSet LetterChSet
 
TBSet DigitChSet
 
TBSet NameChSet
 
TBSet PubidChSet
 
TStrStrH EntityNmToValH
 

Friends

class TPt< TXmlChDef >
 

Detailed Description

Definition at line 42 of file xml.h.

Constructor & Destructor Documentation

TXmlChDef::TXmlChDef ( )

Definition at line 208 of file xml.cpp.

References CharChSet, Chs, CombChSet, DigitChSet, ExtChSet, TBSet::Gen(), LetterChSet, TUCh::Mx, NameChSet, PubidChSet, SetChTy(), and SetEntityVal().

208  :
209  Chs(TUCh::Vals),
210  CharChSet(), CombChSet(), ExtChSet(),
212  EntityNmToValH(100){
213 
214  // Character-Sets
215  // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | ...
216  CharChSet.Gen(Chs);
217  // ... because of DMoz (temporary patch)
218  SetChTy(CharChSet, 0x1); SetChTy(CharChSet, 0x3); SetChTy(CharChSet, 0x6);
220  // regular characters
221  SetChTy(CharChSet, 0x9); SetChTy(CharChSet, 0xA); SetChTy(CharChSet, 0xD);
222  SetChTy(CharChSet, 0x20, TUCh::Mx);
223  // BaseChar ::= [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] |
224  // [#x00D8-#x00F6] | [#x00F8-#x00FF] | ...
225  TBSet BaseChSet(Chs);
226  SetChTy(BaseChSet, 0x41, 0x5A); SetChTy(BaseChSet, 0x61, 0x7A);
227  SetChTy(BaseChSet, 0xC0, 0xD6); SetChTy(BaseChSet, 0xD8, 0xF6);
228  SetChTy(BaseChSet, 0xF8, 0xFF);
229  // Ideographic ::= ...
230  TBSet IdeoChSet(Chs);
231  // CombiningChar ::= ...
232  CombChSet.Gen(Chs);
233  // Extender ::= #x00B7 | ...
234  ExtChSet.Gen(Chs);
235  SetChTy(ExtChSet, 0xB7);
236  // Letter ::= BaseChar | Ideographic
237  LetterChSet=BaseChSet|IdeoChSet;
238  // Digit ::= [#x0030-#x0039] | ...
239  DigitChSet.Gen(Chs);
240  SetChTy(DigitChSet, 0x30, 0x39);
241  // NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar
243  uchar('.')|uchar('-')|uchar('_')|uchar(':')|CombChSet;
244  // PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
245  PubidChSet.Gen(Chs);
246  SetChTy(PubidChSet, 0x20); SetChTy(PubidChSet, 0xD); SetChTy(PubidChSet, 0xA);
247  SetChTy(PubidChSet, 'a', 'z'); SetChTy(PubidChSet, 'A', 'Z');
248  SetChTy(PubidChSet, '0', '9'); SetChTy(PubidChSet, "-'()+,./:=?;!*#@$_%");
249 
250  // Standard-Entity-Sequences
251  SetEntityVal("amp", "&");
252  SetEntityVal("lt", "<"); SetEntityVal("gt", ">");
253  SetEntityVal("apos", "'"); SetEntityVal("quot", "\"");
254 }
TBSet PubidChSet
Definition: xml.h:46
TBSet CharChSet
Definition: xml.h:45
Definition: bits.h:313
TInt Chs
Definition: xml.h:44
TStrStrH EntityNmToValH
Definition: xml.h:47
void SetChTy(TBSet &ChSet, const int &MnCh, const int &MxCh=-1)
Definition: xml.cpp:190
TBSet ExtChSet
Definition: xml.h:45
static const int Vals
Definition: dt.h:1099
void SetEntityVal(const TStr &Nm, const TStr &Val)
Definition: xml.cpp:204
TBSet CombChSet
Definition: xml.h:45
unsigned char uchar
Definition: bd.h:10
void Gen(const int &_Bits)
Definition: bits.cpp:182
TBSet NameChSet
Definition: xml.h:46
TBSet DigitChSet
Definition: xml.h:46
static const uchar Mx
Definition: dt.h:1098
TBSet LetterChSet
Definition: xml.h:46

Here is the call graph for this function:

TXmlChDef::TXmlChDef ( TSIn SIn)
inline

Definition at line 53 of file xml.h.

53  :
54  Chs(SIn),
55  CharChSet(SIn), CombChSet(SIn), ExtChSet(SIn),
56  LetterChSet(SIn), DigitChSet(SIn), NameChSet(SIn), PubidChSet(SIn),
57  EntityNmToValH(SIn){}
TBSet PubidChSet
Definition: xml.h:46
TBSet CharChSet
Definition: xml.h:45
TInt Chs
Definition: xml.h:44
TStrStrH EntityNmToValH
Definition: xml.h:47
TBSet ExtChSet
Definition: xml.h:45
TBSet CombChSet
Definition: xml.h:45
TBSet NameChSet
Definition: xml.h:46
TBSet DigitChSet
Definition: xml.h:46
TBSet LetterChSet
Definition: xml.h:46

Member Function Documentation

bool TXmlChDef::IsChar ( const uchar Ch) const
inline

Definition at line 68 of file xml.h.

Referenced by TXmlLx::GetAttList(), TXmlLx::GetAttValue(), TXmlLx::GetCDSect(), TXmlLx::GetComment(), TXmlLx::GetElement(), TXmlLx::GetEntityValue(), TXmlLx::GetNotation(), TXmlLx::GetPI(), TXmlLx::GetSym(), and TXmlLx::GetSystemLiteral().

68 {return CharChSet.GetBit(Ch);}
TBSet CharChSet
Definition: xml.h:45
bool GetBit(const int &BitN) const
Definition: bits.h:358

Here is the caller graph for this function:

bool TXmlChDef::IsComb ( const uchar Ch) const
inline

Definition at line 69 of file xml.h.

69 {return CombChSet.GetBit(Ch);}
bool GetBit(const int &BitN) const
Definition: bits.h:358
TBSet CombChSet
Definition: xml.h:45
bool TXmlChDef::IsDigit ( const uchar Ch) const
inline

Definition at line 72 of file xml.h.

72 {return DigitChSet.GetBit(Ch);}
bool GetBit(const int &BitN) const
Definition: bits.h:358
TBSet DigitChSet
Definition: xml.h:46
bool TXmlChDef::IsEntityNm ( const TStr EntityNm,
TStr EntityVal 
) const
inline

Definition at line 83 of file xml.h.

Referenced by TXmlLx::GetReference().

83  {
84  return EntityNmToValH.IsKeyGetDat(EntityNm, EntityVal);}
TStrStrH EntityNmToValH
Definition: xml.h:47
bool IsKeyGetDat(const TKey &Key, TDat &Dat) const
Definition: hash.h:274

Here is the caller graph for this function:

bool TXmlChDef::IsEoln ( const uchar Ch) const
inline

Definition at line 80 of file xml.h.

References TCh::CrCh, and TCh::LfCh.

80  {
81  return (Ch==TCh::CrCh)||(Ch==TCh::LfCh);}
static const char LfCh
Definition: dt.h:1038
static const char CrCh
Definition: dt.h:1039
bool TXmlChDef::IsExt ( const uchar Ch) const
inline

Definition at line 70 of file xml.h.

70 {return ExtChSet.GetBit(Ch);}
TBSet ExtChSet
Definition: xml.h:45
bool GetBit(const int &BitN) const
Definition: bits.h:358
bool TXmlChDef::IsFirstNameCh ( const uchar Ch) const
inline

Definition at line 78 of file xml.h.

Referenced by TXmlLx::GetName().

78  {
79  return IsLetter(Ch)||(Ch=='_')||(Ch==':');}
bool IsLetter(const uchar &Ch) const
Definition: xml.h:71

Here is the caller graph for this function:

bool TXmlChDef::IsLetter ( const uchar Ch) const
inline

Definition at line 71 of file xml.h.

71 {return LetterChSet.GetBit(Ch);}
bool GetBit(const int &BitN) const
Definition: bits.h:358
TBSet LetterChSet
Definition: xml.h:46
bool TXmlChDef::IsName ( const uchar Ch) const
inline

Definition at line 73 of file xml.h.

Referenced by TXmlLx::GetName().

73 {return NameChSet.GetBit(Ch);}
bool GetBit(const int &BitN) const
Definition: bits.h:358
TBSet NameChSet
Definition: xml.h:46

Here is the caller graph for this function:

bool TXmlChDef::IsPubid ( const uchar Ch) const
inline

Definition at line 74 of file xml.h.

Referenced by TXmlLx::GetPubidLiteral().

74 {return PubidChSet.GetBit(Ch);}
TBSet PubidChSet
Definition: xml.h:46
bool GetBit(const int &BitN) const
Definition: bits.h:358

Here is the caller graph for this function:

bool TXmlChDef::IsWs ( const uchar Ch) const
inline

Definition at line 76 of file xml.h.

References TCh::CrCh, TCh::LfCh, and TCh::TabCh.

Referenced by TXmlLx::GetDocTypeDecl(), TXmlLx::GetSym(), TXmlLx::GetWs(), TXmlLx::SkipWs(), and TXmlLx::ToNrSpacing().

76  {
77  return (Ch==' ')||(Ch==TCh::CrCh)||(Ch==TCh::LfCh)||(Ch==TCh::TabCh);}
static const char TabCh
Definition: dt.h:1037
static const char LfCh
Definition: dt.h:1038
static const char CrCh
Definition: dt.h:1039

Here is the caller graph for this function:

static PXmlChDef TXmlChDef::Load ( TSIn SIn)
inlinestatic

Definition at line 58 of file xml.h.

58 {return new TXmlChDef(SIn);}
TXmlChDef()
Definition: xml.cpp:208
TXmlChDef& TXmlChDef::operator= ( const TXmlChDef )
inline

Definition at line 66 of file xml.h.

References Fail.

66 {Fail; return *this;}
#define Fail
Definition: bd.h:238
void TXmlChDef::Save ( TSOut SOut)
inline

Definition at line 59 of file xml.h.

59  {
60  Chs.Save(SOut);
61  CharChSet.Save(SOut); CombChSet.Save(SOut); ExtChSet.Save(SOut);
62  LetterChSet.Save(SOut); DigitChSet.Save(SOut); NameChSet.Save(SOut);
63  PubidChSet.Save(SOut);
64  EntityNmToValH.Save(SOut);}
TBSet PubidChSet
Definition: xml.h:46
TBSet CharChSet
Definition: xml.h:45
TInt Chs
Definition: xml.h:44
void Save(TSOut &SOut) const
Definition: dt.h:1153
void Save(TSOut &SOut) const
Definition: hash.h:183
TStrStrH EntityNmToValH
Definition: xml.h:47
TBSet ExtChSet
Definition: xml.h:45
TBSet CombChSet
Definition: xml.h:45
TBSet NameChSet
Definition: xml.h:46
void Save(TSOut &SOut) const
Definition: bits.h:332
TBSet DigitChSet
Definition: xml.h:46
TBSet LetterChSet
Definition: xml.h:46
void TXmlChDef::SetChTy ( TBSet ChSet,
const int &  MnCh,
const int &  MxCh = -1 
)
private

Definition at line 190 of file xml.cpp.

References Chs, IAssert, and TBSet::Incl().

Referenced by TXmlChDef().

190  {
191  IAssert((0<=MnCh)&&((MxCh==-1)||((MnCh<=MxCh)&&(MxCh<Chs))));
192  ChSet.Incl(MnCh);
193  for (int Ch=MnCh+1; Ch<=MxCh; Ch++){
194  ChSet.Incl(Ch);}
195 }
#define IAssert(Cond)
Definition: bd.h:262
TInt Chs
Definition: xml.h:44
void Incl(const int &BitN)
Definition: bits.h:344

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlChDef::SetChTy ( TBSet ChSet,
const TStr Str 
)
private

Definition at line 197 of file xml.cpp.

References TBSet::Incl(), and TStr::Len().

197  {
198  for (int ChN=0; ChN<Str.Len(); ChN++){
199  uchar Ch=Str[ChN];
200  ChSet.Incl(Ch);
201  }
202 }
int Len() const
Definition: dt.h:490
void Incl(const int &BitN)
Definition: bits.h:344
unsigned char uchar
Definition: bd.h:10

Here is the call graph for this function:

void TXmlChDef::SetEntityVal ( const TStr Nm,
const TStr Val 
)
private

Definition at line 204 of file xml.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), and EntityNmToValH.

Referenced by TXmlChDef().

204  {
205  EntityNmToValH.AddDat(Nm, Val);
206 }
TStrStrH EntityNmToValH
Definition: xml.h:47
TDat & AddDat(const TKey &Key)
Definition: hash.h:238

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class TPt< TXmlChDef >
friend

Definition at line 42 of file xml.h.

Member Data Documentation

TBSet TXmlChDef::CharChSet
private

Definition at line 45 of file xml.h.

Referenced by TXmlChDef().

TInt TXmlChDef::Chs
private

Definition at line 44 of file xml.h.

Referenced by SetChTy(), and TXmlChDef().

TBSet TXmlChDef::CombChSet
private

Definition at line 45 of file xml.h.

Referenced by TXmlChDef().

TCRef TXmlChDef::CRef
private

Definition at line 42 of file xml.h.

TBSet TXmlChDef::DigitChSet
private

Definition at line 46 of file xml.h.

Referenced by TXmlChDef().

TStrStrH TXmlChDef::EntityNmToValH
private

Definition at line 47 of file xml.h.

Referenced by SetEntityVal().

TBSet TXmlChDef::ExtChSet
private

Definition at line 45 of file xml.h.

Referenced by TXmlChDef().

TBSet TXmlChDef::LetterChSet
private

Definition at line 46 of file xml.h.

Referenced by TXmlChDef().

TBSet TXmlChDef::NameChSet
private

Definition at line 46 of file xml.h.

Referenced by TXmlChDef().

TBSet TXmlChDef::PubidChSet
private

Definition at line 46 of file xml.h.

Referenced by TXmlChDef().


The documentation for this class was generated from the following files: