SNAP Library , Developer Reference  2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TXmlChDef Class Reference

#include <xml.h>

Collaboration diagram for TXmlChDef:

List of all members.

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

Definition at line 208 of file xml.cpp.

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

                    :
  Chs(TUCh::Vals),
  CharChSet(), CombChSet(), ExtChSet(),
  LetterChSet(), DigitChSet(), NameChSet(), PubidChSet(),
  EntityNmToValH(100){

  // Character-Sets
  // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | ...
  CharChSet.Gen(Chs);
  // ... because of DMoz (temporary patch)
  SetChTy(CharChSet, 0x1); SetChTy(CharChSet, 0x3); SetChTy(CharChSet, 0x6);
  SetChTy(CharChSet, 11); SetChTy(CharChSet, 24); SetChTy(CharChSet, 27);
  // regular characters
  SetChTy(CharChSet, 0x9); SetChTy(CharChSet, 0xA); SetChTy(CharChSet, 0xD);
  SetChTy(CharChSet, 0x20, TUCh::Mx);
  // BaseChar ::=  [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] |
  //  [#x00D8-#x00F6] | [#x00F8-#x00FF] | ...
  TBSet BaseChSet(Chs);
  SetChTy(BaseChSet, 0x41, 0x5A); SetChTy(BaseChSet, 0x61, 0x7A);
  SetChTy(BaseChSet, 0xC0, 0xD6); SetChTy(BaseChSet, 0xD8, 0xF6);
  SetChTy(BaseChSet, 0xF8, 0xFF);
  // Ideographic ::= ...
  TBSet IdeoChSet(Chs);
  // CombiningChar ::= ...
  CombChSet.Gen(Chs);
  // Extender ::=  #x00B7 | ...
  ExtChSet.Gen(Chs);
  SetChTy(ExtChSet, 0xB7);
  // Letter ::=  BaseChar | Ideographic
  LetterChSet=BaseChSet|IdeoChSet;
  // Digit ::=  [#x0030-#x0039] | ...
  DigitChSet.Gen(Chs);
  SetChTy(DigitChSet, 0x30, 0x39);
  // NameChar ::=  Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar
  NameChSet=LetterChSet|DigitChSet|
   uchar('.')|uchar('-')|uchar('_')|uchar(':')|CombChSet;
  // PubidChar ::=  #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  PubidChSet.Gen(Chs);
  SetChTy(PubidChSet, 0x20); SetChTy(PubidChSet, 0xD); SetChTy(PubidChSet, 0xA);
  SetChTy(PubidChSet, 'a', 'z'); SetChTy(PubidChSet, 'A', 'Z');
  SetChTy(PubidChSet, '0', '9'); SetChTy(PubidChSet, "-'()+,./:=?;!*#@$_%");

  // Standard-Entity-Sequences
  SetEntityVal("amp", "&");
  SetEntityVal("lt", "<"); SetEntityVal("gt", ">");
  SetEntityVal("apos", "'"); SetEntityVal("quot", "\"");
}

Here is the call graph for this function:

TXmlChDef::TXmlChDef ( TSIn SIn) [inline]

Definition at line 53 of file xml.h.

                      :
    Chs(SIn),
    CharChSet(SIn), CombChSet(SIn), ExtChSet(SIn),
    LetterChSet(SIn), DigitChSet(SIn), NameChSet(SIn), PubidChSet(SIn),
    EntityNmToValH(SIn){}

Member Function Documentation

bool TXmlChDef::IsChar ( const uchar Ch) const [inline]
bool TXmlChDef::IsComb ( const uchar Ch) const [inline]

Definition at line 69 of file xml.h.

{return CombChSet.GetBit(Ch);}
bool TXmlChDef::IsDigit ( const uchar Ch) const [inline]

Definition at line 72 of file xml.h.

{return DigitChSet.GetBit(Ch);}
bool TXmlChDef::IsEntityNm ( const TStr EntityNm,
TStr EntityVal 
) const [inline]

Definition at line 83 of file xml.h.

Referenced by TXmlLx::GetReference().

                                                               {
    return EntityNmToValH.IsKeyGetDat(EntityNm, EntityVal);}

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.

                                     {
    return (Ch==TCh::CrCh)||(Ch==TCh::LfCh);}
bool TXmlChDef::IsExt ( const uchar Ch) const [inline]

Definition at line 70 of file xml.h.

{return ExtChSet.GetBit(Ch);}
bool TXmlChDef::IsFirstNameCh ( const uchar Ch) const [inline]

Definition at line 78 of file xml.h.

Referenced by TXmlLx::GetName().

                                            {
    return IsLetter(Ch)||(Ch=='_')||(Ch==':');}

Here is the caller graph for this function:

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

Definition at line 71 of file xml.h.

{return LetterChSet.GetBit(Ch);}
bool TXmlChDef::IsName ( const uchar Ch) const [inline]

Definition at line 73 of file xml.h.

Referenced by TXmlLx::GetName().

{return NameChSet.GetBit(Ch);}

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().

{return PubidChSet.GetBit(Ch);}

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().

                                   {
    return (Ch==' ')||(Ch==TCh::CrCh)||(Ch==TCh::LfCh)||(Ch==TCh::TabCh);}

Here is the caller graph for this function:

static PXmlChDef TXmlChDef::Load ( TSIn SIn) [inline, static]

Definition at line 58 of file xml.h.

{return new TXmlChDef(SIn);}
TXmlChDef& TXmlChDef::operator= ( const TXmlChDef ) [inline]

Definition at line 66 of file xml.h.

References Fail.

{Fail; return *this;}
void TXmlChDef::Save ( TSOut SOut) [inline]

Definition at line 59 of file xml.h.

                        {
    Chs.Save(SOut);
    CharChSet.Save(SOut); CombChSet.Save(SOut); ExtChSet.Save(SOut);
    LetterChSet.Save(SOut); DigitChSet.Save(SOut); NameChSet.Save(SOut);
    PubidChSet.Save(SOut);
    EntityNmToValH.Save(SOut);}
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().

                                                                     {
  IAssert((0<=MnCh)&&((MxCh==-1)||((MnCh<=MxCh)&&(MxCh<Chs))));
  ChSet.Incl(MnCh);
  for (int Ch=MnCh+1; Ch<=MxCh; Ch++){
    ChSet.Incl(Ch);}
}

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().

                                                    {
  for (int ChN=0; ChN<Str.Len(); ChN++){
    uchar Ch=Str[ChN];
    ChSet.Incl(Ch);
  }
}

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().

                                                           {
  EntityNmToValH.AddDat(Nm, Val);
}

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

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().

Definition at line 45 of file xml.h.

Referenced by TXmlChDef().

Definition at line 42 of file xml.h.

Definition at line 46 of file xml.h.

Referenced by TXmlChDef().

Definition at line 47 of file xml.h.

Referenced by SetEntityVal().

Definition at line 45 of file xml.h.

Referenced by TXmlChDef().

Definition at line 46 of file xml.h.

Referenced by TXmlChDef().

Definition at line 46 of file xml.h.

Referenced by TXmlChDef().

Definition at line 46 of file xml.h.

Referenced by TXmlChDef().


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