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
TUniChDb::TSubcatHelper Class Reference

#include <unicode.h>

Collaboration diagram for TUniChDb::TSubcatHelper:

Public Member Functions

 TSubcatHelper (TUniChDb &owner_)
 
void ProcessComment (TUniChDb::TUcdFileReader &reader)
 
void SetCat (const int cp)
 
void TestCat (const int cp)
 
 ~TSubcatHelper ()
 

Public Attributes

bool hasCat
 
TUniChSubCategory subCat
 
TStrH invalidCatCodes
 
TUniChDbowner
 

Detailed Description

Definition at line 1720 of file unicode.h.

Constructor & Destructor Documentation

TUniChDb::TSubcatHelper::TSubcatHelper ( TUniChDb owner_)
inline

Definition at line 1727 of file unicode.h.

1727 : owner(owner_) { }
TUniChDb::TSubcatHelper::~TSubcatHelper ( )
inline

Definition at line 1754 of file unicode.h.

References TStr::CStr(), THash< TKey, TDat, THashFunc >::DelKey(), THash< TKey, TDat, THashFunc >::Empty(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), THash< TKey, TDat, THashFunc >::GetKey(), and THash< TKey, TDat, THashFunc >::IsKey().

1755  {
1756  if (invalidCatCodes.IsKey("L&")) invalidCatCodes.DelKey("L&");
1757  // Output any unexpected ones (there shouldn't be any).
1758  if (! invalidCatCodes.Empty()) {
1759  printf("Invalid cat code(s) in the comments: ");
1761  printf(" \"%s\"", invalidCatCodes.GetKey(i).CStr());
1762  printf("\n"); }
1763  }
bool Empty() const
Definition: hash.h:227
void DelKey(const TKey &Key)
Definition: hash.h:404
bool FNextKeyId(int &KeyId) const
Definition: hash.h:478
int FFirstKeyId() const
Definition: hash.h:278
char * CStr()
Definition: dt.h:479
bool IsKey(const TKey &Key) const
Definition: hash.h:258
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252

Here is the call graph for this function:

Member Function Documentation

void TUniChDb::TSubcatHelper::ProcessComment ( TUniChDb::TUcdFileReader reader)
inline

Definition at line 1729 of file unicode.h.

References THash< TKey, TDat, THashFunc >::AddKey(), TUniChDb::TUcdFileReader::comment, IAssert, TUniChInfo::IsValidSubCat(), and TChA::Len().

Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitPropList(), and TUniChDb::InitScripts().

1730  {
1731  hasCat = false; subCat = ucOtherNotAssigned;
1732  if (reader.comment.Len() > 3)
1733  {
1734  IAssert(reader.comment[0] == '#');
1735  IAssert(reader.comment[1] == ' ');
1736  char chCat = reader.comment[2], chSubCat = reader.comment[3];
1737  if (reader.comment.Len() > 4) IAssert(isspace(uchar(reader.comment[4])));
1738  if (TUniChInfo::IsValidSubCat(chCat, chSubCat)) {
1739  hasCat = true; subCat = (TUniChSubCategory) ((int(uchar(chCat)) << 8) | (int(uchar(chSubCat)))); }
1740  else invalidCatCodes.AddKey(TStr(chCat) + TStr(chSubCat));
1741  }
1742  }
#define IAssert(Cond)
Definition: bd.h:262
enum TUniChSubCategory_ TUniChSubCategory
int Len() const
Definition: dt.h:259
static bool IsValidSubCat(const char chCat, const char chSubCat)
Definition: unicode.h:1164
unsigned char uchar
Definition: bd.h:10
int AddKey(const TKey &Key)
Definition: hash.h:373
TUniChSubCategory subCat
Definition: unicode.h:1723
Definition: dt.h:412

Here is the call graph for this function:

Here is the caller graph for this function:

void TUniChDb::TSubcatHelper::SetCat ( const int  cp)
inline

Definition at line 1744 of file unicode.h.

References THash< TKey, TDat, THashFunc >::GetKeyId(), TUniChDb::h, and IAssert.

Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitPropList(), and TUniChDb::InitScripts().

1744  {
1745  int i = owner.h.GetKeyId(cp); IAssert(i >= 0);
1746  IAssert(owner.h[i].subCat == ucOtherNotAssigned);
1747  IAssert(hasCat);
1748  owner.h[i].SetCatAndSubCat(subCat); }
#define IAssert(Cond)
Definition: bd.h:262
THash< TInt, TUniChInfo > h
Definition: unicode.h:1263
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TUniChSubCategory subCat
Definition: unicode.h:1723

Here is the call graph for this function:

Here is the caller graph for this function:

void TUniChDb::TSubcatHelper::TestCat ( const int  cp)
inline

Definition at line 1749 of file unicode.h.

References THash< TKey, TDat, THashFunc >::GetKeyId(), TUniChDb::h, and IAssert.

Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitPropList(), and TUniChDb::InitScripts().

1749  {
1750  if (! hasCat) return;
1751  int i = owner.h.GetKeyId(cp); IAssert(i >= 0);
1752  IAssert(owner.h[i].subCat == subCat); }
#define IAssert(Cond)
Definition: bd.h:262
THash< TInt, TUniChInfo > h
Definition: unicode.h:1263
int GetKeyId(const TKey &Key) const
Definition: hash.h:466
TUniChSubCategory subCat
Definition: unicode.h:1723

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

bool TUniChDb::TSubcatHelper::hasCat

Definition at line 1723 of file unicode.h.

TStrH TUniChDb::TSubcatHelper::invalidCatCodes

Definition at line 1724 of file unicode.h.

TUniChDb& TUniChDb::TSubcatHelper::owner

Definition at line 1725 of file unicode.h.

TUniChSubCategory TUniChDb::TSubcatHelper::subCat

Definition at line 1723 of file unicode.h.


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